Ubuntu 8.04 (Hardy Heron) How-To

Ubuntu

I am currently maintaining this page for Ubuntu 8.04 (Hardy Heron). Older versions are online but are no longer maintained.

The information presented here is for you to use freely but at your own risk.

Initial setup

  1. Install Ubuntu
  2. Update and upgrade package sources
  3. Turn on the firewall
  4. Install nVidia graphics driver

Multimedia

Internet & Networking

Filesystem

Scientific & Programming

Misc

Much information on this page comes from the following sources:

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

Install Ubuntu

Installing Ubuntu is quicker and easier than ever before with Hardy Heron.

  1. Download the Ubuntu installation CD/DVD image, and then burn the image to CD/DVD.
  2. If you have multiple monitors, disconnect all but the main one.
  3. Boot from the CD/DVD. This usually involves simply rebooting the computer with the CD/DVD in the appropriate drive. For some computers, you will need to hit F12 (or F2, or DEL, or something like that) at the appropriate time during bootup to get to a boot menu where you can choose to to boot from CD.
  4. Select your language, and then select the Try Ubuntu without any change to your computer option to boot into the Live CD desktop.
  5. If your Windows partitions currently take up the whole hard drive, you should now shrink them in order to free up space for Ubuntu. To do this, go to the System > Administration menu and click on Partition Editor. Using the partition editor, you can shrink your Windows partition and create partitions for Ubuntu. I recommend setting up three new partitions for Ubuntu (in addition to the shrunken Windows partition) as follows:
    Purpose Size Filesystem
    swap space 1-2GB linux-swap
    root directory (/) 6-9GB 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.
  6. Once your partitions are set up, double-click on the Install icon on the desktop.
  7. Choose your language, location, and keyboard layout.
  8. When you reach the Prepare disk space section, choose the Manual option. If you have an existing Windows partition, don't worry: Ubuntu installs with dual boot capability using GRUB. In the Prepare partitions section:
    1. Select the partition you want to use for your root directory (where the operating system and program files will go) and click the Edit partition button. In the Edit partition window, select the desired file system (ReiserFS is an excellent choice), turn on the Format the partition checkbox, set the mount point to / (i.e., root), and click the Ok button.
    2. Similarly, if you want to use a separate partition for your /home, edit that partition and set the mount point to /home. Important: If you have a partition with a pre-existing /home directory that you would like to use (e.g., from a previous installation of Ubuntu), make sure that the Format the partition checkbox for that partition is unchecked, otherwise you will format that partition and lose the old data living there.
    3. Once you are done editing your partitions, click the Forward button in the Prepare partitions section.
  9. Migrate Documents and Settings if applicable and/or desired. (I usually don't.)
  10. Select your desired user name, password, and computer name.
  11. Review your choices, and then click the Install button.
  12. Browse the web or read a magazine while Ubuntu installs.
  13. In a few minutes, you will be informed that the installation is complete, at which point click the Restart now button.
  14. 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.
  15. 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 10-second timer count down to zero.
  16. After the computer boots into the newly installed Ubuntu, log in using the user name and password that you selected earlier during installation.
  17. Congratulations! You are now running Ubuntu! :)

Update and upgrade packages

  1. Go to the System > Administration menu and click on Software Sources. Select the Ubuntu Software tab and enable the main, universe, restricted, and multiverse repositories. To optionally find the most responsive server, choose Other... from the Download from drop-down menu, then click Select Best Server. Once the best server has been selected, click Choose Server.
  2. Update and upgrade packages from the server:
    sudo apt-get update
    sudo apt-get upgrade
    

Uncomplicated Firewall

Uncomplicated Firewall is a simple command-line front-end to Linux's powerful built-in firewall called iptables.

Explanation: Although the Linux kernel has a built-in firewall, it is turned off by default since Ubuntu installs in such a way that no ports are listened to by any program or process. Since nothing is listening to any of the ports, there is no need for a firewall. However, once you enable something like file or printer sharing, remote desktop, etc., processes will start to listen to some of the ports for external connections. You should therefore enable the firewall and create rules to restrict access of the appropriate ports to the IP addresses of the desired set of machines. Iptables is somewhat complicated to configure, so instead Ubuntu allows you to easily create and maintain firewall rules using a simple command-line tool called ufw.

  1. Enable the firewall and set the default rule to deny incoming connections to all ports:
    sudo ufw enable
    sudo ufw default deny
    
    Important: Remember that from this point on, if you want to do anything that requires other computers to connect to yours (e.g., share a file or printer, allow a remote desktop or SSH connection, etc.), you will have to explicitly add a rule to allow such a connection.
  2. (optional) You can now add custom firewall rules to open specific ports (or all ports) to specific hosts. For example, to allow connections on port $PORT from any IP on your private network (i.e., IP addresses of the form 192.168.xxx.xxx, such as the computers behind the same router as you):
    sudo ufw allow from 192.168.0.0/16 to any port $PORT
    
    To allow connections on any port from any IP on your private network:
    sudo ufw allow from 192.168.0.0/16 to any
    
    Here are some instructions for creating other rules.

nVidia graphics driver

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

  1. Go to the System > Administration menu, click on Hardware Drivers, and then enable the NVIDIA accelerated graphics driver checkbox in the Device Driver tree. If you need to set up multiple monitors, go to step 3. Otherwise, just restart the computer and you're done!
  2. (alternative) If the previous step didn't work, you can manually install and enable the nVidia driver:
    sudo apt-get install nvidia-glx-new
    sudo nvidia-xconfig
    
    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. Power off your computer, connect all monitors, and then turn the computer back on. When you get to the GRUB menu, select the option to boot into Ubuntu in recovery mode. You will eventually get to a menu where you can choose to drop into a root shell. Once you're at the root shell prompt, enable the nVidia driver:
    sudo nvidia-xconfig --twinview --enable-all-gpus
    
    Finally, exit the root shell by pressing CTRL+D, and choose the Resume normal boot option.
  4. You can now modify screen resolution, dual monitor setup, etc.:
    sudo apt-get install nvidia-settings
    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. The settings will take effect the next time you log in.

Switch to an existing /home on another partition

Important: This only applies if you had put the /home directory on another partition during a previous installation, and you now want to use that partition's /home directory.

