Cygwin install tips using cyg-apt



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/11/cygwin-install-tips/

You should be redirected in 2 seconds.



I recently got a new computer at work and needed to reinstall Cygwin. Here is my install procedure using the very nice cyg-apt script. It's like Debian's apt-get for Cygwin! Note, this install process assumes that I have all my init files backed up and can copy them over to my new machine.

  1. Run the Cygwin setup program and install the default packages plus wget and python.
  2. Set the Windows user environment variable HOME to c:\home\sofeng. Note, I tried it with forward slashes, but then it doesn't work in my Windows batch file.
  3. Start the Cygwin bash shell
  4. Change the cygdrive prefix:
    mount -s --change-cygdrive-prefix /
    If you don't have admin privileges:
    mount -u --change-cygdrive-prefix /
  5. Copy over my init files and startup scripts:
    • ~/bin/startxwin.bat
      This is the Windows batch file that I use to start my Cygwin/X environment. It does the following:
      • Adds ~/bin to my PATH
      • cds to my HOME directory
      • Starts the ratpoison window manager with a urxvt terminal running screen
    • ~/.Xdefaults
      Sets the colors, font, and scrolling behavior for urxvt.
    • ~/.bashrc
      • Sets the PS1 (prompt), EDITOR, http_proxy, and other environment variables.
      • Sets a lot of aliases
      • Sets bash filename completion to be case insensitive
    • ~/.cyg-apt
    • ~/.emacs
    • ~/.emacs.d
    • ~/.inputrc
    • ~/.screenrc
    • /etc/ssmtp/ssmtp.conf
    • /var/cron/tabs/sofeng
  6. Install cyg-apt
    $ wget http://www.lilypond.org/~janneke/software/cyg-apt
    $ chmod a+xr cyg-apt
    $ mv cyg-apt ~/bin
  7. Install good stuff (note, if you don't already have ~/.cyg-apt, you will need to run cyg-apt setup first):
    $ cyg-apt install rsync Best backup utility
    $ cyg-apt install screen Terminal multiplexer
    $ cyg-apt install xorg-x11-base X Windows
    $ cyg-apt install rxvt-unicode-X Better Xterm
    $ cyg-apt install diffutils diff
    $ cyg-apt install gcc-core GCC C complier
    $ cyg-apt install make GNU make
    $ cyg-apt install xorg-x11-devel X header and library files for compiling ratpoison or other programs
    $ cyg-apt install readline used for ratpoison
    $ cyg-apt install cron so I can schedule my backups and updatedb
    $ cyg-apt install ssmtp Sendmail replacement so cron can email me
    $ cyg-apt install emacs Terminal version of emacs for quick editing jobs from the shell

Other notes:

  • I thought that I needed to add c:/cygwin/bin to my Windows path in order to use grep in Emacs Windows. However, I later found out that this step is not needed. It is generally bad practice to add c:/cygwin/bin to the Windows path. Instead, I added the required code in my .emacs file. See http://cygwin.com/faq/faq-nochunks.html#faq.using.ntemacs for more information.
  • I used to keep my http proxy server information in ~/.wgetrc, but now I store it in the http_proxy environment variable. (Note, it is lowercase and not uppercase. I don't know why this is.)

3 comments:

Unknown said...

I had to make two edits to cyg-apt to get it to work:

1) root = '/'
2) mirror = 'http://sources-redhat.mirror.redwire.net/cygwin'

My cygwin root os set to '/' and it didn't appear that the http://mirrors.rcn.net/pub/sourceware/cygwin mirror was working.

-john

sofeng said...

john,
taking a look back, it seems like i needed to modify the mirror also. sorry for not noting that in the post. the weird thing is that my current version of cyg-apt is much different than the one from the location i posted. i wonder if the cyg-apt script auto updated itself. or did i download a different version and not remember? it turns out there is a much newer version located at http://lilypond.org/cygwin/cyg-apt. The modified date says 02-Jun-2007. I'm not sure why there are two versions on the site.

Anonymous said...

Be careful not to use cyg-apt to update a package that cyg-apt itself needs. I once ran cyg-apt install bzip2 to bring bzip2 up to the latest version, and was hosed: bzip2 was gone!

About

This is my *OLD* blog. I've copied all of my posts and comments over to my NEW blog at:

http://www.saltycrane.com/blog/.

Please go there for my updated posts. I will leave this blog up for a short time, but eventually plan to delete it. Thanks for reading.