O'Reilly logo

Ubuntu Hacks by Bill Childers, Kyle Rankin, Jonathan Oxer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #5. Install Ubuntu

Learn how to install Ubuntu on your computer.

If you've given Ubuntu a test-drive [Hack #1], or you're simply ready to dive into it sight unseen, all you need is an installation CD and a computer to install it on, and you can be up and running right away. There are a number of ways you can get an installation CD; if you've got broadband and a CD-R drive, you can probably get your hands on it in under an hour.

System Requirements

Ubuntu will run on just about any current personal computer. If you're using an Intel-compatible PC, it will probably "just work," since the kernel image that Ubuntu uses by default is optimized for the 80386, which means it will also be compatible with systems based on the 486, Pentium, and Pentium Pro, as well as the Pentium II, III, 4, and beyond, including all the other mainstream Intel-compatible CPUs such as the AMD Athlon and Sempron, as well as the Transmeta Crusoe and Efficeon. If your computer can run Windows 95 or later, it can probably run Ubuntu just fine. If you're running an AMD64 system, there is even a special version of Ubuntu you can download.

If you have a G3, G4, or G5 Macintosh, you'll probably be able to run the PowerPC version of Ubuntu. If it can run Mac OS X, it should be able to run Ubuntu. Mac users should see "Install Ubuntu on a Mac" [Hack #8] for complete details.