What is /home? The /home directory contains a sub-directory for each desktop user (e.g., /home/john, /home/paul, etc.). Each desktop user's files (documents, music, pictures, desktop folder, user-specific desktop- and application-settings, etc.) all go into his or her sub-directory. Thus, if the /home directory resides on a partition different from the one that Ubuntu is installed in, you can re-install the operating system without worrying about blowing away your users' files so long as you don't touch the partition on which /home resides. This is why, if the /home directory currently resides on the sane partition as the operating system, it is wise to migrate it to another partition. In order to perform such a migration, you must first copy the /home directory to the new partition, and then you must switch to the /home on that partition.

  1. If your current username is different from the username you used in the other partition's /home directory, you might have to change the name and ownership of the user directory.
    su $CURRENT_USERNAME
    cd /media/$PARTITION/home
    sudo mv $OLD_USERNAME $USER
    sudo chown -r $USER:$USER $USER
    exit
    
    where
  2. If you are on a newer version of Ubuntu than you were when you were using /home directory on the other partition, you probably need to copy all configuration files and directories to the old /home directory for each user.
    su $CURRENT_USERNAME
    mkdir /media/$USER/old_config_files
    mv /media/$USER/.* /media/$USER/old_config_files/ 
    cp -pr ~/.* /media/$USER/
    exit
    
    where
  3. Set the desired partition's mount point to /home:
    sudo cp /etc/fstab /etc/fstab.backup
    sudo nano /etc/fstab
    
    Change
    # /dev/$PARTITION
    UUID=... /media/$PARTITION ...
    
    to
    # /dev/$PARTITION
    UUID=... /home ...
    
    where Save the file (i.e., press CTRL+O) and exit Nano (i.e., press CTRL+X).
  4. Reboot. After rebooting, your /home directory will be located in the new partition.

Copy /home to another partition

Important: These instructions describe only how to backup the /home directory to another drive/partition. If you want to then use that resulting /home directory, you will need to subsequently switch to that /home directory.

