Installing and Uninstalling the Cygwin Unix Emulator

This document shows you how to install and uninstall the Cygwin Unix Emulator DLL version 1.5.18-1 for Microsoft Windows using Cygwin Release Setup Program version 2.510.2.2. It is essential to install this environment if you want to run the GNU Tools under Windows instead of under Linux (their native environment).

If you encounter any problems with these instructions, you should at least read through the [PDF] Cygwin User’s Guide on this CD-ROM before consulting your lecturer or other competent help.

Please note that the Cygwin Unix Emulator does not provide all of the applications that are available in a typical Linux installation: only the most essential programs are included. In particular, your choice of a decent text editor is severely limited: either you need to use vi (shudder!) or you need to install a third-party text editor like TextPad. You cannot use the default Windows Notepad text editor.

In this document, something like “Start » Settings » Control Panel” means that you click on the Start button, select the Settings sub-menu and finally click on Control Panel. “$” will indicate the Cygwin shell prompt. Anything in a bold monospaced font is what you are expected to type in; an ordinary monospaced font is used for the computer’s response. Please note that this document doesn’t always show every response from the computer!

It is an unfortunate fact of life that every major version of Microsoft Windows behaves differently. This means that you may need to adjust these instructions to suit your version of Windows. These instructions have been verified for Windows 2000, Windows XP Professional, and Windows XP Home only.

Minimum System Requirements

In order to successfully install and run the Cygwin Unix environment, you will need to meet at least the following requirements:

1. Microsoft Windows Windows 2000, Windows XP Home or Windows XP Professional, as your operating system,
You almost certainly know the operating system that you are running… If not, select Start » Settings » Control Panel, then double-click on the System icon. (Of course, this is different under Windows XP: you need to select Start » Control Panel, then select Classic View from the View menu, before double-clicking on the System icon…)
As a rule, Linux is the recommended platform for the GNU Tools and for all serious programming in general. If you insist on using Microsoft Windows, then Windows 2000, Windows XP Home or Windows XP Professional are the better options.
2. At least 250 MB of free disk space for Cygwin (as well as an additional 125 MB for the GNU Tools — a total of at least 375 MB),
You can find out how much disk space you have free on your C: drive by opening the Windows Explorer (Start » Programs » Accessories » Windows Explorer, or Start » Programs » Windows Explorer, depending on your version of Windows), right-clicking on the C: drive under “My Computer”, then selecting Properties. Use the figure under “Free Space” only as a guide.
3. If you are running Microsoft Windows 2000 or Windows XP Professional, the password for the Administrator account on your system.

Installation Instructions

Installing the Cygwin Unix environment can be a little tricky, so take care to follow these instructions exactly. It might help you to print out and read through these instructions before proceeding… maybe it’s easier to run Linux!

