banner 1

Install Cygwin

banner 2 banner 3 banner 4 banner 5
Top Left Image

The Reason to Not Completely Abandon M$

Top Right Image
I cannot say enough good things about the software cygwin. It is my favorite software available on Windows today. Cygwin offers a Windows compatible C/C++/Fortran 77 compiler (gcc), an X-server and numerous other *NIX like utilities that function flawlessly on Windows (i.e. ssh, rsync, grep, sed). Some complain about the size of the download, but in my opinion one should expect such a large download or install for so many indespensible utilities. This document is in its initial stages, so please notify me of any problems you encounter.

For those of you not interested in going through the actual installation, you can try the XLiveCD version of cygwin, which lets you run cygwin off a CD.

My Installation

NOTE: This document is merely my personal update to the wonderful document, Cygwin/X User's Guide

NOTE: Whenever a path has the backslash "\" it is referring to a Windows path, whenever it uses the forwardslash "/" it is referring to a path from you cygwin xterm.

Follow this link to the cygwin website, and download the setup.exe file. Now go to where you have downloaded setup.exe, and open this file. You will see the following window

Setup

Click Next, and you will see the following window:

Install Type

Select to Install from the Internet, and then you will see:

Location

Make sure that you select the options as I have above. This way, when you run cygwin it will look at the Windows directory, "C:\\cygwin" as if it was the root directory of a Linux installation, "/". Also make sure to treat the default text type as Unix, so that cygwin's files will interact smoothly with the servers you log into. Now click Next, and you will see:

Repository

This is to tell cygwin where to download all of the files. It really doesn't matter where you choose to do this, as long as you remember it for future reference. Select next, and then you see:

Setting

I typically use Direct Connection, although if you're behing a proxy server or firewall you may want to choose to Use IE5 Settings. Select Next and you'll see the mirror selection window:

Mirror

Try to select the one that is closest to your current location. After selecting Next we get to to the Package Selection Window:

Packages

Here is a list of the packages I have installed, feel free to add any of the other packages that you think you may find useful

  • Archive
    • unzip
    • zip
  • Base
    • (Everything)
  • Database
    • (None)
  • Devel
    • all gcc and g77 (optional)
    • ddd (optional)
    • gdb (optional)
    • subversion (optional)
    • tetex (optional, not necessary if you have MiKTeX)
  • Editors
    • emacs
    • emacs-X11
    • nano
  • Games
    • (None)
  • Graphics
    • ghostscript (optional)
    • ghostscript-base (optional)
    • ghostscript-x11 (optional)
  • Interpreters
    • expat
    • gawk
    • perl (optional)
    • perl-libwin32 (optional)
    • python (optional)
  • Libs
    • expat
    • fontconfig
    • freetype2
    • gettext
    • libXft
    • libXft-1
    • libXft-2
    • libz2_1
    • libcharset1
    • libfontconfig1
    • libfreetype26
    • libgettextpo0
    • libiconv
    • libiconv2
    • libintl
    • libintl1
    • libintl2
    • libintl3
    • libjpeg62
    • libncurses5
    • libncurses6
    • libncurses7
    • libpcre
    • libpcre0
    • libpng12
    • libtiff4
    • libungif
    • ncurses
    • termcap
    • zlib
  • Mail
    • (None)
  • Math
    • (None)
  • Mingw
    • (None)
  • Net
    • openssh
    • openssl
    • rsync
    • whois
  • Publishing
    • psutil (optional)
    • all tetex (optional)
  • Shells
    • ash
    • bash
    • sh-utils
  • System
    • man
  • Text
    • expat
    • groff
    • less
  • Utils
    • bzip2
    • pcre
  • Web
    • (None)
  • X11
    • X-startup-scripts
    • Xaw3d
    • xorg-x11-base
    • xorg-x11-bin
    • xorg-x11-bin-dlls
    • xorg-x11-bin-lndir
    • xorg-x11-etc
    • xorg-x11-fenc
    • xorg-x11-fnts
    • xorg-x11-libs-data
    • xorg-x11-xwin
    • xterm
    • xwinclip (make sure this is what I use in startxwin.bat)
  • ZZZRemovedPackages
    • (None)
  • _PostInstallLast
    • (None)

Let cygwin install all of the packages, then choose to install desktop shortcut and start menu icon.

Initial Cygwin Configuration

Now go to the desktop, and click on desktop shortcut. When the window opens type:

cp /usr/X11R6/bin/startxwin.bat /usr/X11R6/bin/startxwin.bat.old

(to backup original startxwin.bat) and right click this link startxwin.bat, and make sure to save it as C:\\cygwin\usr\X11R6\bin\startxwin.bat in windows. Note that this file has a .txt appended to its name due to potential download issues on Windows. Make sure to remove the ".txt" when saving the file locally.

In Explorer go to C:\\cygwin\usr\X11R6\bin right click "Send To > Desktop (create shortcut)"

Go back to the desktop, and right click the shortcut to Startxwin.bat. Select Properties, and click on the "Change Icon" button, it may say there aren't options, select to browse: and go to C:\\cygwin\usr\X11R6\bin click on the startx.exe icon, that should have a nice X symbol. Apply these changes, and make sure that you put "C:\\cygwin\home\<username>" under the Start-In option under the Shortcut tab of properties as well, where username should be substituted with your username in windows.

Now click on startxwin.bat, and you will come to a bash prompt, type: pwd if you get something other than

/home/<username>>

type

mkdir -p /home/<username>

cp /etc/passwd /etc/passwd.old

nano /etc/passwd

and delete the line that assigns your home directory to whatever you ended up getting. Use Ctrl+x to exit the nano session, and folow the prompts to save the file with the same name as what it was. Now exit the xterm by typing exit. Also, right-click the little X in your system tray (all those little icons next to the clock) and select Exit. Now restart startxwin.bat and make sure when you type pwd you get /home/<username>

Adding Functionality to DOS

Now let's setup your machine so that you can use these wonderful *NIX utilities from the DOS prompt as well. Keep in mind that you will only be able to run the command-line programgs from the DOS prompt, if you want to use anything that requires an X windows, you need to start the X server using the startxwin.bat shortcut we just setup. In order to do this we will add the cygwin utilities to our Windows path. Be careful, because some of the programs are redundant, and you need to make sure that all the Windows commands have precendence over the cygwin utilties. Go to the Control Panel in Windows, and double-click the "System" Icon. Select the advanced tab, and click on the "Environment Variables" button. Look at the System variables section, and select "Path" and click the "Edit" button. BE CAREFUL YOU DO NOT DELETE WHAT IS ALREADY HERE, OR YOU WILL HAVE SOME SERIOUS PROBLEMS RUNNING WINDOWS. Now go to the end of the line, and add the following to the end of the line. Again, do not delete anything that is already there!!!

;C:\cygwin\bin

It should look like the image below:

Path

Now you can run those awesome utilities such as grep, rsync, sftp and ssh from the DOS prompt as well! Good luck with your cygwin installation, and have fun!!!

Bottom Left Image Created by BJL, Ltd. Bottom Right Image