What is /home? The /home directory contains a sub-directory for each desktop user (e.g., /home/john, /home/paul, etc.). Each desktop user's files (documents, music, pictures, desktop folder, user-specific desktop- and application-settings, etc.) all go into his or her sub-directory. Thus, if the /home directory resides on a partition different from the one that Ubuntu is installed in, you can re-install the operating system without worrying about blowing away your users' files so long as you don't touch the partition on which /home resides. This is why, if the /home directory currently resides on the sane partition as the operating system, it is wise to migrate it to another partition. In order to perform such a migration, you must first copy the /home directory to the new partition, and then you must switch to the /home directory on that partition.

  1. Copy your /home directory to the desired partition.
    sudo cp -pr /home/* /media/$PARTITION/
    
    where

Appearance

  1. (recommended) Change font hinting from Medium to Slight:
    gconftool --type string --set /desktop/gnome/font_rendering/hinting "slight"
    
    This will fix many fonts, such as Nimbus Roman, Norasi, etc. Note that the DejaVu and Bitstream Vera fonts will look a little "heavier", but that's actually the way they're supposed to look. In Firefox, the settings will take effect the next time you restart it.
  2. (optional) Install and use the Tango icons:
    sudo apt-get install tango-icon-theme-common openoffice.org-style-tango 
    gconftool --type string --set /desktop/gnome/interface/icon_theme "Tango"
    
  3. (optional) Install the Liberation fonts (designed to replace Arial, Times New Roman, and Courier New):
    sudo apt-get install ttf-liberation
    
    If you can't do without Windows fonts, install the Microsoft core fonts.
    sudo apt-get install msttcorefonts
    

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 ~/.local/share/applications/mimeapps.list file that associates the desktop entry with the mime-type (e.g., images/png=gthumb.desktop).

  1. cp ~/.local/share/applications/mimeapps.list ~/.local/share/applications/mimeapps.list.backup
    gedit ~/.local/share/applications/mimeapps.list
    
    Add/change appropriate line to:
    [Added Associations]
    $MIME_TYPE=$NEW_APP.desktop;
    
    To figure out what $NEW_APP should be (if necessary):
    ls /usr/share/applications/*.desktop | sed -e "s@/usr/share/applications/@@g" | less
    
    To figure out what $MIME_TYPE 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
    
  2. Restart Nautilus:
    killall nautilus
    

Rename your computer

  1. Edit the Network Settings:
    gksudo network-admin
    
    Select the General tab, and change the hostname as desired.

Firefox

Firefox is Ubuntu's default browser. Here are some useful customizations.

  1. (recommended) Install the Java plugin:
    sudo apt-get install sun-java6-plugin
    
    Restart Firefox for the plugin to take effect.
  2. Manually download and install Flash 10.
    wget -c -P /tmp/ http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_10_linux.deb
    sudo dpkg -i /tmp/install_flash_player_10_linux.deb
    
    Restart Firefox for the plugin to take effect.
  3. (optional) Some useful extensions:
  4. (optional) Enter about:config in the URL bar and make the following customizations:
    general.autoScroll=true
    network.http.pipelining=true
    network.http.proxy.pipelining=true
    network.prefetch-next=false
    browser.backspace_action=0
    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)
    browser.search.openintab=true
    browser.tabs.autoHide=false
    browser.tabs.closeButtons=3
    browser.tabs.loadFolderAndReplace=false
    browser.tabs.loadGroup=0 [seems to have vanished in Firefox 3.0]
    browser.tabs.warnOnClose=false
    
  5. (optional) Open URLs entered in address bar in a new tab by default. (Useful if you hate having to press ALT+ENTER to achieve this.) Note that the following needs to be done each time a new version of Firefox is installed (e.g., as an Ubuntu update).
    sudo apt-get install fastjar
    pushd /tmp; fastjar -xf /usr/lib/firefox-3.0.3/chrome/browser.jar content/browser/browser.js; popd
    sed -i -e"s/if (aTriggeringEvent \&\& aTriggeringEvent.altKey)/if (!(aTriggeringEvent \&\& aTriggeringEvent.altKey))/" /tmp/content/browser/browser.js
    sudo fastjar -uf0 /usr/lib/firefox-3.0.3/chrome/browser.jar -C/tmp content/browser/browser.js
    

Thunderbird

Thunderbird is a fast and polished email client.

  1. Install Thunderbird:
    sudo apt-get install thunderbird
    
    You can run Thunderbird from the Applications > Internet menu.
  2. (recommended) Make Thunderbird the preferred email client:
    gconftool --type string --set /desktop/gnome/url-handlers/mailto/command "thunderbird %s"
    
  3. (optional) The following Thunderbird extensions are useful: Addressbooks Synchronizer, New Mail Icon.
  4. (optional) To set the default sort order to descending, go to the Edit > Preferences menu, select the Advanced tab, click on Config Editor, and make the following changes:
    mailnews.default_news_sort_order=2
    mailnews.default_sort_order=2
    

Pidgin

Pidgin is an IM client that comes pre-installed on Ubuntu. Here are some useful customizations.

  1. (optional) Make Pidgin start automatically upon login:
    cp /usr/share/applications/pidgin.desktop ~/.config/autostart/
    
    Alternatively, you can go to the System > Preferences > Sessions menu, click on the Startup Programs tab, and an entry with name "Pidgin" and command pidgin.
  2. (optional) Make Pidgin start minimized to an icon in the notification area:
    sudo apt-get install pidgin-extprefs
    
    Now run Pidgin, press CTRL+U to go to the Plugins window, turn on the Extended Preferences plugin, click on Configure Plugin, and turn on the Hide Buddy List at startup option.
  3. (optional) Install the Off-the-Record plugin for private, secure communication:
    sudo apt-get install pidgin-otr
    
    Now run Pidgin, press CTRL+U to go to the Plugins window, and turn on the Off-the-Record Messaging plugin.

Skype

  1. Install Skype:
    sudo apt-get install libqt4-gui
    wget -c -P /tmp http://www.skype.com/go/getskype-linux-ubuntu
    sudo dpkg -i /tmp/skype-debian*.deb
    
    You can access Skype from the Applications > Internet menu.
  2. (optional) Make Skype start automatically upon login:
    cp /usr/share/applications/skype.desktop ~/.config/autostart/
    
    Alternatively, you can go to the System > Preferences > Sessions menu, click on the Startup Programs tab, and an entry with name "Skype" and command skype.
  3. (optional) To make Skype start minimized to an icon the notification area, start Skype and go to the Options by pressing CTRL+o, and turn on the Start Skype minimized in the system tray option in the General tab.
  4. (troubleshooting) If you are having trouble getting audio to work, first set up PulseAudio. Then open Skype and press CTRL+o. In the Sound Devices section, set Sound Out and Ringing to pulse, and click the Apply button. Then forcibly kill and restart Skype.
    killall -s 9 skype
    skype &
    

Ekiga

Ekiga is a VoIP/video-conferencing client that comes installed with Ubuntu.

  1. You can run Ekiga from the Applications > Internet menu.
  2. To make an test call to see if you mic and speakers are properly set up, dial sip:500@ekiga.net.

Totem

Totem is a great media player that comes installed by default. With the setup described below (using the xine back-end), it can play CDs, DVDs, and almost any media file.

  1. You can find Totem in the Applications > Sound & Video menu under the name Move Player.
  2. (recommended) Use Totem-xine. Totem-xine combines the Totem player front-end with the powerful xine back-end to play almost any media format. The xine back-end can play DVDs with full DVD menu suport.
  3. (alternative) Use Totem-GStreamer. Totem-GStreamer combines the Totem player front-end with the extensible GStreamer back-end. The GStreamer back-end can play DVDs but does not support DVD menus.
  4. (recommended) Make Totem the preferred multimedia player.
    gconftool --type string --set /desktop/gnome/applications/media/exec "totem"
    
  5. (recommended) Make Totem the default media player for various file types.
    cp /usr/share/applications/totem.desktop ~/.local/share/applications/totem-enqueue.desktop
    nano ~/.local/share/applications/totem-enqueue.desktop
    
    Change the following lines
    Name=Movie Player
    ...
    Exec=totem %U
    ...
    
    to
    Name=Movie Player (Enqueued)
    ...
    Exec=totem --enqueue %U
    NoDisplay=true
    ...
    
    Save and close the file.
    nano ~/.local/share/applications/mimeapps.list
    
    Add the following lines.
    [Added Associations]
    application/ogg=totem.desktop;totem-enqueue.desktop;
    application/vnd.rn-realmedia=totem.desktop;totem-enqueue.desktop;
    application/x-extension-m4a=totem.desktop;totem-enqueue.desktop;
    application/x-extension-mp4=totem.desktop;totem-enqueue.desktop;
    application/x-flac=totem.desktop;totem-enqueue.desktop;
    application/x-flash-video=totem.desktop;totem-enqueue.desktop;
    application/x-matroska=totem.desktop;totem-enqueue.desktop;
    application/x-ogg=totem.desktop;totem-enqueue.desktop;
    application/x-shockwave-flash=totem.desktop;totem-enqueue.desktop;
    audio/mpeg=totem.desktop;totem-enqueue.desktop;
    audio/mpegurl=totem.desktop;totem-enqueue.desktop;
    audio/vnd.rn-realaudio=totem.desktop;totem-enqueue.desktop;
    audio/x-flac=totem.desktop;totem-enqueue.desktop;
    audio/x-m4a=totem.desktop;totem-enqueue.desktop;
    audio/x-mod=totem.desktop;totem-enqueue.desktop;
    audio/x-mp3=totem.desktop;totem-enqueue.desktop;
    audio/x-mpeg=totem.desktop;totem-enqueue.desktop;
    audio/x-mpegurl=totem.desktop;totem-enqueue.desktop;
    audio/x-ms-asf=totem.desktop;totem-enqueue.desktop;
    audio/x-ms-asx=totem.desktop;totem-enqueue.desktop;
    audio/x-ms-wax=totem.desktop;totem-enqueue.desktop;
    audio/x-ms-wma=totem.desktop;totem-enqueue.desktop;
    audio/x-pn-aiff=totem.desktop;totem-enqueue.desktop;
    audio/x-pn-au=totem.desktop;totem-enqueue.desktop;
    audio/x-pn-realaudio-plugin=totem.desktop;totem-enqueue.desktop;
    audio/x-pn-realaudio=totem.desktop;totem-enqueue.desktop;
    audio/x-pn-wav=totem.desktop;totem-enqueue.desktop;
    audio/x-pn-windows-acm=totem.desktop;totem-enqueue.desktop;
    audio/x-real-audio=totem.desktop;totem-enqueue.desktop;
    audio/x-s3m=totem.desktop;totem-enqueue.desktop;
    audio/x-vorbis+ogg=totem.desktop;totem-enqueue.desktop;
    audio/x-wav=totem.desktop;totem-enqueue.desktop;
    audio/x-xm=totem.desktop;totem-enqueue.desktop;
    image/vnd.rn-realpix=totem.desktop;totem-enqueue.desktop;
    misc/ultravox=totem.desktop;totem-enqueue.desktop;
    video/dv=totem.desktop;totem-enqueue.desktop;
    video/mp4=totem.desktop;totem-enqueue.desktop;
    video/mpeg=totem.desktop;totem-enqueue.desktop;
    video/msvideo=totem.desktop;totem-enqueue.desktop;
    video/quicktime=totem.desktop;totem-enqueue.desktop;
    video/vnd.rn-realvideo=totem.desktop;totem-enqueue.desktop;
    video/x-anim=totem.desktop;totem-enqueue.desktop;
    video/x-avi=totem.desktop;totem-enqueue.desktop;
    video/x-flc=totem.desktop;totem-enqueue.desktop;
    video/x-fli=totem.desktop;totem-enqueue.desktop;
    video/x-mpeg=totem.desktop;totem-enqueue.desktop;
    video/x-ms-asf=totem.desktop;totem-enqueue.desktop;
    video/x-msvideo=totem.desktop;totem-enqueue.desktop;
    video/x-ms-wmv=totem.desktop;totem-enqueue.desktop;
    video/x-nsv=totem.desktop;totem-enqueue.desktop;
    video/x-theora+ogg=totem.desktop;totem-enqueue.desktop;
    x-content/audio-cdda=totem.desktop
    x-content/audio-dvd=totem-xine.desktop
    x-content/audio-player=totem.desktop
    x-content/video-dvd=totem-xine.desktop
    x-content/video-vcd=totem-xine.desktop
    x-content/video-svcd=totem-xine.desktop
    x-content/video-blueray=totem-xine.desktop
    x-content/video-hddvd=totem-xine.desktop
    application/x-cd-image=totem.desktop;totem-enqueue.desktop;totem-xine.desktop;
    
    Save and close the file, and then restart Nautilus.
    killall nautilus
    

Totem-xine

Totem-xine combines the excellent Totem player front-end with the powerful xine back-end to play almost any media format.

  1. Install Totem-xine and extra codecs:
    sudo apt-get install totem-xine libxine1-plugins
    
  2. (optional) Install DVD playback capability and Windows Media and RealPlayer codecs (see the Restricted Formats page):
    wget -c -P /tmp/ http://debian-multimedia.org/pool/main/w/w32codecs/w32codecs_20071007-0.1_i386.deb
    wget -c -P /tmp/ http://debian-multimedia.org/pool/main/libd/libdvdcss/libdvdcss2_1.2.9-0.0_i386.deb
    sudo dpkg -i /tmp/w32codecs*.deb /tmp/libdvdcss2*.deb
    sudo apt-get -f install
    
  3. (recommended) Change the default Totem alternative to Totem-xine:
    sudo update-alternatives --config totem
    
    and enter the number corresponding to /usr/bin/totem-xine.
  4. (recommended) Change the default Gnome video thumbnailer alternative to use Totem-xine:
    sudo update-alternatives --config gnome-video-thumbnailer
    
    and enter the number corresponding to /usr/bin/totem-xine-video-thumbnailer.

Totem-GStreamer

Totem-GStreamer combines the excellent Totem player front-end with the extensible GStreamer back-end.

  1. Install Totem-GStreamer and extra codecs:
    sudo apt-get install totem-gstreamer gstreamer0.10-ffmpeg gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse 
    
  2. (optional) Change the default Totem alternative to Totem-GStreamer:
    sudo update-alternatives --config totem
    
    and enter the number corresponding to /usr/bin/totem-gstreamer.
  3. (optional) Change the default Gnome video thumbnailer alternative to use Totem-GStreamer:
    sudo update-alternatives --config gnome-video-thumbnailer
    
    and enter the number corresponding to /usr/bin/totem-gstreamer-video-thumbnailer.

MPlayer

MPlayer is a very powerful media player with a rubbish interface! It's handy for that rare case when Totem-xine can't play something.

  1. Install MPlayer:
    sudo apt-get install gnome-mplayer
    sudo sed -i.backup -e's@gmplayer@mplayer@g' /usr/share/applications/mplayer.desktop
    sudo sed -i.backup -e's@vo=x11,@vo=xv,@g' /etc/mplayer/mplayer.conf 
    
  2. (optional) Install the MPlayer plugin for Firefox:
    sudo apt-get install mozilla-mplayer
    

WildMidi

WildMidi is a much faster sequencer than TiMidity.

  1. Install WildMidi:
    sudo apt-get install wildmidi freepats
    
  2. You can now play a MIDI file as follows:
    wildmidi $MIDI_FILE
    
  3. (recommended) Install high-quality sound fonts:
    wget -c -P /tmp/ http://www.fbriere.net/debian/dists/stable/misc/deb/eawpatches_12-1~fbriere.4_all.deb
    sudo dpkg -i /tmp/eawpatches_12-1~fbriere.4_all.deb
    sudo cp /etc/wildmidi/wildmidi.cfg /etc/wildmidi/wildmidi.cfg.backup
    echo "dir /usr/share/midi/eawpatches" | sudo tee /etc/wildmidi/wildmidi.cfg
    cat /etc/timidity/eawpatches/gravis.cfg /etc/timidity/eawpatches/gsdrums.cfg /etc/timidity/eawpatches/gssfx.cfg /etc/timidity/eawpatches/xgmap2.cfg | sudo tee -a /etc/wildmidi/wildmidi.cfg
    

TiMidity++

TiMidity++ is a software MIDI synthesizer. See also the MIDI Software Synthesis How-To.

  1. Install Timidity++:
    sudo apt-get install timidity freepats
    
  2. Start Timidity++ as a MIDI server:
    timidity -iA -B2,8 -Os1l -s 44100
    
    Play MIDI on an available port:
    aplaymidi -p $MIDI_PORT $MIDI_FILE
    
    You can see the list of available MIDI ports as follows:
    aplaymidi -l
    
  3. (recommended) Install high quality sound fonts:
    wget -c -P /tmp/ http://www.fbriere.net/debian/dists/stable/misc/deb/eawpatches_12-1~fbriere.4_all.deb
    sudo dpkg -i /tmp/eawpatches_12-1~fbriere.4_all.deb
    sudo gedit /etc/timidity/timidity.cfg
    
    Change:
    source /etc/timidity/freepats.cfg
    
    to:
    source /etc/timidity/eawpatches.cfg
    
  4. (optional) Reduce Timidity++'s CPU usage:
    sudo gedit /etc/timidity/timidity.cfg
    
    Add:
    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.

FluidSynth

FluidSynth is a software MIDI synthesizer.

  1. Install FluidSynth with SoundFonts:
    sudo apt-get install fluidsynth fluidsynth-soundfont-gm
    
  2. Start FluidSynth as a MIDI server:
    fluidsynth -m alsa_seq /usr/share/sounds/sf2/FluidR3_GM.sf2
    
    Play MIDI on the appropriate port (e.g., 128:0):
    aplaymidi -p 128:0 $MIDI_FILE
    

Audacity

Audacity is a powerful audio editor with a fugly interface.

  1. Install Audacity:
    sudo apt-get install audacity
    
    You can find Audacity in the Applications > Sound & Video menu.

GIMP

GIMP is Ubuntu's default raster editor and acts as a reasonable replacement for Adobe Photoshop.

  1. You can find GIMP in the Applications > Graphics menu.

Inkscape

Inkscape is a vector graphics editor.

  1. Install Inkscape:
    sudo apt-get install inkscape
    
    You can find Inkscape in the Applications > Graphics menu.

Blender

Blender is an open-source 3D modeler and animation editor.

  1. Install Blender:
    sudo apt-get install blender
    
    You can find Blender in the Applications > Graphics menu.

Brasero

Brasero is the CD/DVD burning utility that comes with the default installation of Ubuntu.

  1. You can run Brasero from the Applications > Sound & Video menu.
  2. (recommended) Install extra codecs to allow creation of audio CDs from mp3, wma, etc.:
    sudo apt-get install gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-ffmpeg
    
  3. (recommended) Make Brasero the default burner for various media types.
    nano ~/.local/share/applications/mimeapps.list
    
    Append the following lines.
    [Added Associations]
    x-content/blank-bd=brasero.desktop;
    x-content/blank-cd=brasero.desktop;
    x-content/blank-dvd=brasero.desktop;
    x-content/blank-hddvd=brasero.desktop;
    
    Save and close the file, and then restart Nautilus.
    killall nautilus
    

SoundConverter

SoundConverter can convert between various audio formats like Ogg/Vorbis, MP3, FLAC, and WAV.

  1. Install SoundConverter along with GStreamer codecs:
    sudo apt-get install soundconverter gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad
    
    You can run SoundConverter from the Applications > Sound & Video menu.

MEncoder

MEncoder is a command-line tool to encode and decode videos.

  1. Install MEncoder:
    sudo apt-get install mencoder
    
  2. Here is some documentation on ripping and transcoding with MEncoder.

Rosegarden

Rosegarden is a musical sequencer and score editor.

  1. Install Rosegarden:
    sudo apt-get install rosegarden
    
  2. Before running Rosegarden, start a MIDI server using either TiMidity++ or FluidSynth.
  3. Run Rosegarden from the Applications > Sound & Video menu.
  4. Within Rosegarden, go to Studio > Manage Midi Device, and set the General Midi ports appropriately (typically to 128:0).

GParted

GParted is a disk partition editor with which you can create, delete, and resize partitions.

  1. Install GParted:
    sudo apt-get install gparted
    
    You can find GParted in the System > Administration menu under the name of Partition Editor.

FSlint

FSlint is a great tool for maintaining a clean and tidy file system. It can locate files that have duplicate content, empty directories, large packages, etc.

  1. Install FSlint:
    sudo apt-get install fslint
    
    You can find FSlint in the Applications > System Tools menu.

gvim

gvim is my favorite plain-text editor.

  1. Install gvim:
    sudo apt-get install vim-gnome
    
  2. (optional) Configure your ~/.vimrc file. (See my ~/.vimrc for an example; it contains several key mappings to make it behave like a normal text editor.)
  3. (optional) Make gvim the default text editor.
    nano ~/.local/share/applications/mimeapps.list
    
    Add the following lines.
    [Added Associations]
    text/plain=gvim.desktop;
    text/html=gvim.desktop;
    text/css=gvim.desktop;
    text/xml=gvim.desktop;
    text/x-chdr=gvim.desktop;
    text/x-csrc=gvim.desktop;
    text/x-csharp=gvim.desktop;
    text/x-c++hdr=gvim.desktop;
    text/x-c++src=gvim.desktop;
    text/x-csharp=gvim.desktop;
    text/x-tex=gvim.desktop;
    text/x-java=gvim.desktop;
    text/x-dtd=gvim.desktop;
    text/x-bibtex=gvim.desktop;
    text/x-tex=gvim.desktop;
    text/x-readme=gvim.desktop;
    
    Save and close the file, and then restart Nautilus.
    killall nautilus
    
  4. (recommended) Select nano as the default system editor:
    sudo update-alternatives --config editor
    
    and select your choice.

TeX Live

TeX Live allows you to compile LaTeX files.

  1. Install TeX Live, along with some useful TeX packages:
    sudo apt-get install texlive texlive-latex-extra texlive-math-extra texlive-pstricks texlive-science latex-beamer
    

Octave

Octave is an open-source Matlab replacement.

  1. Install Octave:
    sudo apt-get install octave
    

Maxima

Maxima is a computer algebra system similar to Maple and Matlab although not as sophisticated.

  1. Install Maxima:
    sudo apt-get install wxmaxima
    

gnuplot

gnuplot is a tool for plotting and graphing data.

  1. Install gnuplot:
    sudo apt-get install gnuplot
    

Dia

Dia is a diagram editor useful for drawing circuits, flowcharts, and various other technical diagrams.

  1. Install Dia:
    sudo apt-get install dia-gnome
    
    You can find Dia in the Applications > Graphics menu.

Compilers and libraries

  1. Basic compilers and tools:
    sudo apt-get install build-essential
    
  2. (optional) OpenGL and SDL libraries:
    sudo apt-get install nvidia-glx-new-dev libglew1.4-dev libsdl1.2-dev libsdl-ttf2.0-dev libsdl-image1.2-dev libsdl-mixer1.2-dev
    

CVS

CVS is a version control system.

  1. Install CVS:
    sudo apt-get install cvs
    
  2. (optional) Install Meld, a visual diff and merge tool for file comparisons:
    sudo apt-get install meld
    
  3. (optional) Install TkCVS, a GUI front-end for CVS:
    sudo apt-get install tkcvs
    

Subversion

Subversion is a version control system.

  1. On both server and client, install Subversion:
    sudo apt-get install subversion
    
  2. On the server (setting up Subversion to be accessed via SSH):
    1. Make a directory for the repositories to sit:
      mkdir $SVN_DIR
      
      Typically, use /home/$USER/svn as $SVN_DIR.
    2. Create a repository:
      svnadmin create $SVN_DIR/$PROJECT
      
      where $PROJECT is your project name
    3. Turn off anonymous access:
      nano $SVN_DIR/$PROJECT/conf/svnserve.conf
      
      Add the following lines:
      [general]  #section heading
      anon-access = none # turn off anonymous access
      
    4. (optional) Import existing content to the repository:
      svn import /path/to/original/content/ file://$SVN_DIR/$PROJECT[/deeper]
      
      Note that $SVN_DIR must be the absolute path.
  3. On the client:
    1. Initial checkout:
      svn checkout svn+ssh://$SVN_SERVER/$SVN_DIR/$PROJECT[/deeper/]
      
    2. Subsequent updates, commits, etc.:
      svn update/commit/add/remove/rename/revert [filenames]
      
    3. (optional) Install Meld, a visual diff and merge tool for file comparisons:
      sudo apt-get install meld
      

Eclipse

Eclipse is an open-source integrated development environment for Java, C, C++, and Python.

  1. Install Eclipse for Java, C, C++, and Python:
    sudo apt-get install eclipse eclipse-cdt eclipse-pydev
    
    You can find Eclipse in the Applications > Programming menu.

OpenSSH server

OpenSSH server allows you to securely access your computer from another computer via the SSH protocol.

  1. (highly recommended) For security reasons, the first thing you should do is enable the firewall.
  2. Install OpenSSH server:
    sudo apt-get install openssh-server
    
  3. (optional) Restrict access to a particular set of users:
    sudo nano /etc/ssh/sshd_config
    
    Add the following line:
    AllowUsers $USER_1 $USER_2 ... $USER_N
    
    where $USER_1, $USER_2, ..., $USER_N are the users you want to allow (all other users will be disallowed SSH access).
  4. Restart the SSH server if you made any of the optional configuration changes above:
    sudo /etc/init.d/ssh restart
    
  5. If you have enabled the firewall (as was recommended), open the SSH port (port 22 by default) to those IP addresses that you want to allow SSH access. For example, if you want to restrict SSH access to your private network, set the policy to open your SSH port for only 192.168.0.0/16 (i.e., IPs of the form 192.168.xxx.xxx).
    sudo ufw allow proto tcp from 192.168.0.0/16 to any port 22
    
  6. If you are behind a router on a private network, give your server a static private IP (e.g., 192.168.1.30) by clicking on the System > Administration > Network menu item and setting up a static IP. Note that the gateway address should be the router's LAN address (e.g., 192.168.0.1 for D-Link and Netgear routers, 192.168.1.1 for Linksys routers, 192.168.2.1 for Belkin and SMC routers, and 192.168.123.254 for US Robotics routers).
  7. If you want to access your server over the Internet and are behind a router, configure the router to allow access to your server's SSH port.
  8. If you want to access your server over the Internet and your Internet Service Provider doesn't give you a static IP address, you need to set up a publicly accessible hostname.

Set up a static hostname

If you have a dynamic IP address, it can be difficult to access your computer over the Internet (e.g., via an SSH) over an extended period of time because the IP address keeps changing. An elegant solution is to use a free service called DynDNS to create a hostname (e.g., name.dyndns.org) with which you can access your computer over the Internet so long as you keep DynDNS updated with your current IP address. We will use a script called ipcheck to automatically update DynDNS with your IP address.

  1. Sign up for a free dynamic DNS account with DynDNS and create a hostname and select a domain name (e.g., dyndns.org, podzone.org, etc.) for your computer.
  2. Install ipcheck:
    sudo apt-get install ipcheck
    
  3. Create a directory to store relevant scripts and data in the root user's home directory (i.e., /root):
    sudo mkdir /root/ipcheck
    
  4. Create a file that stores your DynDNS account username and password (for security, we will later make it so that only the root user can read this file):
    sudo nano /root/ipcheck/dyndns_account
    
    Enter your DynDNS account information into the file as below:
    $DYNDNS_USERNAME $DYNDNS_PASSWORD $HOSTNAME.$DOMAIN
    
    Save and close the file. Here, $DYNDNS_USERNAME and $DYNDNS_PASSWORD are your DynDNS account username and password. $HOSTNAME is the hostname you chose, and $DOMAIN is the domain you selected (e.g., dyndns.org, podzone.org, etc.).
    Restrict the permissions for the file so that only the root user can read it.
    sudo chmod o-r /root/ipcheck/dyndns_account
    
  5. Create a script to inform DynDNS of the current IP address:
    sudo nano /root/ipcheck/dyndns_update.sh
    
    Enter the following code into the script file:
    #!/bin/sh
    cd /root/ipcheck/
    if [ -f ipcheck.dat ]; then
      /usr/sbin/ipcheck -l -r checkip.dyndns.org:8245 --acctfile dyndns_account
    else
      /usr/sbin/ipcheck --makedat -l -r checkip.dyndns.org:8245 --acctfile dyndns_account
    fi 
    
    Save and close the file. When called, this script will get the current IP address (using a free service provided by DynDNS). Then, if the IP address changed, the script will update DynDNS with the new address.
    Make the script file executable:
    sudo chmod +x /root/ipcheck/dyndns_update.sh
    
  6. Finally, schedule the script to be run periodically:
    sudo crontab -e
    
    Append the following line to the list of crontab tasks in order to schedule our script to run every 10 minutes:
    */10 * * * * test -x /root/ipcheck/dyndns_update.sh && /root/ipcheck/dyndns_update.sh > /dev/null
    
    Save and close the file.