1. If you are running Microsoft Windows 2000 or Windows XP Professional, log in as Administrator. If you are running Microsoft Windows XP Home simply log in.
2. Run the Cygwin setup.exe program in the [List] gnutools/cygwin/win32 directory on this CD-ROM. A window will appear with an introduction.
3. Click Next to skip the introduction, select “Install from Local Directory”, then click Next. The window will now show installation options.
4. Make sure that the Root Directory is “C:\cygwin”, that “All Users” is selected in the group “Install For”, and that “Unix” is selected in the group “Default Text File Type”. Click Next. The window will change to show the package installation directory.
5. Make sure the Local Package Directory is set to “D:\gnutools\cygwin\win32” (you may need to replace “D:” with the drive letter of your CD-ROM). Click Next. After a short delay, a listing of packages will appear in the installation window.
6. Click on the (rather small) View button in the top right-hand corner until the word “Category” appears next to it. This will display a full listing of all package categories. Click on circular arrows next to the “All” Category on the top left hand corner of the window with white background until “Install” appears. This selects all the packages in all the categories. It should change the status all categories underneath to “Install” as well.
7. Carefully work through the list of categories and packages in each, one by one, clicking on the circular arrows (in the New column) so that no package shows “Skip” (in other words, so that every package shows a version number next to it). For more information on choosing packages please refer to Section Setting Up Cygwin in [PDF] Cygwin User’s Guide on this CD-ROM.
8. Check this list of packages again very carefully, then click Next. Cygwin will now be installed.
9. Once the packages are installed, make sure that “Add Icon to Start Menu”, at least, is selected. Click Finish.
10. You now need to add C:\cygwin\bin to your path. This procedure is, unfortunately, different for every major version of Microsoft Windows…
For Windows 2000: Start the Control Panel (Start » Settings » Control Panel), then double-click on the System icon. Select the Advanced tab and click on Environment Variables. Select the PATH variable (in the System Variables section), then click Edit. Add C:\cygwin\bin; to the front of the variable definition — do not overwrite what is already there! Note the semicolon “;”: this separates path segments. Click OK, OK and OK until you are back at the Control Panel. You can now close the Control Panel window and proceed to step 11.
For Windows XP Home or Professional: Start the Control Panel (Start » Control Panel). From the vertical menu on the left select Switch to Classic View, then click on the System icon. Select the Advanced tab and click on Environment Variables. Select the PATH variable (in the System Variables section), then click Edit. Add C:\cygwin\bin; to the front of the variable definition — do not overwrite what is already there! Note the semicolon “;”: this separates path segments. Click OK, OK and OK until you are back at the Control Panel. You can now close the Control Panel window. If you are running Windows XP Home, proceed to step 13. If you are running Windows XP Professional, proceed to step 11 instead.
11. (For Windows 2000 and Windows XP Professional only). You need to create the directory C:\cygwin\home and give all users full control over it. The procedure to do so is different under every version of Windows. In addition, depending on precisely how your version of Windows is set up, your users may already have full control over this to-be-created directory.
For Windows 2000: Open a Windows Explorer window (Start » Programs » Accessories » Windows Explorer, or the WIN+E key-press). Create the directory C:\cygwin\home (File » New » Folder) and give all users full control over it. This is done by right-clicking the newly-created directory, selecting Properties, then the Security tab. Click Add, select the user “Everyone”, then click OK. Highlight that user (in the original dialog box) and make sure all checkboxes are selected. Click OK to close the dialog box.
For Windows XP Professional: Open a Windows Explorer window (Start » Programs » Accessories » Windows Explorer, or the WIN+E key-press). Create the directory C:\cygwin\home (File » New » Folder) and give all users full control over it. This is done by right-clicking the newly-created directory, selecting Properties, then the Sharing tab. On the lower box select the check boxes “Share this folder on the network” and “Allow other users to change my files”, then click OK.
If you are a security-conscious system administrator, you will rightly balk when reading the above instructions. In such a case, simply create C:\cygwin\home\username for every user on your system and give each user full control over his or her directory only.
12. If you are running Windows 2000 or Windows XP Professional, give Everyone full control over the C:\cygwin\tmp, C:\cygwin\var\tmp and C:\cygwin\usr\tmp directories. Step 11 has all the necessary instructions…
13. Open a Cygwin window for the first time (Start » Programs » Cygwin » Cygwin Bash Shell).
14. Enter the following two commands:
mkpasswd -l -g > /etc/passwd
mkgroup -l > /etc/group
(Please note that both command lines use a lower-case “L” for the option (“-l”), not the number “1“
15. View the generated file /etc/passwd:
more /etc/passwd
Under Windows 2000, Windows XP Home and Windows XP Professional, this file should look something similar to:
Everyone:*:0:0:,S-1-1-0::
SYSTEM:*:18:18:,S-1-5-18::
Administrators:*:544:544:,S-1-5-32-544::
Backup Operators:*:551:551:,S-1-5-32-551::
Guests:*:546:546:,S-1-5-32-546::
Power Users:*:547:547:,S-1-5-32-547::
Replicator:*:552:552:,S-1-5-32-552::
Users:*:545:545:,S-1-5-32-545::
Administrator:unused_by_nt/2000/xp:500:513:U-GRACE\Administrator,S-1-5-21-583907252-1993962763-1957994488-500:/home/Administrator:/bin/bash
ASPNET:unused_by_nt/2000/xp:1002:513:ASP.NET Machine Account,U-GRACE\ASPNET,S-1-5-21-583907252-1993962763-1957994488-1002:/home/ASPNET:/bin/bash
Guest:unused_by_nt/2000/xp:501:513:U-GRACE\Guest,S-1-5-21-583907252-1993962763-1957994488-501:/home/Guest:/bin/bash
Saeid:unused_by_nt/2000/xp:1000:513:Saeid,U-GRACE\Saeid,S-1-5-21-583907252-1993962763-1957994488-1000:/home/Saeid:/bin/bash
This document shows you how to set up your computer’s environment under Microsoft Windows to be as similar as possible as the one in the Digital Systems Laboratory. In fact, these instructions are the ones used to set up that Laboratory in the first place…
Observe, in particular, that this file is a sequence of lines (which might be “wrapped around” on the Cygwin shell command line if they are too long), where each line is separated into fields by “:”, colons. Now, check that the second-last field in each line (the home directory field) is /home/username for each real user on your system. If it is, simply jump ahead to step 17 — this is the default on most installations. However, if it is not, proceed to step 16.
16. You have an unusual installation of Microsoft Windows that requires you to have some Unix expertise… Use the VI editor vi to edit /etc/passwd, replacing the second-last field for each real user with /home/username as appropriate. The exact details of how to do this are beyond the scope of this document; you may need to consult expert help.
17. If you have already installed TextPad text editor or are planning to install and use it later, copy the textpad script from this CD-ROM. This enables you to use the TextPad text editor under Cygwin:
cd /cygdrive/d/unsw/common/labsetup-win32/other
cp textpad /usr/local/bin
chmod u+w /usr/local/bin/textpad
These commands assume that your CD-ROM appears as drive D: on your system. If it is not, replace the “d” in the first line with the drive letter of your CD-ROM. See the instructions for mounting the CD-ROM for more details.
18. Log out (or restart your computer), then log back in. If you are running Windows 2000 or Windows XP Professional, log in as an ordinary user.
19. Open a Cygwin window (Start » Programs » Cygwin » Cygwin Bash Shell).
20. Check that everything is working by typing pwd into this window. You should see something like /home/username, where username is the name you used to log in. Type exit to close the window.
If something other than /home/username appeared in the previous step, please review /etc/passwd by going back to step 15. If necessary, consult expert help!
21. If you prefer to set up your computer’s environment under Microsoft Windows to be as similar as possible as the one in the Digital Systems Laboratory follow the instructions in the document Setting Up Your Computer’s Environment under Microsoft Windows.
22. You have successfully, at long last, installed the Cygwin Unix Emulator! You may now install the TextPad editor, then install the GNU Tools for Microsoft Windows.

Uninstallation Instructions

You will be relieved to know that uninstalling the Cygwin Unix Emulator is much easier than installing it! Simply follow these steps:

1. If you are running Microsoft Windows 2000 or Windows XP Professional, log in as Administrator. If you are running Microsoft Windows XP Home or Windows 98SE, simply log in.
2. Open a Windows Explorer window (Start » Programs » Accessories » Windows Explorer, or Start » Programs » Windows Explorer, depending on your version of Windows).
3. Find the C:\cygwin directory and select it with the left mouse button.
4. Press Shift+Delete (ie, the Shift and Delete keys together) to delete the directory without sending it to the Recycle Bin. You will be asked to confirm this; do so by clicking Yes.
5. You can now delete the icons in the Start menu and on the desktop.
6. You have successfully uninstalled the Cygwin Unix Emulator.