Thursday, May 29, 2008

Notes on setting up Cygwin

Get the "setup.exe" tool from www.cygwin.com.

*Setup will lead you through a series of choices (keep the default choices in general for directory names and to install from the internet, but you'll need to pick a local mirror site for the files), and
will let you choose the packages you want to install with a nice GUI.

What I installed

  • I wanted TeX and program development environments, and like to work in X-windows. From the GUI that runs from the setup.exe program (it takes a while for setup to scan the archive the first time) I selected the following files beyond the defaults in addition to the files set by the default settings in each category (setup is smart: selecting something will select most but sometimes not all other necessary files, but the setup program checks for links at the end)
    • Admin
      • cron
    • Devel
      • cvs
      • gcc-g77
      • make
      • (bison, byak, and flex)
    • Editors
      • emacs
      • emacs-X11
      • vim
    • Graphics
      • ghostscript-x11
      • gv
    • Interpreters
      • (gawk; sed is in the Base default)
    • Net
      • openssh
      • rsync
    • Publishing
      • tetex (then don't forget to run texconfig to select paper size and other default options)
      • tetex-base
      • tetex-extras (for BibTeX stuff in my case; run texconfig rehash so TeX knows where to find the extra files)
      • tetex-x11
    • Shells
      • tcsh
    • Text
      • aspell
      • enscript
      • more
    • X11 (no subdirectories, select install for the whole package; the default option isn't quite enough for what I'm doing)
Cygwin's package search page, www.cygwin.com/packages/, is very useful finding missing files or commands. The setup program is smart and automatically gets most of the dependent files, but when you're looking for something you want or are missing...

Path work

Add or set the Windows environment variable HOME to c:\ -- this is where you wind up when you type cd at a Cygwin prompt.
  • The Cygwin initial paths and other setup parameters are in c:\cygwin\etc\profile. After a little editing, my Cygwin path is something like: PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:.:$PATH" In previous versions /usr/X11R6/bin had to be first in the list to pick up the version of ghostscript (gs) that works in X-Windows, but this seems to have changed in recent releases. The problem before was that a version that didn't have an x11 device was ahead of the X version in the default path. I also added the reference to the current directory at the end of the Cygwin native path but before the Windows path. A full copy of my profile file is below and can be used as a model
Starting the X-Windows manager
refer http://www.astro.umd.edu/~harris/cygwin/index.html

Initialization files

For an XP installation, here are my personalized versions of:
  • profile (modified version of c:\cygwin\etc\profile, written over original version, now saved as profile.org)
  • .xinitrc (modified version of c:\cygwin\etc\X11\xinit\xinitrc saved as c:\.initrc)
  • .cshrc (modified version of c:\cygwin\etc\csh.cshrc saved as c:\.cshrc)
  • .login (modified version of c:\cygwin\etc\csh.login saved as c:\.login
  • .emacs (an emacs initialization file that works for me -- there are many other examples and discussions on the web)
  • startxwin (modified version of c:\cygwin\usr\X11R6\bin\startxwin.sh saved as c:\cygwin\usr\X11R6\startxwin)

Notes on rsync

To rsync to another disk, for instance disk e: (easy to see which are available with the df command):
rsync -avu --delete sourcedir/ /cygwin/e/destdir/
This command removes files that have been removed from the source directory but will not overwrite newer files in the destination,

To rsync to another system with ssh over the net:
rsync -avu --delete -e ssh sourcedir/ username@machine:~/destdir/

To avoid typing passwords for each network transfer:
  • Generate key for ssh with ssh-keygen. Take all defaults including a blank passphrase (otherwise you'll want a passphrase and to invoke an ssh agent, a good idea if you have any security concerns past the most basic ones). Keep track of the file locations.
  • Copy the generated file, id_rsa.pub, to the ~/.ssh directory on the remote machine. Rename it or append it to a file titled authorized_keys. The file must be read-write for the owner only (chmod 600).
  • It is possible to edit this file to restrict access to this mode following instructions in this link.
  • The counterpart to the public file is id_rsa; that may be copied (securely!) to other local machines so you can log in from them as well.

Notes on rsync

To rsync to another disk, for instance disk e: (easy to see which are available with the df command):
rsync -avu --delete sourcedir/ /cygwin/e/destdir/
This command removes files that have been removed from the source directory but will not overwrite newer files in the destination,

To rsync to another system with ssh over the net:
rsync -avu --delete -e ssh sourcedir/ username@machine:~/destdir/

To avoid typing passwords for each network transfer:
  • Generate key for ssh with ssh-keygen. Take all defaults including a blank passphrase (otherwise you'll want a passphrase and to invoke an ssh agent, a good idea if you have any security concerns past the most basic ones). Keep track of the file locations.
  • Copy the generated file, id_rsa.pub, to the ~/.ssh directory on the remote machine. Rename it or append it to a file titled authorized_keys. The file must be read-write for the owner only (chmod 600).
  • It is possible to edit this file to restrict access to this mode following instructions in this link.
  • The counterpart to the public file is id_rsa; that may be copied (securely!) to other local machines so you can log in from them as well.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home