Mount

  1. ReiserFS partition:
    sudo mount /dev/$DEVICE $MOUNT_DIR -t reiserfs -o notail
    
    where To list the devices for the various partitions:
    sudo fdisk -l
    
  2. ext3 partition:
    sudo mount /dev/$DEVICE $MOUNT_DIR -t ext3 
    
  3. NTFS partition:
    sudo mount /dev/$DEVICE $MOUNT_DIR -t ntfs -o nls=utf8
    
  4. FAT32 partition or USB drive:
    sudo mount /dev/$DEVICE $MOUNT_DIR -t vfat -o iocharset=utf8
    
  5. CD/DVD:
    sudo mount /dev/$DEVICE $MOUNT_DIR -t iso9660 -o unhide,ro
    
  6. ISO file:
    sudo modprobe loop
    sudo mount $ISO_FILE $MOUNT_DIR -t iso9660 -o loop,unhide,ro
    

Unmount

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

ISO images

An ISO image file is a file that stores the complete contents of a disk or directory.

MD5 checksums

An MD5 checksum of a file is a tiny fingerprint that can be used to verify (with high probability) the correctness of the contents of the file.

  1. Create:
    md5sum $FILE > $FILE.md5
    
  2. Verify:
    md5sum -c $FILE.md5
    

File compression

  1. Compress:
    tar -cvzf $ARCHIVE_NAME.tar.gz $FILE_OR_DIRECTORY
    
  2. Extract:
    tar -xvzf $ARCHIVE_NAME.tar.gz
    

