Ubuntu 7.04 (Feisty Fawn) How-To Taken From The Webspace of David Martin (djm) at Cornell.

(I wanted to be sure this page is preserved and nothing happens to it...thanks David for all the work you put into this...)


This page documents the various things I need to do when I install Ubuntu. The information presented here is for you to use freely but at your own risk.

I am currently updating this page for Feisty Fawn. I'll leave the Edgy Eft page online for a while, but I won't be updating it.

Installing Ubuntu

  1. Download the Ubuntu 7.04 installation CD/DVD image, and then burn the image to CD/DVD.
  2. Boot off the CD/DVD. This usually involves simply rebooting the computer with the CD/DVD in the appropriate drive. For some computers you may need to hit F12 (or F2, or DEL, or something like that) at the appropriate time during boot and select from a menu to boot off the CD.
  3. Choose the "Start Ubuntu in safe graphics mode" option.
  4. After the computer boots into the Live CD version of Ubuntu, double-click the Install icon on the Desktop.
  5. At this point, your screen resolution might be too low to be able see or click the "Forward" button at the bottom of the Install window. If this is the case, you can fix the problem as follows:
    1. Close the over-sized Install window.
    2. Open a terminal by clicking on the Applications menu and then on the Accessories submenu and then on the Terminal menu item.
    3. In the terminal, type:
      sudo dpkg-reconfigure xserver-xorg
      and then press ENTER on your keyboard.
    4. You will be presented with a series of questions. Choose the default answers to all questions, except for the following:
      1. Choose "Medium" for the method for selecting monitor characteristics.
      2. Choose "1028x768 @ 60Hz" for the monitor's best video mode.
    5. After you answer all the questions and are back in the regular terminal, restart the Gnome Desktop Manager by pressing CTRL+ALT+BACKSPACE on your keyboard.
    6. Wait for a few seconds without pressing any keys until Ubuntu automatically logs back in and you can see the desktop again.
    7. You should now have a better resolution.
    8. Double-click the Install icon on the Desktop and you should be able to see the full install window.
  6. Select your language, location and time-zone, and keyboard layout.
  7. When you reach the "Prepare disk space" section, choose to "Manually edit partition table". Note that you can decide to keep any existing Windows partition(s) (in which case Ubuntu will install itself with dual boot options). However, if the Windows partitions take up the whole hard drive, then you must first shrink these partition(s) in order to free up space for your Ubuntu partitions. I recommend setting up three new partitions (in addition to the shrunk Windows partition) for Ubuntu as follows:
    Purpose Size Filesystem
    swap space 1 - 2GB linux-swap
    root directory (/) 6 - 10GB ReiserFS (or ext3)
    home directory (/home) remaining free space ReiserFS (or ext3)
    The /home directory will hold your documents, music, pictures, etc., so you should plan to invest adequate space for that. Putting /home on a separate partition allows you to upgrade/reinstall the OS without touching your documents.
  8. Migrate Documents and Settings if applicable and/or desired.
  9. Select your user name, password and computer name.
  10. Review your choices, and then click "Install".
  11. Browse the web or read a magazine while Ubuntu installs.
  12. Eventually, you will be informed that the installation is complete, at which point click the "Restart now" button.
  13. Just before Ubuntu finishes restarting, you will be prompted to remove the install CD/DVD. Make sure to do so in order to avoid booting back into the install CD.
  14. If Ubuntu detected Windows on another partition, it will present you with dual boot options using GRUB. The top option is Ubuntu. Choose it, or else just let the timer count down to zero.
  15. After the computer boots into the newly installed Ubuntu, log in using the user name and password that you selected earlier during installation.
  16. Congratulations! You are now running Ubuntu! Wasn't that easy? :)

Initial setup

  1. Update and upgrade package sources
  2. Install nVidia graphics driver
  3. Enable 5-button mouse
  4. Enable CD/DVD eject
  5. Add extra repositories

Useful packages




SSH/Remote access

Most of the information on this page comes from the following sources:

You can visit my home page to find out how to contact me with feedback and suggestions for this site.

Update and upgrade packages

  1. sudo apt-get update
    sudo apt-get upgrade

Install nVidia graphics driver

Note that installing the nVidia driver will automatically fix some screen resolution problems.

  1. First, reset the X server configuration to very basic settings:
    sudo dpkg-reconfigure xserver-xorg
    You will be presented with a series of questions. Choose the default answers for all the questions except for the following:
    1. Choose "vesa" for the X server driver.
    2. Choose "No" for monitor autodection.
    3. Choose "medium" for the method for selecting the monitor characteristics.
    4. Choose "1024x768 @ 60Hz" for the monitor's best video mode. (Don't worry, we'll get better screen resolutions once we install and enable the nVidia driver.)
    5. Choose "Yes" for writing the monitor sync ranges to the config file.
    You can now optionally restart the Gnome Desktop Manager (GDM) for these settings to take effect before continuing. Alternatively, you can just continue the driver installation without restarting the GDM.
  2. Install and enable the nVidia driver:
    sudo apt-get install nvidia-glx-new
    sudo nvidia-glx-config enable
    Note: If you have a GeForce4 video card, you may need to use nvidia-glx instead of nvidia-glx-new. And if you have a very old card, like a TNT, you may need to use nvidia-glx-legacy instead.
  3. Restart the Gnome Desktop Manager for these settings to take effect.
  4. Set up screen resolution, dual monitors, Xinerama, etc.:
    sudo nvidia-settings
    You can change the settings in the "X Server Display Configuration" section and then click the "Save to X Configuration" button and save the file as /etc/X11/xorg.conf.
    Note: If you decide to enable dual monitors with Xinerama, you will need to disable compositing due to this nVidia bug. You can do this by editing your /etc/X11/xorg.conf file:
    sudo gedit /etc/X11/xorg.conf
    and then appending the following lines to the file:
    Section "Extensions"
        Option "Composite" "false"
  5. (optional) Disable the nVidia splash screen:
    sudo gedit /etc/X11/xorg.conf
    Section "Device"
        Driver "nvidia"
    Section "Device"
        Driver "nvidia"
        Option "NoLogo" "true"
  6. (optional) Restart Gnome Desktop Manager for these settings to take effect.

