Cygwin

Install packages from the command line

  • For simple usage, you can run Cygwin setup.exe directly:
setup-x86.exe -q -P packagename1,packagename2

Set different permissions for user and group

It is impossible to set different permissions for user and group, if group is set to None. To change this, simply set a valid group:

chown -R :Users directories_or_files

Install SSHD daemon

  • Use Cygwin setup.exe to install OpenSSH and cygrunsrv;
  • Start a Cygwin bash shell as an Administrator;
  • Run ssh-host-config [-y], answer yes to all questions except the one that asks if you want to use a different user name instead of "cyg_server";
  • Enter "ntsec", "tty ntsec" or "binmode ntsec" to the prompt "Enter the value of CYGWIN for the daemon", which will enable communication with the NT authentication database;
  • Run the following commands to change permissions of relevant files:
chown cyg_server:root /etc/ssh*
chmod go-rwx /etc/ssh*_key
chown -R cyg_server:root /var/empty
chmod 755 /var/empty
chown cyg_server:root /var/log/sshd.log
chmod 644 /var/log/sshd.log
  • Open Computer Management, go to Services and Applications -> Services, right-click CYGWIN sshd and select Properties. In the Properties dialog box, go to the Log On tab, select Log on as this account, and specify the domain/user name and password. Click Apply.
  • SSHD daemon will now start at boot. You can start it right away with cygrunsrv -S sshd, net start sshd, or /usr/sbin/sshd;
  • Add a rule in Advanced Windows Firewall settings to allow C:\cygwin64\usr\sbin\sshd.exe. You can limit Services to "Apply to services only" and Local port to "Specific Ports" (e.g., 22).

Install cron daemon

  • Use Cygwin setup.exe to install cron and cygrunsrv;
  • Start a Cygwin bash shell as an Administrator;
  • Add cron as a Windows service and start it:
cygrunsrv -I cron -p /usr/sbin/cron -a -n
cygrunsrv -S cron # or "net start cron" or "/usr/sbin/cron -a -n"
  • As usual, use crontab to add tasks; maybe something like updating DDNS services every hour if you don't have static IP addresses:
0 * * * * ip=$(curl -s "http://freedns.afraid.org/dynamic/update.php?SPECIAL_STRING"|/usr/bin/gawk 'NF==6{print $3}NF==7{print $4}'); curl "https://www.dtdns.com/api/autodns.cfm?id=yourname.suroot.com&pw=PASSWORD&ip=$ip" &> /dev/null; curl --user your@email.com:PASSWORD "https://www.dnsdynamic.org/api/?hostname=yourname.dnsd.info&myip=$ip" &> /dev/null; curl --user USERNAME:PASSWORD "https://members.dyndns.org/nic/update?hostname=yourname.dyndns.org&myip=$ip" &> /dev/null

Install zeromq / pyzmq

This software is needed if, for example, you want to pip install ipython[notebook]. As of 2015/01/08, you have to first install zeromq separately. Follow the "To build on UNIX-like systems" section, but you don't need the build-essential and uuid/e2fsprogs packages.

To compile zeromq, you need to apply the hacks here. Basically, force libzmq.la to compile as C++ library:

mv tools/curve_keygen.c tools/curve_keygen.cpp
sed -i 's/\.c\>/&pp/' tools/Makefile.am
rm -f tools/.deps/curve_keygen.Po
./autogen.sh
make

Then you will need to create a shared library manually following the suggestions here:

export ARTIFACT=/usr/local # the path you have supplied to ./configure --prefix=$ARTIFACT

# shared libraries broken with 0MQ on Cygwin64
# manual shared library link and install from static library

gcc -shared -o cygzmq.dll -Wl,--out-implib=libzmq.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive src/.libs/libzmq.a -Wl,--no-whole-archive -lstdc++

mkdir -p $ARTIFACT/bin
install cygzmq.dll $ARTIFACT/bin

mkdir -p $ARTIFACT/lib
install libzmq.dll.a $ARTIFACT/lib

Then you can install ipython or do pip install pyzmq.

Comments

Comments powered by Disqus