Although you may have a CPU that's compatible with Ubuntu, you may run into some hardware that doesn't want to play along. Wireless network cards can be particularly tricky, but after you get Ubuntu up and running, there are some tricks [Hacks #41 and #42] you can use to get them working. However, because the Ubuntu installer tries to use the network, I strongly urge you to keep an Ethernet cable handy in case you need to plug your system into a wired network for the install. (Early on, the Ubuntu installer will report which network interfaces it was able to activate, so if you don't see your wireless network adapter listed, it's time to use that Ethernet cable.)

Disk space and memory are probably your most important considerations. If you are planning on running the GNOME (Ubuntu) [Hack #15] or KDE (Kubuntu) [Hack #16] desktop environment, your computer will benefit from plenty of RAM and disk space. Consider 2 GB of disk space and 256 MB of RAM to be a comfortable minimum. And with the price of disk space below $1 per GB and RAM being between $50 (desktop) and $100 (laptop) per GB, the more the merrier.

Preserving Your Existing Data

If you already have Windows or Linux running on your system, and you want to keep it, you should check out "Dual-Boot Ubuntu and Windows" [Hack #6], which explains how to set up a dual-boot Ubuntu system. However, if you're just interested in archiving your existing installation so that you can pull files off of it at a later time [Hack #7], you have some choices:

New hard drive

Since the cost of storage is so low, you might want to pull and replace your current hard drive. Depending on the age of your current machine, that might give you a modest performance improvement, but it also gives you the opportunity to increase your disk space. Once you've done so, you can install your existing hard drive into an external enclosure so that you can access your old files (and use any free space for extra storage). Another option would be to simply buy an external drive and copy all your files onto it before you install Ubuntu.

Burn it to optical media

If your files can fit, burn them to CD or DVD for safekeeping. Linux will be able to read practically any format that you can put on an optical disc if you want to retrieve these files later.

Shrink your existing partition

If you want your data at your fingertips, then you should spend some time deleting everything you can live without from your old operating system: applications, datafiles, etc. If you're running Windows, make sure you disable hibernation in the control panel's power settings, because hibernation requires a file equal to the size of your installed RAM. Also, if you're not planning to boot the old operating system on a regular basis, disable the paging file. Do everything you can to free up disk space. Then defragment your drive and shrink the partition using a tool such as Partition Magic (http://www.symantec.com/partitionmagic/) or the Ubuntu installer's partitioning tool. If you want your old data at your fingertips and you still want to be able to boot up the old OS, be sure to check out "Dual-Boot Ubuntu and Windows" [Hack #6].

Move the data to another machine

If you've got another computer with lots of storage, copy the files across the network to a safe spot on that computer. Even if you have a wireless network, consider using a network cable for the transfer, since it will run a lot faster that way.

Getting the Installation CD

Before you install Ubuntu, you'll need to choose which flavor you want: Ubuntu, Kubuntu (Ubuntu with KDE as the default desktop), or Edubuntu (Ubuntu designed for young people). Although you can download a different CD-ROM for each one, you can install their core components [Hack #54] later; the packages ubuntu-desktop, kubuntu-desktop, and edubuntu-desktop can be installed at any time.


Another flavor of Ubuntu is Xubuntu (the package xubuntu-desktop), available at https://wiki.ubuntu.com/Xubuntu, which is a variant of Ubuntu that's optimized for older computers. The desktop system is more lightweight, so it's less demanding in terms of memory, CPU, and video-card resources.

Once you've decided which flavor of Ubuntu you want, go to the Ubuntu (http://www.ubuntu.com), Kubuntu (http://www.kubuntu.org), or Edubuntu (http://www.edubuntu.org) home page and follow the download link. Next, you'll need to choose which mirror site to install from (pick one that's close to you geographically), and then choose Intel x86 (for most PC compatibles), AMD64 (64-bit AMD-based PC compatibles), or PowerPC (for Macs, but if you choose this one, you should be in a different hack [Hack #8]).

On the download site, you'll find links that go directly to the CD image, an ISO file that you can burn to a CD-R using your favorite CD-burning utility. Mac OS X includes Disk Utility in the /Applications/Utilities folder. Linux usually includes the command-line cdrecord utility, and, in many cases, there will be a graphical frontend available [Hack #33]. Windows does not have its own CD-burning utility, but most PCs come bundled with a CD-burning application.


Be careful on Windows. I burned a few discs on my Dell 700m that wouldn't boot at all before I figured out what was happening. It turned out that the CD-burning application that Dell so thoughtfully bundled with my computer wouldn't burn bootable ISOs without a paid upgrade. However, there are some free ISO burners for Windows. Microsoft includes a free ISO burner (CDBURN) in its Windows Server 2003 resource kit (http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en), which, despite the name, runs on Windows XP. Alex Feinman's ISO Recorder (http://isorecorder.alexfeinman.com/isorecorder.htm) is free and works well.

Installing Ubuntu

Most computers will boot from the CD-ROM drive automatically, so put the Ubuntu CD into your computer, shut it down, and reboot. (If you try to insert the Ubuntu CD in the computer while it's booting, there's a good chance that whatever's on your hard drive will start booting before your computer even knows you've inserted a bootable CD, so press Ctrl-Alt-Delete after you insert the CD). If your computer refuses to boot from the CD, reboot it and enter the BIOS menu (usually by pressing F2, Del, or Escape as the computer is starting). Navigate through the BIOS menu and look for a set of boot options, and make sure that the CD-ROM is configured at a higher priority than your hard drive (it should be the first or, if you have a floppy drive, the second item in the list). If in doubt, consult the manual that came with your motherboard or your PC. If you don't have that manual, you should be able to download it in HTML or PDF form from the manufacturer's web site.


In very rare cases, you may have a computer that can't boot from CD-ROM. I had an ultraportable Sharp Actius MM10 that came with an external CD-ROM drive. It worked great until I tried to boot from a Linux install CD. It turned out that the CD-ROM drive was defective, and Sharp exchanged it for a working one. However, if you're in this situation, you may not have to wait for a new drive to arrive: instead, you could boot over the network [Hack #11] to install Ubuntu on your computer.

When you boot from the CD, you'll be offered several Install options: to the hard disk, OEM mode, or server. If you choose Install to the Hard Disk, you'll go through the standard Ubuntu install. OEM mode is good if you're setting up a computer that someone else will use, since it lets you set up all the hardware configuration and choose software packages, but lets the user do all the personalization (choosing a username, picking her preferred language, etc.). The server installation will set up a minimal Ubuntu system; if you want to add a desktop environment later, you can install ubuntu-desktop, kubuntu-desktop, edubuntu-desktop, or xubuntu-desktop when the need arises.

Before you start the installation, you can press F3 to choose the video mode to use, F4 to enable some assistive features, F5 to allow you to edit the boot-time kernel arguments and to enable some more options (including keyboard map and expert mode). Once you've made your choices (or left everything at the defaults), press Enter to start the installation. During the installation, you'll go through the following steps (in expert mode, you'll be taken to a main menu between each step):

Choose Language

In this step, you'll choose the default language for your system.

Choose Locale

This lets you select which locale or locales to install on your system. The locale is a feature that works in conjunction with the language to control such things as alphabetic sort order and the way dates and numbers are displayed.

Select a Keyboard Layout

This is where you choose the type of keyboard connected to your system.

Detect CD-ROM

By default, this step won't prompt you unless it has a problem finding your CD-ROM. In expert mode, you'll get to review and customize the installer's decision. You'll also be prompted to enable PCMCIA/PC Card services in expert mode during this stage.

Load Installer Components from CD

As with the previous step, the installer won't bug you unless it has a problem here. In expert mode, it will offer some extra components.

Detect Network Hardware

In this step, you get to choose which network adapter to use. In expert mode, it will offer some extra options.

Configure the Network

By default, the Ubuntu installer will attempt to configure the network using DHCP. If it fails, it will offer you some options to configure it differently. In expert mode, you'll be able to configure the network manually. Once the network is configured, you'll be prompted for a hostname (the default will be ubuntu, unless the installer finds an existing installation, in which case it will determine the hostname from that). In expert mode, you'll also be prompted for a domain name.

Choose a Mirror

In expert mode, this step lets you choose which mirror to use for additional components and package repositories. In regular mode, you'll be prompted to supply only an HTTP proxy, a server that makes requests to web servers on your behalf (usually found only on corporate or campus networks; leave it blank if you don't use one).

Detect Disks

In this step, the Ubuntu installer will detect hard disks. In expert mode, you will be prompted for some additional options, but normally this will run without any intervention.

Partition Disks

At this stage, the Ubuntu installer will offer some choices: resize your existing partition and use the free space, erase the entire disk, or manually edit the partition table. You'll notice that there are two ways you can erase the entire disk: just using the disk (usually something like "Erase entire disk: IDE1") or creating a logical volume ("Erase entire disk and use LVM"). Logical volumes offer advanced features, such as the ability to dynamically reallocate disk space between partitions.

If you want to keep your existing operating system, choose the resize option. If you want to wipe out the entire disk and put Ubuntu on it, choose one of the other options (the basic "Erase entire disk" option is a good choice if you are unsure).

Confirm Partitioning

This is the point of no return, so the Ubuntu installer reviews the partitioning choices you've made and asks you to confirm them. If you say Yes here, it will repartition your machine, possibly destroying existing data if you've chosen to remove or replace an existing partition.

Configure the Time Zone

In this step, you'll need to choose your time zone.

Configure the Clock

The Ubuntu installer needs to know how your clock is configured. Most computers have a clock that's set to the local time, but Ubuntu lets you configure it so it's set to Coordinated Universal Time (UTC). The choice here is not terribly important unless you plan to dual-boot between Ubuntu and Windows, in which case you should not set the clock to UTC.

Set Up Users and Passwords

At this point, you'll be able to add a user to the system. If you are in expert mode, you'll have some additional options, including the ability to create a password for the root user (by default, Ubuntu expects you to use the sudo command to use programs that require root privileges).

Install the Base System

This step will run without your intervention unless there is a problem. The installer will put a base installation of Ubuntu onto your system at this point. In expert mode, you'll have the opportunity to choose which kernel image to install.

Configure apt

This step is one of those points when it's a good idea to have a network connection, since the installer will try to contact the Ubuntu mirrors to verify that they are reachable. If it can't, it won't add them to the configuration file (/etc/apt/sources.list). In expert mode, you'll be asked some additional questions.

Select and Install Software

This step installs the rest of Ubuntu, including the GNOME (or KDE) desktop, and can take quite a while. Despite the name of the step, you won't be asked to choose which packages are installed. However, you will be prompted to select which video modes to use with the X server.

Copy Remaining Packages to Hard Disk

This step is offered in expert mode and gives you the option to copy 400 MB of packages to your hard drive, which eliminates the need to keep the CD-ROM handy.

Install the Boot Loader on a Hard Disk

This installs the GRUB boot loader on your hard drive. You'll be able to choose the LILO boot loader instead if you are in expert mode. Either LILO or GRUB is capable of booting Ubuntu, but GRUB is more flexible and easier to configure. In expert mode, you'll also be given the opportunity to select a password for your boot loader.

Finish the Installation

This step writes configurations to your new Ubuntu install and reboots you into your new Ubuntu system.

Once you've got Ubuntu up and running, you can log in as the user you created during setup, and start exploring your desktop, whether it be GNOME [Hack #15] or KDE [Hack #16].

Brian Jepson

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required