Enable 5-button mouse

  1. If you have a 5-button mouse, you can enable the forward and back buttons as follows:
    sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup.mouse
    sudo gedit /etc/X11/xorg.conf
    Section "InputDevice"
        Driver "mouse"
        Option "Emulate3Buttons" ...
        Option "ZAxisMapping"    ...
    Section "InputDevice"
        Driver "mouse"
        Option "Emulate3Buttons" "false"
        Option "Buttons"         "7"
        Option "ButtonMapping"   "1 2 3 6 7"
        Option "ZAxisMapping"    "4 5"
  2. (optional) Restart Gnome Desktop Manager for these settings to take effect.

Enable CD/DVD eject

NOTE: CD/DVD eject seems to work fine for me in Feisty, so only follow these steps if you are having problems ejecting.

  1. Enable CD/DVD eject for the current session:
    sudo sysctl dev.cdrom.lock=0
  2. Enable CD/DVD eject on startup for future sessions:
    sudo cp /etc/sysctl.conf /etc/sysctl.conf.backup.eject
    sudo gedit /etc/sysctl.conf
    Add the following line to the file:

Add extra repositories

  1. sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
    sudo gedit /etc/apt/sources.list
    deb http://us.archive.ubuntu.com/ubuntu/ feisty main restricted universe multiverse
    deb-src http://us.archive.ubuntu.com/ubuntu/ feisty main restricted universe multiverse
    deb http://us.archive.ubuntu.com/ubuntu/ feisty-updates main restricted universe multiverse
    deb-src http://us.archive.ubuntu.com/ubuntu/ feisty-updates main restricted universe multiverse
    deb http://us.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse
    deb-src http://us.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse
    deb http://security.ubuntu.com/ubuntu feisty-security main restricted universe multiverse
    deb-src http://security.ubuntu.com/ubuntu feisty-security main restricted universe multiverse
  2. sudo apt-get update

Install Microsoft fonts

  1. sudo apt-get install msttcorefonts

Install multimedia codecs and players

  1. Add the extra repositories. (In particular, make sure that feisty/universe and feisty/multiverse are enabled.)
  2. (optional) Install DVD playback capability and Windows Media and RealPlayer codecs (see also the Restricted Formats page):
    wget -c -P /tmp/ http://www.debian-multimedia.org/pool/main/w/w32codecs/w32codecs_20061022-0.0_i386.deb
    wget -c -P /tmp/ http://www.debian-multimedia.org/pool/main/libd/libdvdcss/libdvdcss2_1.2.9-0.0_i386.deb
    sudo dpkg -i /tmp/w32codecs_20061022-0.0_i386.deb /tmp/libdvdcss2_1.2.9-0.0_i386.deb
  3. (recommended) Install totem-xine (this is my favorite media player - it plays most media files, and has a very clean interface):
    sudo apt-get install totem-xine libxine-extracodecs
  4. (optional) Add right-click options in Nautilus for enqueuing and replacing multiple files in Totem.
    1. Install Nautilus Actions.
    2. Run Nautilus Actions:
    3. Add an action (for enqueuing media files in Totem) with the following properties:
      • Under the Menu Item & Action tab:
        • Label: Enqueue in Totem
        • Icon: /usr/share/icons/hicolor/scalable/apps/totem.svg
        • Path: totem
        • Parameters: --enqueue %M
      • Under the Conditions tab:
        • Filenames: *
        • Match case: checked
        • Mimetypes:
          application/x-cd-image ; application/ogg ; application/vnd.rn-realmedia ; application/x-extension-m4a ; application/x-extension-mp4 ; application/x-flac ; application/x-matroska ; application/x-ogg ; application/x-shockwave-flash ; audio/mpeg ; audio/mpegurl ; audio/vnd.rn-realaudio ; audio/x-flac ; audio/x-m4a ; audio/x-mod ; audio/x-mp3 ; audio/x-mpeg ; audio/x-mpegurl ; audio/x-ms-asf ; audio/x-ms-asx ; audio/x-ms-wax ; audio/x-ms-wma ; audio/x-pn-aiff ; audio/x-pn-au ; audio/x-pn-realaudio-plugin ; audio/x-pn-realaudio ; audio/x-pn-wav ; audio/x-pn-windows-acm ; audio/x-real-audio ; audio/x-s3m ; audio/x-vorbis+ogg ; audio/x-wav ; audio/x-xm ; image/vnd.rn-realpix ; misc/ultravox ; video/dv ; video/mp4 ; video/mpeg ; video/msvideo ; video/quicktime ; video/vnd.rn-realvideo ; video/x-anim ; video/x-avi ; video/x-flc ; video/x-fli ; video/x-mpeg ; video/x-ms-asf ; video/x-msvideo ; video/x-ms-wmv ; video/x-nsv ; video/x-theora+ogg
        • Appears if selection contains: Only files
        • Appears if selection has multiples files or folders: checked
    4. Add an action (for replacing media files in Totem) with the same properties as in the previous step, except for the following:
      • Under the Menu Item & Action tab:
        • Label: Replace in Totem
        • Parameters: --replace %M
  5. (optional) Install MPlayer (a media player that plays pretty much everything but has a lousy interface; it's good to have it around for the rare cases when totem-xine can't play something):
    sudo apt-get install mplayer
    sudo sed -i.backup -e's@vo=x11,@vo=xv,@g' /etc/mplayer/mplayer.conf 
  6. (optional; I recommend sticking with the default Totem plugin which works now in Feisty) Install mplayer plugin for Firefox:
    sudo apt-get install mozilla-mplayer
  7. (recommended) Install some useful encoder/decoder/playback tools:
    sudo apt-get install lame sox ffmpeg mjpegtools mpg321 vorbis-tools
  8. (alternative to totem-xine; seems to have problems playing a lot of files) Install totem-gstreamer (this has the same user interface as totem-xine but uses different codecs; it cannot co-exist with totem-xine which will automatically be uninstalled when totem-gstreamer is installed):
    sudo apt-get install totem-gstreamer gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-gl gstreamer0.10-ffmpeg

