Ubuntu 8.10 (Intrepid Ibex) How-To

Ubuntu

I am updating this page for Ubuntu 8.10 (Intrepid Ibex). Older versions are online but are no longer maintained.

The information presented here is for you to use freely but at your own risk. If you find any errors or have any suggestions, please let me know.

Initial setup

  1. Install Ubuntu
  2. Update and upgrade package sources
  3. Turn on the firewall
  4. Install the 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 (Last changed on 2009-01-10)

Installing Ubuntu is quick and easy.

  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, time-zone, 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. If you are given the option to "Migrate Documents and Settings", do so if you want. (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 (Last changed on 2009-01-10)

  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 (Last changed on 2009-01-10)

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) or specific apps 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 to a specific application $APP from any IP on your private network:
    sudo ufw allow from 192.168.0.0/16 to any app $APP
    
    You can find the list of applications as follows.
    sudo ufw app list
    
    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.

Graphics driver (Last changed on 2009-01-10)

  1. Go to the System > Administration menu, click on Hardware Drivers, select the appropriate driver, and click on the Activate button.

Switch to an existing /home on another partition (Last changed on 2009-01-10)

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
    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/$PARTITION/${USER}/old_config_files
    mv /media/$PARTITION/${USER}/.* /media/$PARTITION/${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 editor /etc/fstab
    
    Change
    # /dev/$PARTITION
    UUID=... /media/$PARTITION ...
    
    to
    # /dev/$PARTITION
    UUID=... /home ...
    
    where Save the file and quit the editor. (For Nano, press CTRL+O and then CTRL+X. For Vim, press ESC, type :q and press ENTER.)
  4. Reboot. After rebooting, your /home directory will be located in the new partition.

Copy /home to another partition (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

  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) Switch to Compiz:
    compiz --replace &
    
    To use the Cairo window border in Compiz:
    gconftool --type boolean --set /apps/gwd/use_metacity_theme false
    
    To disable Compiz and go back to Metacity:
    metacity --replace &
    
  4. (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 (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

  1. sudo hostname $NEW_NAME
    
    Then logout for the change to take effect.

Firefox (Last changed on 2009-01-10)

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

  1. (recommended) Since Firefox can store personal information on disk, set up an encrypted Private folder and migrate your Firefox user-directory to that folder.
  2. (recommended) Install the Adobe Flash plugin.
    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) Install the Java plugin:
    sudo apt-get install sun-java6-plugin
    
    Restart Firefox for the plugin to take effect.
  4. (optional) Some useful extensions:
  5. (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
    
  6. (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.5/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.5/chrome/browser.jar -C/tmp content/browser/browser.js
    

Thunderbird (Last changed on 2009-01-10)

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) Since Thunderbird can store personal information on disk, set up an encrypted Private folder and migrate your Thunderbird user-directory to that folder.
  3. (recommended) Make Thunderbird the preferred email client:
    gconftool --type string --set /desktop/gnome/url-handlers/mailto/command "thunderbird %s"
    
  4. (optional) The following Thunderbird extensions are useful: Addressbooks Synchronizer, New Mail Icon.
  5. (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 (Last changed on 2009-01-10)

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

  1. You can run Pidgin from the Applications > Internet menu.
  2. (highly recommended) Since Pidgin stores saved passwords on disk in clear-text, set up an encrypted Private folder and migrate your Pidgin user-directory to that folder.
  3. (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.
  4. (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.

Ekiga (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

Totem is a great media player that comes installed by default. I recommend installing both the xine and GStreamer backends.

  1. You can find Totem in the Applications > Sound & Video menu under the name Move Player.
  2. (optional) Enable DVD playback.
    sudo apt-get install libdvdread3
    sudo /usr/share/doc/libdvdread3/install-css.sh
    
  3. (alternative) If the above doesn't work, you can try the following.
    wget -c -P /tmp/ http://debian-multimedia.org/pool/main/libd/libdvdcss/libdvdcss2_1.2.10-0.2_i386.deb
    sudo dpkg -i /tmp/libdvdcss2*.deb
    sudo apt-get -f install
    
  4. Install the GStreamer back-end which can play DVDs but does not yet support DVD menus.
    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
    
  5. Install the xine back-end which can play DVDs with full DVD menu suport.
    sudo apt-get install totem-xine
    
  6. To run Totem with a particular back-end, run either totem-gstreamer or totem-xine. You can select between GStreamer and xine as default back-end to use for when you run totem.
    sudo update-alternatives --config totem
    sudo update-alternatives --config gnome-video-thumbnailer
    
    and select the appropriate defaults.
  7. (recommended) Make Totem the preferred multimedia player.
    gconftool --type string --set /desktop/gnome/applications/media/exec "totem"
    
  8. (recommended) Make Totem the default media player for various file types.
    mkdir -p ~/.local/share/applications
    cp /usr/share/applications/totem.desktop ~/.local/share/applications/totem-enqueue.desktop
    editor ~/.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.
    mkdir -p ~/.local/share/applications
    editor ~/.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-xine.desktop;totem.desktop;totem-enqueue.desktop;
    
    Save and close the file, and then restart Nautilus.
    killall nautilus
    

WildMidi (Last changed on 2009-01-10)

WildMidi is a much faster sequencer than TiMidity.

  1. WildMidi playback for Totem-GStreamer is automatically installed when you install the GStreamer codecs. In particular:
    sudo apt-get install gstreamer0.10-plugins-bad
    
  2. (alternative) You can also install the WildMidi command-line player:
    sudo apt-get install wildmidi
    
    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*.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++ (Last changed on 2009-01-10)

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*.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 (Last changed on 2009-01-19)

FluidSynth is a software MIDI synthesizer.

  1. Install FluidSynth with SoundFonts:
    sudo apt-get install fluidsynth fluid-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 (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

Inkscape is a vector graphics editor.

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

Blender (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

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.
    editor ~/.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 (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

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.
    editor ~/.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 (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

Octave is an open-source Matlab replacement.

  1. Install Octave:
    sudo apt-get install octave
    

Maxima (Last changed on 2009-01-10)

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

  1. Install Maxima:
    sudo apt-get install wxmaxima
    

gnuplot (Last changed on 2009-01-10)

gnuplot is a tool for plotting and graphing data.

  1. Install gnuplot:
    sudo apt-get install gnuplot
    

Dia (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

  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 (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

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:
      editor $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 (Last changed on 2009-01-10)

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.

Skype (Last changed on 2009-02-22)

Skype is a program that lets you make voice calls to other computers and to phones. It's free to call other computers, but you have to pay to call non-toll-free phone numbers.

  1. Download and install Skype:
    wget -c -P /tmp/ http://www.skype.com/go/getskype-linux-ubuntu
    sudo dpkg -i /tmp/skype-debian_*.deb
    sudo apt-get -f install
    
    You can find Skype in the Applications > Internet menu.
  2. To get the audio working with PulseAudio, start Skype, go to Options by pressing CTRL+O, go to the Sound Devices section, and set the Sound In, Sound Out, and Ringing drop-down menus to pulse.

OpenSSH server (Last changed on 2009-01-10)

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 editor /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 from 192.168.0.0/16 to any app OpenSSH
    
  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 (Last changed on 2009-01-10)

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 editor /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 editor /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 (Last changed on 2009-01-10)

  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 (Last changed on 2009-01-10)

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

ISO images (Last changed on 2009-01-10)

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

MD5 checksums (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

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

File encryption (Last changed on 2009-01-10)

  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 (Last changed on 2009-01-10)

  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 (Last changed on 2009-01-10)

  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 (Last changed on 2009-01-10)

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
    
    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 (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

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 editor /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 (Last changed on 2009-01-10)

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!) (Last changed on 2009-01-10)

Remote desktop to a Windows machine (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

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
      
    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 (default ports 137-139, 445) to your private network:
      sudo ufw allow from 192.168.0.0/16 to any app Samba
      
  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 (Last changed on 2009-01-10)

  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 app CUPS
      
    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 (Last changed on 2009-01-10)

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
    

Restart the Gnome Desktop Manager (GDM) (Last changed on 2009-01-10)

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

Restore GRUB (Last changed on 2009-01-10)

  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 (Last changed on 2009-01-10)

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/intrepid.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
    

Encrypted Private directory (Last changed on 2009-01-10)

  1. Set up your encrypted Private directory.
    sudo apt-get install ecryptfs-utils 
    ecryptfs-setup-private
    
    You will be asked for your login passphrase and for a mount passphrase. For the login passphrase, enter the password that you use for your Ubuntu login. For the mount passphrase, I recommend just hitting Enter and letting the script pick a random passphrase for you.
  2. (recommended) Migrate your Firefox, Thunderbird, and Pidgin user-directories to the Private directory so that they are encrypted on disk.
    for DIR in .mozilla .mozilla-thunderbird .purple
    do 
      mv ~/${DIR} ~/Private/
      ln -s ~/Private/${DIR} ~/
    done
    

Lexmark Z23 printer (Last changed on 2009-01-10)

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/cups 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 (Last changed on 2009-01-10)

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.

Reverse SSH Tunneling (Last changed on 2009-01-10)

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 (Last changed on 2009-01-10)

  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 (Last changed on 2009-01-10)

Last update: 2008-01-10

  1. 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
    

QEMU (Last changed on 2009-01-10)

Last update: 2008-01-10

QEMU is a process emulator that can be used to run a virtual machine with its own operating system on your Ubuntu machine.

  1. Install QEMU.
    sudo apt-get install qemu
    
  2. Install QEMU Accelerator (KQEMU).
    sudo apt-get install kqemu-common kqemu-source libsdl1.2-dev
    cd /usr/src/kqemu-*
    sudo ./configure
    sudo make
    sudo make install
    sudo addgroup --system kqemu
    sudo adduser $USER kqemu
    sudo depmod -a
    sudo modprobe -r kqemu
    sudo modprobe kqemu
    echo "kqemu" | sudo tee -a /etc/modules
    
  3. Prepare a file containing a disk image to be used as the hard drive in the virtual machine.
    qemu-img create $DISK_FILE -f qcow2 ${DISK_SIZE}G
    
    where
  4. Install the OS using an ISO file.
    qemu -hda $DISK_FILE -cdrom $INSTALL_PATH -boot d -m $MEM_SIZE
    
    where
  5. To confirm that QEMU is using KQEMU, press CTRL-ALT-2 to get to the console, and then run the following.
    info kqemu
    
    Press CTRL-ALT-1 to go back to the main console.