Saltycrane logo

SaltyCrane Blog

Notes on Python, Django, and web development on Ubuntu Linux

    

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 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.)

7 Comments — feed icon Comments feed for this post


#1 johne59 commented on 2008-03-16:

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 2008-03-26:

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 2008-06-19:

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 2009-03-04:

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


#5 Chris commented on 2009-10-21:

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 2009-10-21:

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 2010-09-20:

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.

Post a comment

Required
Required, but not displayed
Optional

Format using Markdown. (No HTML.)
  • Code blocks: prefix each line by at least 4 spaces or 1 tab (and a blank line before and after)
  • Code span: surround with backticks
  • Blockquotes: prefix lines to be quoted with >
  • Links: <URL>
  • Links w/ description: [description](URL)
Created with Django | Hosted by Linode