Install TiMidity (MIDI player/software synthesizer)

See also the Midi Software Synthesis How-To.

  1. Install Timidity:
    sudo apt-get install timidity timidity-interfaces-extra
  2. (optional) Start software synthesis by loading the appropriate modules and starting Timidity as the MIDI server:
    sudo modprobe snd-seq-device
    sudo modprobe snd-seq-midi
    sudo modprobe snd-seq-oss
    sudo modprobe snd-seq-midi-event
    sudo modprobe snd-seq
    timidity -iA -B2,8 -Os1l -s 44100
    To make software synthesis start automatically in future, first make the appropriate modules load automatically:
    sudo gedit /etc/modules
    Append the following:
    Then inform Timidity to start automatically:
    sudo gedit /etc/default/timidity
    Uncomment the line to enable the sequencer. That is, change:
  3. Add a desktop entry for Timidity:
    sudo gedit /usr/share/applications/timidity.desktop
    [Desktop Entry]
    Name=Timidity MIDI Player
    Comment=Play MIDI audio files
    Exec=timidity -ig
  4. (optional) Make Timidity the default MIDI player (after first having added a desktop entry as in the previous step):
    sudo cp /usr/share/applications/defaults.list /usr/share/applications/defaults.list.backup.midi
    sudo gedit /usr/share/applications/defaults.list
    Insert/replace the audio/midi entry as follows:
  5. (optional) Install high quality sound fonts:
    wget -c -P /tmp/ http://www.fbriere.net/debian/dists/etch/misc/deb/timidity-patches-eaw_12-0fbriere.1_all.deb
    sudo dpkg -i /tmp/timidity-patches-eaw_12-0fbriere.1_all.deb
    sudo gedit /etc/timidity/timidity.cfg
    source /etc/timidity/freepats.cfg
    source /usr/share/doc/timidity-patches-eaw/examples/timidity.cfg
  6. (optional) Reduce Timidity's CPU usage:
    sudo gedit /etc/timidity/timidity.cfg
    opt EFresamp=d          #disable resampling (or "opt EFresamp=l" for linear resampling)
    opt EFvlpf=d            #disable VLPF
    opt EFreverb=d          #disable reverb
    opt EFchorus=d          #disable chorus
    opt EFdelay=d           #disable delay
    Save and close the file.

Install GParted (disk partition utility)

  1. sudo apt-get install gparted

Install Mozilla Thunderbird (email client)

  1. sudo apt-get install mozilla-thunderbird
  2. (optional) See how to restore Mozilla Firefox and Thunderbird icons.

Install GnomeBaker (CD burner)

  1. sudo apt-get install gnomebaker

Install Sound Juicer (audio CD ripper)

  1. sudo apt-get install sound-juicer

Install Acroread (PDF viewer)

I prefer the default Evince viewer to Acroread even though Evince can't do forms yet because it seems faster and more efficient.

  1. sudo apt-get install acroread
  2. (optional) Make Acroread the default pdf viewer by changing the application/pdf entry of /usr/share/applications/defaults.list:
    sudo sed -i.backup.acroread -e's@application/pdf=evince.desktop@application/pdf=AdobeReader.desktop@g' /usr/share/applications/defaults.list
  3. (optional) Install Acroread plugin for Firefox:
    sudo apt-get install mozilla-acroread

Install Adobe Flash Player 9 plugin for Firefox

  1. Add the extra repositories. (In particular, make sure that feisty/multiverse is enabled.)
  2. Install Flash Player:
    sudo apt-get install flashplugin-nonfree
  3. (alternative; use only if previous step did not work) Install Flash 9 manually for a single user:
    sudo apt-get --purge remove flashplugin-nonfree
    wget -c -P /tmp/ http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_9_linux.tar.gz
    pushd /tmp
    tar -vxzf /tmp/install_flash_player_9_linux.tar.gz
    mkdir ~/.mozilla/plugins
    cp /tmp/install_flash_player_9_linux/libflashplayer.so ~/.mozilla/plugins/
    cp /tmp/install_flash_player_9_linux/flashplayer.xpt ~/.mozilla/plugins/

Install Sun Java