File encryption

  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
    

Operating on multiple files

  1. Recursively remove all files with names matching $PATTERN from directory $DIR:
    find $DIR -name "$PATTERN" -okdir rm {} \;
    
  2. Change all occurences of $REGEXP1 in file names to $REGEXP2 (see Wikipedia's regular expression syntax guide):
    find $DIR -mindepth 1 -maxdepth 1 -regextype posix-extended \
        -regex '(.*/)([^/]*($REGEXP1)+[^/]*)' \
        -execdir bash -c 'mv "$0" "$(echo "$0" | sed -e"s@$REGEXP1@$REGEXP2@g")"' '{}' \;
    
  3. Change all upper-case letters in file names containing $REGEXP to lower-case:
    find $DIR -mindepth 1 -maxdepth 1 -regextype posix-extended \
        -regex '(.*/)([^/]*(([A-Z][^/]*($REGEXP))|(($REGEXP)[^/]*[A-Z]))+[^/]*)' \
        -execdir bash -c 'mv "$0" "$(echo "$0" | sed -e"y@ABCDEFGHIJKLMNOPQRSTUVWXYZ@abcdefghijklmnopqrstuvwxyz@")"' '{}' \;
    

SSH tunneling

  1. Tunnel to an SSH server through a bastion host using local port forwarding:
    ssh -fN -L $LOCAL_PORT:$SERVER:22 $BASTION
    ssh localhost:$LOCAL_PORT
    
    where
  2. (optional) If you tunnel often, you might want to edit your ~/.ssh/config file to create profiles for these SSH sessions. See this ~/.ssh/config file as an example.
  3. (optional) Set up public key authentication.

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 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 $SERVER
    
    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 $BASTION
    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
    
    where
  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. Load your keys for the remainder of the session (i.e., until you log out):
    ssh-add
    
    (You will be prompted for your passphrase.)
  2. 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
    
    Change:
    default		0
    
    to:
    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 /boot/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. Go to Start > Run... and enter:
    shutdown /r /t 00
    

Remote desktop to an Ubuntu machine (securely!)

Remote desktop to a Windows machine

Note: The remote machine must be booted into Windows XP, so you may have to reboot remotely from Ubuntu to Windows first.

  1. If you can access the remote machine directly:
    rdesktop -r disk:sync=/home/$USER/$SYNC_DIR $SERVER:3389
    
    where
  2. If the remote machine is protected by a bastion host, you will need to create an SSH tunnel through which to access the server:
    ssh -fN -L $LOCAL_PORT:$SERVER:3389 $BASTION
    rdesktop -r disk:sync=/home/$USER/$SYNC_DIR localhost:$LOCAL_PORT
    
    where

SFTP

SFTP is a secure protocol for file transfer using SSH.

  1. On the server:
    1. Install OpenSSH server. Make sure to follow the steps to configure your firewall and/or router to allow the desired clients access to the server's SSH port. Also make sure to follow the steps to set up a static IP or hostname so that the clients can have a fixed handle with which to access the server.
  2. To access the server from an Ubuntu client, open Nautilus, press CTRL+L, and in the Location bar, type:
    sftp://$SERVER
    
    where To jump directly into a directory $DIR, type:
    sftp://$SERVER/$DIR
    
  3. To access the server from a Windows client, use the open-source FileZilla client software.

Samba

Samba allows you to share files and printers with both Windows and Ubuntu computers. Note that SFTP is a more secure method for sharing files.

  1. On the server:
    1. (highly recommended) For security reasons, the first thing you should do is enable the firewall.
    2. Install Samba:
      sudo apt-get install samba libpam-smbpass
      
      Then log out and log back in. (You'll get a permissions error if you try to share a folder in the same login session that you installed Samba.)
    3. In Nautilus, right-click on the folder that you want to share, click on Sharing Options..., and turn on the Share this folder checkbox. If you want to allow access without a username and password, also turn on Guest access. This is useful if you want to share the folder with a Windows user with a different user name.
    4. If you have enabled the firewall (as was recommended), open the ports that Samba uses (ports 137-139, 445) to your private network:
      sudo ufw allow from 192.168.0.0/16 to any port 137
      sudo ufw allow from 192.168.0.0/16 to any port 138
      sudo ufw allow from 192.168.0.0/16 to any port 139
      sudo ufw allow from 192.168.0.0/16 to any port 445
      
  2. To access the server from an Ubuntu client, open Nautilus, press CTRL+L, and in the Location bar, type:
    smb://$SERVER
    
    where
  3. To access the server from a Windows client, go to Start > Run and type:
    \\$SERVER
    
    where

Printer sharing

  1. On the server:
    1. Set up your printer, and make sure it's turned on and working.
    2. Go to the System > Administration menu and click on Printing.
    3. Select Server Settings on the left, and turn on the checkbox labeled Share published printers connected to this system. This will allow printer sharing over your private network. If you want to access the printer over the Internet, also turn on Allow printing from the Internet.
    4. Select your printer under Local Printers on the left, select the Policies tab, and turn on the checkboxes labeled Enabled, Accepting jobs, and Shared.
    5. If you have enabled the firewall, open port 631 (the default IPP port) for the IP addresses to which you want to give printer access. If you want to restrict printer access to your private network, set the policy to open your IPP port for only 192.168.0.0/16 (i.e., IPs of the form 192.168.xxx.xxx). If you are using ufw, you can do this as follows:
      sudo ufw allow from 192.168.0.0/16 to any port 631
      
    6. If you are behind a router on a private network, give your server a static private IP (e.g., 192.168.1.30) by clicking on the System > Administration > Network menu item and setting up a static IP. Note that the "gateway address" should be the router's address (e.g., 192.168.0.1, 192.168.1.1, or whatever).
    7. If you want to access your server over the Internet and are behind a router, configure the router to allow access to your server's IPP port (port 631).
    8. If you want to access your server over the Internet and your Internet Service Provider doesn't give you a static IP address, you need to set up a publicly accessible hostname.
  2. On the client:
    1. Go to the System > Administration menu and click on Printing.
    2. Click on the New Printer button.
    3. Select Other, and enter the following URI:
      http://$SERVER:631/printers/$PRINTER
      
      where $SERVER is the server hostname or IP address and $PRINTER is the printer name on the server, and then click Forward and follow the remaining steps as you would for local printer setup. You can see the names of all the printers shared by a server by visiting the following URL in your web browser:
      http://$SERVER:631/printers
      
      where $SERVER is the server hostname or IP address.

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
    EndSection
    

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:
    [/usr/lib/xine/plugins/1.0.0/xineplug_decode_w32dll.so]
    size=173768
    mtime=1112804124
    type=131
    api=15
    id=win32a
    version=10000
    supported_types=50593792 52428800 52822016 ... (long line truncated)
    decoder_priority=1
    
    Replace (in this section only):
    decoder_priority=1
    With:
    decoder_priority=7

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
    
    Find the line corresponding to the FAT32 partition giving you the warning:
    ... vfat ... 0 1
    
    and change the last number from 1 to 0.

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
    

Restore GRUB

  1. Boot from the Live CD if you can't boot from the hard drive 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.

Wine

Wine is a Windows compatibility layer that allows you to run Windows applications directly in Linux.

  1. (optional) Add the Wine repository to your sources list:
    wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -
    sudo wget http://wine.budgetdedicated.com/apt/sources.list.d/hardy.list -O /etc/apt/sources.list.d/winehq.list
    sudo apt-get update
    
    Doing the above will allow you to stay updated with the latest Wine version which comes out about every two weeks. Of course, you can choose not to do the above and stick with Ubuntu's own Wine package which is updated much less frequently.
  2. Install Wine:
    sudo apt-get install wine
    
  3. To run a Windows program from the terminal:
    wine $WINDOWS_EXECUTABLE_FILE
    

Lexmark Z23 printer

I have an old Lexmark Z23 printer, and it takes a little extra work to get it running.

  1. sudo apt-get install alien libstdc++5
    wget -c -P /tmp/ http://www.downloaddelivery.com/srfilecache/CJLZ35LE-CUPS-2.0-1.TAR.GZ
    pushd /tmp
    tar -xvzf CJLZ35LE-CUPS-2.0-1.TAR.GZ
    tail -n +143 lexmarkz35-CUPS-2.0-1.gz.sh > install.tar.gz
    tar -xvzf install.tar.gz
    sudo alien --to-deb *.rpm
    sudo dpkg -i *.deb
    sudo ldconfig
    popd
    cd /usr/share/cups/model
    sudo gunzip Lexmark-Z35-lxz35cj-cups.ppd.gz
    sudo /etc/init.d/cupsys restart
    
  2. gksudo /usr/bin/system-config-printer 
    
    and then click the New Printer button.
  3. If the printer is connected directly to the computer via USB, select Lexmark Z23-33 USB #n and click Forward.
  4. If the printer is to be accessed via the network, select Other, and enter
    http://$SERVER:631/printers/$PRINTER
    
    where $SERVER is the server hostname or IP address and $PRINTER is the printer name on the server, and then click Forward. You can find the names of the shared printer on a server by visiting the following URL in your web browser:
    http://$SERVER:631/printers
    
    where $SERVER is the server hostname or IP address.
  5. Select the Provide PPD File radio button, and click the button initially labeled None, and navigate to /usr/share/cups/model and choose the file named Lexmark-Z35-lxz35cj-cups.ppd.

User directories and bookmarks

You might have noticed that, upon installation, Ubuntu automatically created folders in your home directory called Desktop, Documents, Music, Pictures, Videos, and Templates. The instructions presented here allow you to change these defaults to use different directories for your desktop, documents, music, etc. This is useful if, for example, you like your directories to be lower-case (e.g., ~/desktop instead of ~/Desktop), or if you want a slightly different organization for your directories (e.g., ~/ instead of ~/Documents).

  1. To change the default user-directories, edit the XDG user-directories file:
    gedit ~/.config/user-dirs.dirs
    
    For example, to set the default music directory to ~/audio/music instead of ~/Music, use the following line:
    XDG_MUSIC_DIR="$HOME/audio/music"
    
  2. Restart the Gnome Desktop Manager, but before you do so, make sure that the XDG_DESKTOP_DIR entry points to a valid directory; otherwise, your desktop will appear blank. (Even if you mess up, you can always fix this later by editing the ~/.config/user-dirs.dirs file.)
  3. To update the bookmarks in the Places menu, the Nautilus Bookmarks menu, and in various file choosers, edit the GTK bookmarks file:
    gedit ~/.gtk-bookmarks
    
    For example, to add a bookmark named "Music" pointing to /home/user/audio/music, use the following line:
    file:///home/user/audio/music Music
    
  4. Finally, manually update the default directories in certain applications that store their own default directory information. For example:
    1. In OpenOffice.org, click on the Tools > Options menu, go to the OpenOffice.org > Paths item on the left, and change the My Documents entry appropriately.
    2. In Sound Juicer, click on the Edit > Preferences menu, and set the Music folder entry appropriately.

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:
    sftp://lion/home/$USER_NAME
    
    Windows home directory:
    sftp://lion/home/WIN/$USER_NAME
    
    Linux Bigbox directory:
    sftp://lion/home/BIGBOX/$USER_NAME
    
    Windows Bigbox directory:
    sftp://lion/home/BIGBOX.win/$USER_NAME
    
  4. For the sake of completeness, the locations of these directories under Windows are:

    Linux home directory:
    \\cucs\home\UNIX\$USER_NAME
    
    Windows home directory:
    \\cucs\home\Windows\$USER_NAME
    
    Windows Bigbox directory:
    \\cs.cornell.edu\home\bigbox\$USER_NAME
    

Reverse SSH Tunneling

Suppose you can't directly SSH from a client to a server (for example, if the server is behind a router for which SSH port forwarding is not set up). Nevertheless, if both the client and the server can SSH to a middle host, then we can set up a reverse tunnel via middle host through which the client can connect to the server.

  1. On the destination server:
    ssh -R $MIDDLE_LOCAL_PORT:localhost:$SERVER_SSH_PORT $MIDDLE_HOST
    
    where
  2. On the client:
    ssh -fN -L $CLIENT_LOCAL_PORT:localhost:$MIDDLE_LOCAL_PORT $MIDDLE_HOST
    ssh -p $CLIENT_LOCAL_PORT localhost
    
    where

Adobe Reader

  1. Download and install the Adobe Reader package using gdebi:
    wget -c -P /tmp/ http://ardownload.adobe.com/pub/adobe/reader/unix/8.x/8.1.2/enu/AdobeReader_enu-8.1.2_SU1-1.i386.deb
    gdebi-gtk /tmp/AdobeReader_enu-8*.deb
    
    Click on the Install Package button.

PulseAudio

The following comes from here and here.

  1. sudo apt-get install libasound2-plugins libao-pulse gstreamer0.10-pulseaudio
    sudo sed -i.backup -e's/default_driver=alsa/default_driver=pulse/g' /etc/libao.conf
    printf "pcm.pulse { type pulse }\nctl.pulse { type pulse }\npcm.\041default { type pulse }\nctl.\041default { type pulse }\n" | sudo tee -a /etc/asound.conf
    gconftool -t string --set /system/gstreamer/0.10/default/audiosink pulsesink
    gconftool -t string --set /system/gstreamer/0.10/default/musicaudiosink pulsesink
    gconftool -t string --set /system/gstreamer/0.10/default/chataudiosink pulsesink
    gconftool -t string --set /system/gstreamer/0.10/default/audiosrc pulsesrc
    
  2. Reboot.