How To: Getting a lean system with a custom Ubuntu install
Ubuntu So you've been using Linux for a while now and you've gotten a handle on how it works and you're feeling confident. Great! Most likely you have installed your favourite desktop environment from your favourite distribution and this includes most applications you'll ever need. This is good, but as a result your machine might not be running as lean as it could be. Do you have Bluetooth or a Wacom tablet? If not then why waste time and resources loading them? There are many such tweaks that can be performed after an install, but why not start from the very beginning with a nice clean, lean install? You'll only have what you want to have and you'll be more in charge of your system. If you're keen to get your hands a little dirty, then come along. It's fun!
Today we're going to look at performing a custom install using Ubuntu 8.10 "Intrepid Ibex". By default Ubuntu installs the GNOME desktop environment with lots of extra services and packages which help make it a very friendly distro, but which also help to use up your precious resources. We're going to start from scratch by installing a very basic Ubuntu system and build it up with the desktop and applications we want. Another benefit of this method is that you will get the latest versions of all applications at install time, rather than installing and then performing an update at a later stage.
On my test machine, a full Ubuntu install takes up 3.1 GB of hard drive space, uses 430 MB of RAM and takes 25 seconds to boot. Logging into GNOME takes a further 12 seconds. By comparison, the same machine with a custom install takes only 2.2 GB of hard drive space, uses 210 MB of RAM and takes 20 seconds to boot. Logging into GNOME takes 5 seconds.
To perform this custom install we need the Ubuntu Alternate install CD, not the Desktop CD. It is worth noting that this method uses the ncurses-based terminal installer, not a graphical one. First, burn the Alternate CD and boot to it. When prompted at the install CD menu, select a language. Press the F4 key to change the installation mode. Choose "Install a command-line system" and hit the Enter key. Now back at the main menu, ensure "Install Ubuntu" is selected and hit the Enter key. The installer will now load and we can begin our minimal install.
Boot screen for the Ubuntu Alternate installer
(full image size: 18kB, screen resolution: 642x481 pixels)
Select your language, location and then configure your keyboard. If you are using DHCP to automatically assign network addresses then you should receive an address, else you will need to configure your network manually. Enter a hostname and configure the clock. Partitioning your hard drive should be the same as other installs, just take extra care if you're not using a blank new hard drive. Create a new user, enabling an encrypted private directory if you wish. Set the clock and reboot the computer.
Installing Ubuntu via the Alternate install method
(full image size: 2.8kB, screen resolution: 642x481 pixels)
The fresh base install you have created should now be ready to boot. Log in with the user you created during the install process. Now that you have a basic system installed, we can use the Internet to download the latest packages. Any packages that have been updated since the initial Intrepid release will be installed from the Internet, while anything else will be installed from the local CD. By default the Ubuntu installer will have configured your sources.list for you. If you want to use a custom mirror, you can do so now by editing your /etc/apt/sources.list or you can continue below.
If you want Ubuntu to install any current packages from the CD rather than via the Internet, then make sure your Alternate CD is in the drive and run:
$ sudo apt-cdrom add
Now we'll update the system:
$ sudo apt-get update
$ sudo apt-get dist-upgrade
Great, now we have an up-to-date base install that's ready to get some more grunt. Next, we will install various packages, but note that these are optional. You can install whichever packages you want to make your system just right for you.
Does your CPU support speed stepping? If so, install the powernow daemon:
$ sudo apt-get install powernowd
You may wish to install a SSH server, so that you can remotely connect to the machine; if so, install it too:
$ sudo apt-get install ssh
Let's get a basic X environment going. We are going to install a basic GNOME, but you can choose a different environment if you want:
$ sudo apt-get install xorg gdm acpi-support gnome-session gnome-menus gnome-panel gnome-applets gnome-volume-manager gnome-power-manager metacity nautilus
If you want fancy 3D effects, install Compiz:
$ sudo apt-get install compiz
Now we can get some extra packages for GNOME:
$ sudo apt-get install gnome-screensaver xscreensaver menu gnome-utils gnome-system-tools libgnomevfs2-extra smbfs
Want to be able to switch users and use the guest account in Intrepid?
$ sudo apt-get install fast-user-switch-applet gdm-guest-session
If you want to use some of the graphical package management tools that Intrepid includes, then install the following:
$ sudo apt-get install gnome-app-install app-install-data-commercial update-manager update-notifier
If you need either the NVIDIA or ATI drivers for your video card, you can either install Ubuntu's graphical tool:
$ sudo apt-get install jockey-gtk
Or install the required packages directly, depending on your card (newer NVIDIA cards will use version 177, while older ones will use 96):
$ sudo apt-get install linux-headers-generic dkms nvidia-glx-177 && sudo nvidia-xconfig
$ sudo apt-get install linux-headers-generic dkms xorg-driver-fglrx && sudo aticonfig --initial
If you need wireless or other fancy network configurations then install Network Manager (note that this will pull in Bluetooth support):
$ sudo apt-get install network-manager-gnome
Because we installed using the Alternate CD, Ubuntu has been configured using the default network settings, rather than those with Network Manager. You will need to edit the network interfaces file and remove the lines for your network card:
$ sudo nano -w /etc/network/interfaces
Remove the lines for your primary interface, it should look similar to this:
iface eth0 inet dhcp
After this, Network Manager will start working.
Now we need some basic applications. These are of course optional! You can install whatever packages you want to have:
$ sudo apt-get install gnome-terminal gedit firefox firefox-3.0-gnome-support
Other basic applications you may want to include:
$ sudo apt-get install eog evince file-roller pidgin gcalctool gimp gthumb gucharmap openoffice.org openoffice.org-gnome rhythmbox
Some plugins for Nautilus are available too:
$ sudo apt-get install nautilus-sendto nautilus-share nautilus-cd-burner
Ubuntu has great support for proprietary and closed-source data formats. You can install these individually, or everything at once:
$ sudo apt-get install ubuntu-restricted-extras
When it comes to printing, you may not need the full blown CUPS system and every possible printer driver. If you're connecting to another server, just install the CUPS client. By default, Ubuntu installs lots of drivers, including the HP daemon (even if you don't have any HP equipment!). If you want GNOME's graphical printer tool, it will pull in many printer drivers for you automatically:
$ sudo apt-get install system-config-printer-gnome
Or you can install specific printer related support by picking and choosing the ones that suit your needs from the following:
$ sudo apt-get install cupsys cupsys-bsd cupsys-client cupsys-common cupsys-driver-gutenprint foo2zjs foomatic-db foomatic-db-engine foomatic-db-hpijs foomatic-filters hpijs-ppds hplip-ppds openprinting-ppds openprinting-ppds-extra
Spelling and languages
Ubuntu comes with support for many languages, simply install the language you desire (I'm using Australian/British English):
$ sudo apt-get install gnome-spell aspell-en myspell-en-au
And if you're using OpenOffice.org, here are the language packages you need:
$ sudo apt-get install openoffice.org-l10n-en-gb openoffice.org-thesaurus-en-au
If you want Ubuntu's artwork, you can easily install it with the following commands:
$ sudo apt-get install ubuntu-artwork
$ sudo apt-get install usplash usplash-theme-ubuntu
Or you can install the default GNOME artwork:
$ sudo apt-get install gnome-themes
There are some services which we do not need to have running, if you do not need them. Don't have a Wacom tablet? You can stop it from starting up! This is how I remove the Wacom driver from boot-up:
$ sudo update-rc.d -f xserver-xorg-input-wacom remove
You could do the same for any other services you do not use, such as Bluetooth (if you don't have a Bluetooth device), CUPS (if you're not running a local print server), linux-restricted-modules-common (if you're not using any proprietary drivers).
Boot into your new system
So, by now you should have a nicely customised Ubuntu install and it's time to try it! As we have most likely installed a new kernel, it's best to restart the system:
$ sudo reboot
If all went as planned, you should be greeted with the standard GNOME logon screen. Log in and take a look around! Is something missing? Install it
So this was a nice little experiment, but it's not for you? It's easy to get the full install of Ubuntu on your machine, just run:
$ sudo apt-get install ubuntu-desktop
By performing a minimal install you have the ability to create a leaner custom system that suits you and the programs you want to use. Ubuntu has a reputation of being a very user-friendly distribution and it is indeed great for users who are new to Linux. But it is also good for experienced users by remaining flexible enough to allow you to install your own custom version of Ubuntu and benefit from the pieces of technology that you want to take advantage of. A similar method can be used for other distributions too!
Enjoy your leaner, meaner Ubuntu system