See the Restricted Formats page.

  1. Add the extra repositories. (In particular, make sure that feisty/multiverse is enabled.)
  2. sudo apt-get install sun-java6-jre sun-java6-plugin
    sudo update-alternatives --config java
    Select the appropriate Sun Java option.

Install teTeX (LaTeX)

  1. sudo apt-get install tetex-base tetex-bin tetex-extra
  2. Here is a sample LaTeX file and the makefile to compile it with.

Install Octave (Matlab replacement)

  1. Add the extra repositories. (In particular, make sure that feisty/universe is enabled.)
  2. Install Octave:
    sudo apt-get install octave

Install Gnuplot (plotting/graphing utility)

  1. sudo apt-get install gnuplot

Install Development Tools

  1. Basic compilers and tools:
    sudo apt-get install build-essential autoconf manpages-dev
  2. (optional) GNU multi-precision arithmetic library:
    sudo apt-get install libgmp3-dev libgmp3-doc
  3. (optional) OpenGL and SDL development:
    sudo apt-get install libglew-dev libsdl1.2-dev libsdl-ttf2.0-dev libsdl-image1.2-dev libsdl-mixer1.2-dev
    sudo apt-get install ftgl-dev libsdl-net1.2-dev libsdl-sound1.2-dev 
    sudo apt-get install libxxf86vm-dev nvidia-glx-dev
    Note that in order to get compile with FTGL, you might need to do the following:
    sudo ln -s /usr/include/freetype2/freetype /usr/include/freetype

Install CVS (version control system)

  1. sudo apt-get install cvs
  2. (recommended) Install TkCVS, a GUI front-end for CVS:
    sudo apt-get install tkcvs

Install GVim (editor)

  1. sudo apt-get install vim-gnome
  2. (optional) Tinker with your ~/.vimrc file to your heart's content. (See my ~/.vimrc for an example.)
  3. (optional) Make gvim the default text editor:
    sudo sed -i.backup.gvim -e's@gedit.desktop@gvim.desktop@g' -e's@text/x-csrc=gvim.desktop@text/x-csrc=gvim.desktop\ntext/x-c++hdr=gvim.desktop\ntext/x-c++src=gvim.desktop\ntext/x-csharp=gvim.desktop\ntext/x-tex=gvim.desktop@g' /usr/share/applications/defaults.list
    sudo sed -i.backup -e's@MimeType=text/plain;@MimeType=text/plain;text/html;text/css;text/xml;text/x-dtd;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-csharp;text/x-tex;text/x-bibtex;text/x-readme;@g' -e's@NoDisplay=true@NoDisplay=false@g' /usr/share/applications/gvim.desktop 

Install jEdit (editor)

  1. Install Java.
  2. Add the jEdit repository to your etc/apt/sources.list file:
    sudo gedit /etc/apt/sources.list
    Add the following lines:
    deb http://switch.dl.sourceforge.net/sourceforge/jedit ./
    deb-src http://switch.dl.sourceforge.net/sourceforge/jedit ./
    Save and close the file.
  3. Install jEdit:
    sudo apt-get update
    sudo apt-get install jedit
  4. (optional) Make jEdit reuse windows when opening files to edit.
    sudo gedit /usr/bin/jedit
    ... ${JEDIT} -jar "/usr/share/jedit/jedit.jar" $@
    ... ${JEDIT} -jar "/usr/share/jedit/jedit.jar" -reuseview $@

Install Games (ScummVM)

  1. sudo apt-get install supertux scummvm
    sudo apt-get install beneath-a-steel-sky flight-of-the-amazon-queen

Install OpenSSH (SSH server)

  1. sudo apt-get install openssh-server
  2. You might also need to send your host-name to your DHCP server.

