Hints for Setting up Cygwin

Note: You may also want to refer to this page for notes on using Cygwin at Fermilab. As of March 23, 2012, kerberos is now available as one of the standard Cygwin packages.

Welcome. This page has instructions for setting up Cygwin, a Linux-like environment for Windows, including such tools as gcc, (X)Emacs, latex. It is free and open source (supported by RedHat at some level). Using cygwin, its X server, and a virtual desktop called JS Pager can make using Windows an enjoyable experience (or at least pretty close).

Note: Cygwin comes with an X server (what you need to display X windows on your computer). This package used to have issues (there was no maintainer for a long time but now there are two and the package is in much better shape). I have personally installed XMing, an open source X server that shares the same code base as the Cygwin X server. I would recommend downloading and installing XMing and the XMing-fonts packages from the downloads page, in addition to the Cygwin X server. If you are having problems with OpenGL, you may want to got back to the standard Cygwin X server or try XMing-Mesa instead of XMing. In one such instance (i.e., CMS Fireworks), the Cygwin X server and XMing-Mesa worked fine but the standard XMing did not.

In this web page, I've listed a lot of different options. All you need to do is follow the How to Start directions. You can then come back in install any other options as you want them.

How To Start

Here is how I setup Cygwin on computers with at least 2 Gb free of disk space: To start XWindows, you want to double click on: c:\cygwin\bin\startxwin.bat ( or C:\cygwin\usr\X11R6\bin\startxwin.bat on older installs). You probably want to put a link to some version of it in your Startup folder so it starts automatically every time you log in.

Note: The cygwin.bat icon starts up a bash session in the cmd.exe program. Personally, I think this is a lousy window to work in. On my computer, I use a shortcut to start an mrxvt window using a bash script that I've included in my useful files. Note: I have been having problems getting this shortcut to work on other people's computer. mrxvt.bat (assuming you put mrxvt.exe in c:\cygwin\bin) works.

Useful Tidbits

  1. You may want to disable your virus checker when running the Cygwin installer. Don't forget to re-enable it when you're finished installing.
  2. If you are planning on installing CERN's Root, I recommend going to the 3.4.4.3 version. Root 5.14 (or later?) should be immediately compatible with this release. You may have to build the earlier versions from sources.
  3. Cygwin doesn't like it if there is a space in your Windows username. If you have a space, do the following after installing Cygwin:
  4. Cygwin doesn't like spaces in directories. To have access to my program files, I created a 'mount point':
    cygwin> mount -f -s -b "c:/Program Files" "/mount/programfiles"
    You only need to run this command once.
  5. To make access easier to my documents and the decktop, I made the following soft links in my home directory
    cygwin> ln -s 'C:/Documents and Settings/cplager/Desktop' Desktop
    cygwin> ln -s 'C:/Documents and Settings/cplager/My Documents' Documents

Useful Files

Backup Your Cygwin installation

After you are happy with your Cygwin installation, it is a good idea to back it up so that if you anything happens, or if you want to move it to another computer as is, you can.

Available Software

Here is a very small list of software that is available for Cygwin:

Kerberos

If you want to use kerberos with cygwin, please visit my Windows Kerberos at FNAL page. You want to read the cygwin section. Alternatively, you can visit Axel Naumann's download directory which has a lot of good HEP software, including kerberos.

Note: If you have set up Kerberos previously on your computer without a Cygwin install, you will need to follow the directions in the cygwin section.

Emacs and Tramp

If you followed the instructions above, you already have emacs installed. Tramp is a package for emacs that lets you run a local copy of emacs and edit remote files (using ssh/scp). If you have already kerberized your ssh/scp, then tramp uses these versions automatically without any problems.

Tramp comes installed with emacs version 22 and greater. If the version of emacs you have is not 22, re-run the cygwin installer and get version 22.

You will want to add the following lines to your .emacs file:

;;; Tramp stuff

(add-to-list 'load-path "~/emacs/tramp/lisp/")
(setq tramp-default-method "scpx")
(require 'tramp)

To use tramp, you open a file much like normal (i.e. <ctrl>-x <ctrl>-f), but you need to specify the file name slightly differently:

<ctrl>-x <ctrl>-f /[cplager@fcdflnx2.fnal.gov]localpath
<ctrl>-x <ctrl>-f /[cplager@fcdflnx2.fnal.gov]/absolute/path

Do not forget the / at the beginning of the filename.

Visit my Emacs page to see more useful tips about Tramp in particular and emacs in general.

Mrxvt

rxvt is an xterm-like terminal program. mrxvt is built from the same code base, but adds tabs (similar to konsole terminals in KDE). It turns out building these for Cygwin (assuming you have the X11 libraries installed) is very easy. You need to be running an X server to use it (either XMing or the cygwin X server will do).

  1. Visit the mrxvt home page
  2. Read the README file.
  3. Download the source.
  4. Untar the source file
    cygwin> tar xzf mrxvt_0.40.tar.gz
  5. Configure as shown in the readme file
    cygwin> ./configure --enable-everything --disable-debug
  6. Make and install
    cygwin> make && make install
Note: I recommend building mrxvt from source, but for those who want to try a built version, you can grab mine (built from version 0.4 sources). I also have a perl script, mrxvt_options.pl, that lets you change the names of tabs, etc. mrxvt.bat (assuming you put mrxvt.exe in c:\cygwin\bin) will start it up for you.

You should be good to go. Here are the entries I have in my ~/.Xdefaults file:

!##############
!#  mrxvt
!##############
mrxvt*font:                  6x13
mrxvt*foreground:            white
mrxvt*background:            black
mrxvt*scrollbarStyle:        rxvt
! These keys are used by emacs, disable them
mrxvt*hotkey*Dummy:          Ctrl+Shift+underscore
mrxvt*hotkey*Dummy:          Ctrl+Shift+plus

Installing Perl Tk

Note: As of December 2005, you can download Tk from any Cygwin mirror using the cygwin installer. I recommend trying this first before building your own.

Perl Tk is a useful GUI addition to the Perl language. In my Useful files tar ball, you will find a few scripts that take advantage of this package. It is, however, by no means necessary, so feel free not to install it (or install it later). Note: I have always installed Perl Tk 8.00.024. There are newer versions; I just haven't tried them. If you're curious, please try and let me know how it goes. If you want to be lazy and play it safe, follow the directions below. I'm assuming that you have a full cygwin installation as shown above.

You should now be good to go.

Console GUI

The console GUI is a Perl Tk script that I wrote that makes it easy to log into many different machines. You can find it in the tgz above.



Last modified: Fri Mar 23 12:24:06 CDT 2012 by Charles Plager