SaltyCrane Blog — Notes on JavaScript and web development

Cygwin install tips using cyg-apt

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 rsyncBest backup utility
    $ cyg-apt install screenTerminal multiplexer
    $ cyg-apt install xorg-x11-baseX Windows
    $ cyg-apt install rxvt-unicode-XBetter Xterm
    $ cyg-apt install diffutilsdiff
    $ cyg-apt install gcc-coreGCC C complier
    $ cyg-apt install makeGNU make
    $ cyg-apt install xorg-x11-develX header and library files for compiling ratpoison or other programs
    $ cyg-apt install readlineused for ratpoison
    $ cyg-apt install cronso I can schedule my backups and updatedb
    $ cyg-apt install ssmtpSendmail replacement so cron can email me
    $ cyg-apt install emacsTerminal 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.)

Comments


#1 johne59 commented on :

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


#2 sofeng commented on :

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.


#3 bkline commented on :

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!


#4 roger commented on :

Looks like there's also an apt-cyg http://stephenjungels.com/jungels.net/projects/apt-cyg/


#5 Chris commented on :

cyg-apt is also several current projects on Google Code:

http://code.google.com/p/cyg-apt/ (Mine: emphasis on ease of installation, robustness and features.)

http://code.google.com/p/maphew/wiki/CygApt (Aims include installing Cygwin from scratch.)

http://code.google.com/p/apt-cyg/ (New home of apt-cyg mentioned above: rather than a Python program like cyg-apt, this is a shell script.)

Both cyg-apt projects have strategies to handle packages cyg-apt itself depends on.


#6 Eliot commented on :

Chris, thanks for your update of the other projects out there including your own. It is cool to see these projects being developed for Cygwin.

P.S. I see your cyg-apt project is based off of the one I used by Jan Nieuwenhuizen. That is great you are keeping the project maintained. And, of course, I love that fact that it is in Python.


#7 gabriel commented on :

Not work against the proxy...

i set the http_proxy system variable and set this guy on wgetcr

the error Error in server response, closing control connection.