Install Nautilus context menu customizer

  1. Add the extra repositories. (In particular, make sure that feisty/universe is enabled.)
  2. Install Nautilus Actions:
    sudo apt-get install nautilus-actions
  3. To add customized entries to the Nautilus right-click context menu, run:
    and twiddle away.


  1. ReiserFS partition:
    sudo mount /dev/hdb1 mountPoint -t reiserfs -o notail
  2. EXT3 partition:
    sudo mount /dev/hdb1 mountPoint -t ext3 
  3. NTFS partition:
    sudo mount /dev/hda1 mountPoint -t ntfs -o nls=utf8,umask=0222
  4. FAT32 partition:
    sudo mount /dev/hda1 mountPoint -t vfat -o iocharset=utf8,umask=000
  5. CD/DVD:
    sudo mount /media/cdrom0/ -o unhide
  6. ISO:
    sudo modprobe loop
    sudo mount file.iso /media/iso/ -t iso9660 -o loop -r


  1. sudo umount mountPoint
  2. Force unmount (if previous step doesn't work):
    sudo umount -l mountPoint

Create ISO

  1. Create an ISO from CD/DVD (replace device with dvd, cdrom, or cdrom1):
    dd if=/dev/device  of=file.iso bs=1024
    If this step fails with an "input/output error", try various combinations of unmounting/remounting/ejecting the device:
    sudo umount -l /dev/device
    eject /dev/device
    sudo mount /dev/device
  2. Create an ISO from a directory:
    mkisofs -o file.iso dir

MD5 checksum

  1. Create:
    md5sum file.iso > file.iso.md5
  2. Verify:
    md5sum -c file.iso.md5

Fix sound

See the Unofficial Ubuntu Starter Guide for more information.

Fix screen resolution

See https://wiki.ubuntu.com/FixVideoResolutionHowto for more information. The following worked for me:

  1. Check that /etc/X11/xorg.conf contains the correct HorizSync and VertRefresh options in the "Monitor" section as follows.
    sudo ddcprobe | grep monitorrange
    The first two values returned are your HorizSync rates, the second pair is your VertRefresh values.
    sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup.sync_and_refresh
    sudo gedit /etc/X11/xorg.conf
    Find the following section and make sure the HorizSync and VertRefresh lines exist and have the appropriate values (e.g., 30-96 and 50-160):
    Section "Monitor"
                HorizSync          30-96
                VertRefresh        50-160

Fix Xine's WMV playback

  1. To fix Xine's WMV playback (only if it is broken):
    cp ~/.xine/catalog.cache ~/.xine/catalog.cache.backup
    gedit ~/.xine/catalog.cache
    Find the following section:
    supported_types=50593792 52428800 52822016 ... (long line truncated)
    Replace (in this section only):

Fix jumpy/skipping/choppy/stuttering CD/DVD playback

Only follow these steps if you experience choppy CD/DVD playback. See the Unofficial Ubuntu Starter Guide for more information.

  1. Check if DMA is enabled for the appropriate CD/DVD device:
    sudo hdparm -d /dev/device
    where device is cdrom, cdrom1, dvd, etc.
  2. If DMA was off for the device, enable it:
    sudo hdparm -d1 /dev/device
    sudo cp /etc/hdparm.conf /etc/hdparm.conf.backup.dma
    sudo gedit /etc/hdparm.conf
    Append the following to the /etc/hdparm.conf
    /dev/device {
           dma = on
    where device is cdrom, cdrom1, dvd, etc.

Fix "There are differences between boot sector and its backup" error

  1. This is not a fix, but a way to avoid the warning:
    sudo gedit /etc/fstab
    /dev/hda1 /media/hda1 vfat defaults,utf8,umask=007,gid=46 0 1
    /dev/hda1 /media/hda1 vfat iocharset=utf8,umask=000 0 0
    Note that occurences of hda1 could be different (e.g., hdb2) for you, depending on the disk and partition number of your FAT32 partition.

Set up SSH tunneling

See CFS's "Connecting to Herakles using SSH" page and this example ~/.ssh/config file for information specific to CUCS tunneling.

  1. Set up tunneling to targetHostName.targetDomain via bastionHostName.bastionDomain using port local forwarding on port 2001:
    nano ~/.ssh/config
    host bastionHostName
    user bastionUserName
    hostname bastionHostName.bastionDomain
    ForwardAgent yes
    LocalForward 2001 targetHostName.targetDomain:22
    host targetHostName
    user targetUserName
    hostname localhost
    port 2001
  2. Start tunneling:
    ssh -fN bastionHostName
  3. SSH to target:
    ssh targetHostName
  4. (optional) Set up public key authentication.

Set up SSH public key authentication

Quick explanation: Public key authentication works as follows. First you create a public key and a private key. Think of the public key as being a lock which only opens with the private key. The private key should reside only on your local machine and is stored in encrypted form using a passphrase that you choose when you first create the key. Never send your private key to anyone. The public key is copied to the various systems that you want to access. Once the public key is installed on another system, you can access that system using your private key as authentication. This authentication is done automatically and there is no need for a password entry. You do however need to enter your passphrase in order to decrypt the private key on your local machine in the first place, but you can do this just once per session on your local machine (e.g., when you first log in to your local machine). This will store the decrypted private key in memory until you log out or until you manually tell the local machine to forget the decrypted private key.

  1. Create a private/public key pair on your client:
    ssh-keygen -f ~/.ssh/keyFile -t dsa
    I highly recommend using a non-empty passphrase; you can later set up key management so that you only enter your passphrase once per session. You will now have two files in your ~/.ssh folder:
    1. keyFile which contains the private key. Never show or send this file to anyone. Think of this as your secret key.
    2. keyFile.pub which contains the public key. Think of this as a lock that only opens with your secret key. You can send this lock to others so that they can install it in their systems so that you can enter their system with your secret key.
  2. Append the contents of your keyFile.pub to the server's ~/.ssh/authorized_keys2 file. If you don't have access, email the server's admin.
  3. SSH to server:
    ssh -i keyFile serverHostName.serverDomain
    Alternatively, you can add the following line to the appropriate host entry in your ~/.ssh/config file:
    IdentityFile ~/.ssh/keyFile
    and then ssh to that host as usual without having to use the -i keyFile command line option.
  4. (optional) If you use SSH tunneling and public key authentication with multiple SSH servers, then you will probably run into a "HOST IDENTIFICATION HAS CHANGED" warning. This is because multiple servers are associated with a single hostname (namely, localhost) through the use of port forwarding. You can resolve this issue as follows (assuming port forwarding for the different target servers are on ports 2001, 2002, ...):
    cp ~/.ssh/known_hosts ~/.ssh/known_hosts.backup
    ssh -fN bastionHostName
    ssh-keyscan -H -t rsa,dsa -p 2001 localhost >> ~/.ssh/known_hosts
    ssh-keyscan -H -t rsa,dsa -p 2002 localhost >> ~/.ssh/known_hosts
    ssh-keyscan -H -t rsa,dsa -p ...  localhost >> ~/.ssh/known_hosts
  5. (optional) Set up SSH key management so that you only have to enter your passphrase once per session.

SSH key management

The following allows you to set things up so that you only have to enter your SSH key passphrase once per login session.

  1. sudo apt-get install gnome-keyring-manager
  2. Activate your keys for the remainder of the session (you'll be prompted for your passphrase):
  3. Deactivate your keys:
    ssh-add -D

Reboot (remotely) from Ubuntu into Windows

NOTE: This assumes that you use GRUB to dual boot and that you do NOT use dmraid.

WARNING: In Edgy, after performing the steps below, I ran into GRUB "Error 18: Selected cylinder exceeds maximum supported by BIOS" and could not boot into Ubuntu. To solve this, I had to boot into Ubuntu recovery mode, and then edit /boot/grub/menu.lst and comment out the savedefault line in the Ubuntu stanza. You probably can't do this remotely once you run into this error (since the computer requires a physical CTRL+ALT+DEL to reboot after encountering the error), so make sure to comment out the savedefault before you perform a remote grub-reboot.

  1. If you are rebooting a remote computer, first SSH into the remote computer, and then follow the next steps in the remote terminal.
  2. This step needs to be done only once (and apparently you should NOT do it if you are using dmraid) - you don't have to do this step for subsequent reboots.
    sudo nano /boot/grub/menu.lst
    default		0
    default		saved
    Save and close the file by hitting CTRL+O and then CTRL+X.
  3. Reboot the machine using the appropriate GRUB entry:
    sudo grub-reboot number
    where number is the number of lines that show up in your GRUB menu before the "Windows" line (typically 4, 6, or 8). (Don't include the "Windows" line into your count, but do include the "Other operating systems:" line.) For example, number is 4 in this screenshot because there are four lines above the "Windows" option.

Reboot (remotely) from Windows into Ubuntu

NOTE: this assumes that you use GRUB to dual boot, and that Ubuntu is the first boot option in /root/grub/menu.lst.

  1. If you are rebooting a remote computer, first Remote-desktop into the remote computer, and then follow the next step in the remote desktop.
  2. Click "Start / Run..." and enter:
    shutdown /r /t 00

Remote desktop to your CUCS computer that is currently running Windows

NOTE: The remote computer must be currently booted in WinXP, so you might have to reboot remotely from Ubuntu to Windows first.

  1. Configure SSH tunneling for CUCS using the example ~/.ssh/config file. The following assumes that in SSH forwards localhost:2011 to CUCS_hostname.u.cs.cornell.edu:3389 on lion (as per your ~/.ssh/config file).
  2. ssh -N -f herakles
    ssh -N -f lion
  3. rdesktop -r disk:sync=/home/localDirectory localhost:2011
    Note that disk:sync should be set to an absolute (as opposed to relative) path.

Access your CUCS home directories via Samba

NOTE: I find that using SFTP is faster and more reliable.

See CFS's "Samba mounting" page for additional info.

  1. Configure SSH tunneling for CUCS using the example ~/.ssh/config file. The following assumes that in SSH forwards localhost:2017 to smb.cs.cornell.edu:139 on lion (as per your ~/.ssh/config file).
  2. ssh -fN herakles
    ssh -fN lion
  3. You can now use either smbclient, which provides an ftp like console:
    smbclient //smb.cs.cornell.edu/win -U userName -W CUCS -I localhost -p 2017
    Or smbmount to mount the share:
    smbmount //smb.cs.cornell.edu/win localDir -o ip=localhost,port=2017,username=userName,workgroup=CUCS
    And smbumount to unmount it:
    smbumount localDirectory

Access your CUCS home directories via SFTP

I find this method faster and more reliable than using Samba.

  1. Configure SSH tunneling for CUCS using the example ~/.ssh/config file.
  2. ssh -fN herakles
    sftp lion
  3. For SFTP access via Nautilus, open Nautilus and press CTRL+L and enter one of the following addresses:

    Linux home directory:
    Windows home directory:
    Linux Bigbox directory:
    Windows Bigbox directory:
  4. For the sake of completeness, the locations of these directories under Windows are:

    Linux home directory:
    Windows home directory:
    Windows Bigbox directory:

Rename your computer

  1. Run the following, and then choose the "General" tab, and change the hostname as desired:
    gksudo network-admin
  2. (optional) If you access your computer remotely, you might need to tell your DHCP server your host-name.

Customize theme and fonts

  1. gnome-theme-manager
    Click "Theme Details", and fiddle away. My preferred settings are: Controls="Clearlooks", Window Border="IndustrialTango", Icons="Tango".
  2. gnome-font-properties
    My preferences are "App=Sans 10, Desktop=Sans 10, Window title=Sans 10, Terminal=FreeMono Medium 12".

Relocating the /home directory

IMPORTANT: This only applies if you want to move your home directory to another drive, or if you want to activate an existing home directory on another drive.

  1. (NOTE: Skip this first step if you already have your home directory on the partition you want, e.g., if you've already done this step during a previous installation.) This step copies your current home directory onto the new partition. Let's start by making a new directory to mount the new partition:
    sudo mkdir /mnt/new
    Now mount the new partition (e.g., /dev/hdb2) to /mnt/new. If it is an Ext3 partition, use the following:
    sudo mount -t ext3 /dev/hdb1 /mnt/new/
    If it is a ReiserFS partition, use the following:
    sudo mount -t reiserfs -o notail /dev/hdb1 /mnt/new/
    Now copy your existing home directory to the new partition.
    sudo cp -R -p /home/user /mnt/new/
    sudo chown user:user /mnt/new/user
    sudo umount /mnt/new/
  2. Mount the new drive as /home:
    sudo nano /etc/fstab
    Assuming your intended home partition is /dev/hdb1, add a line to your /etc/fstab file to automount the partition onto the /home directory. If your intended home partition is Ext3, add the following line just after the main and swap partitions:
    /dev/hdb1 /home ext3 defaults,errors=remount-ro 0 2
    If the intended home partition is ReiserFS, use the following:
    /dev/hdb1 /home reiserfs defaults,notail 0 2
    Save the file (i.e., press CTRL+O) and exit Nano (i.e., press CTRL+X).
  3. Restart Gnome Desktop Manager.

Disable USplash

  1. (optional) To disable USplash, if, like me, you find it ugly:
    sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.backup
    sudo gedit /boot/grub/menu.lst
    Remove the splash option from the appropriate lines. I.e., Change:
    kernel          /boot/... root=... ro quiet splash
    kernel          /boot/... root=... ro quiet

Restore Mozilla Firefox and Thunderbird icons

  1. Firefox:
    wget -c -O /tmp/mozilla-firefox.png http://www.cs.cornell.edu/~djm/ubuntu/mozilla-icons/mozilla-firefox.png
    wget -c -O /tmp/document.png http://www.cs.cornell.edu/~djm/ubuntu/mozilla-icons/document.png
    chmod 644 /tmp/mozilla-firefox.png /tmp/document.png
    sudo dpkg-divert --rename /usr/share/pixmaps/mozilla-firefox.png
    sudo dpkg-divert --rename /usr/share/pixmaps/mozilla-firefox.xpm
    sudo dpkg-divert --rename /usr/lib/mozilla-firefox/icons/default.xpm
    sudo dpkg-divert --rename /usr/lib/mozilla-firefox/icons/document.png
    sudo dpkg-divert --rename /usr/lib/mozilla-firefox/chrome/icons/default/default.xpm
    sudo cp /tmp/mozilla-firefox.png /usr/share/pixmaps/mozilla-firefox.png
    sudo cp /tmp/mozilla-firefox.png /usr/share/pixmaps/mozilla-firefox.xpm
    sudo cp /tmp/mozilla-firefox.png /usr/lib/mozilla-firefox/icons/default.xpm
    sudo cp /tmp/document.png /usr/lib/mozilla-firefox/icons/document.png
    sudo cp /tmp/mozilla-firefox.png /usr/lib/mozilla-firefox/chrome/icons/default/default.xpm
  2. Thunderbird:
    wget -c -O /tmp/mozilla-thunderbird.xpm http://www.cs.cornell.edu/~djm/ubuntu/mozilla-icons/mozilla-thunderbird.xpm
    chmod 644 /tmp/mozilla-thunderbird.xpm
    sudo dpkg-divert --rename /usr/share/pixmaps/mozilla-thunderbird.xpm
    sudo dpkg-divert --rename /usr/share/pixmaps/mozilla-thunderbird-menu.xpm
    sudo dpkg-divert --rename /usr/share/pixmaps/mozilla-thunderbird-pm-menu.xpm
    sudo dpkg-divert --rename /usr/lib/mozilla-thunderbird/chrome/icons/default/mozilla-thunderbird.xpm
    sudo dpkg-divert --rename /usr/lib/mozilla-thunderbird/chrome/icons/default/messengerWindow16.xpm
    sudo dpkg-divert --rename /usr/lib/mozilla-thunderbird/chrome/icons/default/messengerWindow.xpm
    sudo dpkg-divert --rename /usr/lib/mozilla-thunderbird/chrome/icons/default/default.xpm
    sudo cp /tmp/mozilla-thunderbird.xpm /usr/share/pixmaps/mozilla-thunderbird.xpm
    sudo cp /tmp/mozilla-thunderbird.xpm /usr/share/pixmaps/mozilla-thunderbird-menu.xpm
    sudo cp /tmp/mozilla-thunderbird.xpm /usr/share/pixmaps/mozilla-thunderbird-pm-menu.xpm
    sudo cp /tmp/mozilla-thunderbird.xpm /usr/lib/mozilla-thunderbird/chrome/icons/default/mozilla-thunderbird.xpm
    sudo cp /tmp/mozilla-thunderbird.xpm /usr/lib/mozilla-thunderbird/chrome/icons/default/messengerWindow16.xpm
    sudo cp /tmp/mozilla-thunderbird.xpm /usr/lib/mozilla-thunderbird/chrome/icons/default/messengerWindow.xpm
    sudo cp /tmp/mozilla-thunderbird.xpm /usr/lib/mozilla-thunderbird/chrome/icons/default/default.xpm

Send host-name to DHCP server

If you have trouble accessing your Ubuntu machine remotely, it might be because the DHCP server needs to be informed of the machine's name.

  1. sudo cp /etc/dhcp3/dhclient.conf /etc/dhcp3/dhclient.conf.backup
    sudo gedit /etc/dhcp3/dhclient.conf
    Add the following line to the file:
    send "hostname.domain";
    where hostname is your computer name and domain is the your computer's network domain (e.g., u.cs.cornell.edu).
  2. Reboot the computer.

Restart the Gnome Desktop Manager (GDM)

  1. Close all open programs.
  2. Either press CTRL+ALT+BACKSPACE or run:
    sudo /etc/init.d/gdm restart

Recursively remove files by name

  1. To remove files with names matching regular expression regexp from directory dir recursively:
    find dir -name "regexp" -ok rm '{}' \;

Rename multiple files

  1. The following script will change all occurences of regexp1 in file names to regexp2 (see Wikipedia's regular expression syntax guide):
    find directory -mindepth 1 -maxdepth 1 -name "*regexp1*" | while read file
        target=$(echo $file | sed -e "s@regexp1@regexp2@g")
        mv "$file" "$target"
  2. The following script will change all upper-case letters in file names to lower-case:
    find directory -mindepth 1 -maxdepth 1 -name "*[A-Z]*" | while read file
        target=$(echo $file | tr '[A-Z]' '[a-z]')
        mv "$file" "$target"
  3. Remember to make your script file executable:
    chmod +x script_file

Add or change a default application

Quick explanation: In order to associate an application (e.g., gThumb Image Viewer) with a file-type (e.g., PNG image files), the application needs to have a "desktop entry" (e.g., gthumb.desktop) located in the /usr/share/applications/ directory. Furthermore, the file-type needs to have a mime-type located in the /usr/share/mime/ directory (e.g., /usr/share/mime/images/png.xml). Finally, there should be a line in the /usr/share/applications/defaults.list file that associates the desktop entry with the mime-type (e.g., images/png=gthumb.desktop).

  1. sudo cp /usr/share/applications/defaults.list /usr/share/applications/defaults.list.backup
  2. sudo gedit /usr/share/applications/defaults.list
    Add/change appropriate line to:
    To figure out what newApp should be (if necessary):
    ls /usr/share/applications/*.desktop | sed -e "s@/usr/share/applications/@@g" | less
    To figure out what mimeType should be (if necessary):
    find /usr/share/mime/ -mindepth 2 -maxdepth 2 -name "*" | sed -e "s@/usr/share/mime/@@g" -e "s@[.]xml@@g" | less
  3. Restart Nautilus and the Gnome Panel:
    killall gnome-panel
    killall nautilus

Reinstall GRUB

  1. Boot from the Live CD if you can't boot from the hard disk into Ubuntu.
  2. In the terminal, run:
    sudo grub
    At the grub command prompt, run the following commands:
    1. find /boot/grub/stage1
      You should see something like (hdX,Y) where X and Y will be numbers, e.g., (hd0, 1).
    2. root (hdX,Y)
      where X and Y above should be replaced by the appropriate numbers returned in step 1.
    3. setup (hdX)
      where X above should be replaced by the appropriate number returned in step 1.
    4. quit
  3. GRUB should now be installed on the Master Boot Record (MBR). Reboot.

Customize Firefox

  1. Extensions: Google Browser Sync, Adblock Plus, NoScript, Forecastfox l10n, SearchWP, SearchBox Sync, Searchbar Autosizer, Context Search, DownloadThemAll!, VideoDownloader, lget, Linkification, CustomizeGoogle, Image Zoom, Web Developer.
  2. (optional) Enter about:config in the URL bar and then make the following changes:
    browser.link.open_newwindow=3 (3: new tab; 2: new indow; 1: current tab)
    browser.link.open_newwindow.restriction=2 (0: use open_newwindow setting; 1: new window; 2: use open_newwindow setting unless javascript specifies window size)
    font.name.monospace.x-western=DejaVu Sans Mono
    font.name.sans-serif.x-western=DejaVu Sans
    font.name.serif.x-western=Nimbus Roman No9 L

Customize Thunderbird

  1. Extensions: Addressbooks Synchronizer, New Mail Icon.
  2. Fonts: Variable=Sans Serif 18px, Serif=Nimbus Roman No9 L, Sans-serif=DejaVu Sans, Monospace=DejaVu Sans Mono 16px.

Dual Monitors

I'm feeling too lazy to write a step-by-step guide for this one. Instead, I'll post my /etc/X11/xorg.conf file which contains the settings for my dual monitor setup (using a dual head GeForce 7300GS card with a Hanns-G flat panel and a Micron CRT monitor). The "Device", "Monitor", "Screen", "ServerFlags", "ServerLayout", and "Extensions" sections are all relevant.

With my /etc/X11/xorg.conf in mind, here's the short explanation. Basically there must be two "Device" sections, two "Monitor" sections, and two "Screen" sections (linking the appropriate Devices to the appropriate Monitors). The "ServerLayout" section specifies how the Screens are positioned relative to each other. The "ServerFlags" section turns Xinerama on or off. Xinerama allows the two monitors to share one big virtual screen (which I prefer). Turning Xinerama off makes the two monitors have separate and independent screens and so, for example, you can't drag windows between the screens, which is a drag (sorry!). I recommend initially turning off Xinerama while you set things up. Turn Xinerama on only after you've got your screen resolution, etc. set up nicely. This is because you can't access or change the screen resolution with the current implementation of Xinerama. Finally, the "Extensions" section is necessary if you use Xinerama with nVidia drivers to work around this nVidia bug.

Remove occurences of ^M in Vim

  1. In vim, replace all extraneous ^M by:
    IMPORTANT: Make the ^M by typing CTRL+V CTRL+M, not ^ M! This expression will replace all the ^M's that have carriage returns after them with nothing. (The dollar ties the search to the end of a line.)
  2. In vim, replace all ^M's that need to have carriage returns:
    :%s/^M/ /g
    IMPORTANT: Make the ^M by typing CTRL+V CTRL+M, not ^ M! This expression will replace all the ^M's that didn't have carriage returns after them with a carriage return.

Compress and extract a file/directory

  1. Compress:
    tar -cvzf archiveName.tar.gz fileOrFolder
  2. Extract:
    tar -xvzf archiveName.tar.gz

Encrypt and decrypt a file

  1. Encrypt:
    gpg -c file
    You will be asked to enter (and re-enter) a password which will used to create the encrypted file called file.gpg
  2. Decrypt:
    gpg file.gpg