Software Installation Basics

If the Ubuntu Software Center is a marvel for its beauty and simplicity, the overall Ubuntu software management system is of no lesser merit in what it enables. The Center takes advantage of years and years of previous developments that made it possible, such as the introduction of Debian packages, the apt tool, and software repositories.

Formats of Linux Installation Files

If you visit the web site of a particular Linux application, you may find that it’s available to download in a number of different formats. The program will almost certainly be available as source code—the original human-readable text that the developer created. But it might also be available as a binary or a package file.

Here are the formats by which Linux software is usually distributed:

Source code: Programmers write their software in various programming languages, such as C and C++, and the code that results is known as source code. To make source code usable, it must becompiled into a binary. Because the cornerstone of the Linux philosophy is the sharing of source code, you’ll almost always find the source code of a program available at the developer’s web site. You can then download and compile this on your own system (or, if you’re so inclined, study the source code to further your understanding). Although compiling source code isn’t very hard to do, it’s more convenient to download either a binary version of the program or a package.

Binary files: You might find that ready-made binary files are available at the developer’s web site. In other words, the programmer (or a third party) has taken his or her own source code and, as a service to users of the program, compiled it so that it’s ready for use as soon as it’s downloaded. For example, this is how Linux versions of the Mozilla Foundation software, like Thunderbird and Firefox, are currently distributed if you download them directly from Sometimes binary files come with scripts to help you install them. However, in most cases, you simply place the files in a convenient location on your hard disk and then run them from there.

Self-installing binaries: Some larger programs are made available as self-installing binary files. This comes very close to the way Windows works, because when the file is executed, a GUI-based installation wizard takes you through installation. If you download the standard version of LibreOffice (that is, not a version packaged for a particular system) from the official web site (, for example, you’ll end up with a single 160MB+ file, which you then simply execute from the command line.

Package files: In many cases, you’ll find that a package file of the program is available. In this case, someone has compiled the software files and put them all together in a single, easily transported file. Ubuntu package files end with .deb file extensions, but other Linux distributions use otherpackage formats, such as .rpm (Fedora/Red Hat, SUSE Linux, and Mandriva, among others).

Package Management

Of all the preceding formats, packages are by far the most common and popular in the world of Linux. Ubuntu utilizes packages, as do nearly all other distributions. In fact, the Ubuntu installation DVD-ROM contains hundreds of packages, and its various software repositories contain many thousands.

A well-implemented package management system is able to install programs, upgrade them, and uninstall them, all with just a few keystrokes or clicks of the mouse. It vastly reduces the amount of work required to get new software onto your system and makes maintenance tasks such as upgrading software easy too.

It’s important to understand what an Ubuntu package file actually is and what it contains. With Windows, an installation .exe file is effectively a piece of software combined with an archive of files. When you run the executable, it triggers a small program contained within it that then unpacks the contents of the file and installs them to the hard disk.

In contrast, package files used by Ubuntu merely contain the program files along with a handful of configuration scripts to ensure that the software is set up correctly. Package files are useless without the various pieces of software already installed on the system that are used to manipulate them and do the hard work of installing, removing, and querying them. This software is known as the package management system. In the case of Ubuntu, the package management system has two components: dpkg
and apt, which we cover later in this chapter. The Ubuntu Software Center itself is always working with
packages, although you never see them.

The use of a package management system has a number of benefits. The package management system builds its own database, so it knows exactly what programs are installed at any one time. Therefore, you can simply query the database rather than search the applications menu or hard disk. The package system also keeps track of version numbers. This gives the user much more control over the software on the system, and it makes updating easy.

The use of a package management system also means that if a program starts to act strangely, its configuration files can simply be refreshed by using the package manager. There’s no need to uninstallnand reinstall the software, as is so often the case with Windows programs. The clean way in which a package manager uninstalls software makes it very easy to try out, and remove, lots of different softwaremwithout worrying about the stability of your computer.

Dependency Management

One of the key features offered by any package management system is dependency management. Put simply, the package manager ensures that if you install a piece of software, any additional software it relies on to work properly is already present on the system. It the software isn’t present, the package manager must either resolve the situation automatically or ask you what to do. Sometimes the software you want to install might depend on other programs on your system, such as applications that simply add a graphical front end to shell applications, but more often, the dependencies take the form of system libraries. It helps if you realize that not all packages contain software that you, as a user, will make direct use of. Some packages contain nothing but library files—shared pieces of code that are equivalent to .dll files under Windows. The key library on an Ubuntu system is the GNU C Library, without which the Linux kernel couldn’t function, which is provided by the libc6 package. But practically every program has its own needs when it comes to library files, and these requirements must be handled by the package manager.

Dependency management doesn’t just mean adding in packages that a piece of software needs. It might also mean removing packages already present on your system. This might need to happen if they’re incompatible with new software you want to install, something that’s referred to as package conflict. In addition, sometimes you might want to remove a package that other packages rely on, a situation known as reverse dependency. In such a case, the package manager must either stop you from removing that software, to avoid breaking the software that depends on it, or remove the reverse- dependency packages too. In most cases, the package manager asks you what to do.

Software Repositories

As mentioned previously, dpkg and apt take care of package management within Ubuntu. These tools are taken from the Debian distribution of Linux, on which Ubuntu is based.

Debian Package, or dpkg, is the most basic part of the system. It’s used to install and uninstall software, and it can also be used to query any individual software packages. It’s like the manager in a warehouse who is tasked with knowing exactly what boxes have been stored where. The manager doesn’t know where the boxes come from, and he doesn’t know anything about packages outside his warehouse. He just manages the boxes that are delivered to him and that are stored in his warehouse.

dpkg is aware of dependency issues and will refuse to fully install a package if the others it needs aren’t already installed or supplied at the same time. But it doesn’t have the means to fix the situation automatically. This is akin to the warehouse manager’s inability to order more boxes if he needs them. That’s not his job. He’ll just tell you if boxes delivered to him are missing some of their components.

Because of this, there’s an additional layer of software that sits on top of dpkg called the Advanced Packaging Tool, or apt. apt is very sophisticated. Its job is to handle dependency management. Try to install some software using apt, and any dependency issues will be worked out for you.

apt can do this because it’s designed to work with software repositories. Users can search and install packages from these collections of software. More often than not, these software repositories are online, but that’s not always the case. The DVD supplied with this book contains the base installation software repository, for example.

It’s important to note that apt relies on the dpkg system to take care of the actual installation. Effectively, dpkg and apt are two sides of the same coin.

As you might have realized, the package management system means that Linux software installation/removal is a fundamentally different proposition than handling software under Windows or Mac OS X. If you want to install new software, the first place to look is the Ubuntu software repositories. The online repositories contain most of the popular software available for Linux right now, all packaged for installation under Ubuntu.

It’s comparatively rare for an Ubuntu user to visit a web site and download a package file for installation, as is often the case for Windows users. The only time this normally happens is if you can’t find what you’re looking for in the official repositories. Staying within the standard repositories makes problems less likely.

Out of the box, Ubuntu comes with a couple of software repositories already configured. These allow you to download new software and also update the system online. Ubuntu software repositories are subdivided into various categories and components.

Categories of Repositories

Regardless of whether they’re online or on a CD/DVD, Ubuntu repositories are strictly categorized according to the type of software they contain:

Main Distribution: This repository contains the packages that are required to install Ubuntu. This repository usually takes its name from the code name for the release and is activated by default. For Ubuntu 11.04, the main distribution repository is called natty, after the code name for the 11.04 release (Natty Narwhal). In the previous release, the main distribution repository was called maverick, and the next version (Oneiric Ocelot) will have the oneiric repository. (For more details on Ubuntu code names, see

Security Updates: Sometimes security flaws are so serious that they need to be fixed immediately, within as little as 24 hours of being discovered. If so, the packages concerned will be placed on this server. The Security Updates server isn’t about new versions or functionality. It’s about fixing security holes rapidly. This repository is also activated by default and is named after the main release title. In the case of 11.04, this means the Security Updates repository is called natty-security.

Recommended Updates: This repository contains newer versions of the packages in the Main Distribution repository. Like Security Updates, this category also offers bug fixes, but these fixes aren’t urgent and are often more substantial than quick patches to fix a critical bug. It is named after the main release title. In the case of 11.04, it is called natty-updates.

Proposed Updates: This is a special category by which testing releases of updates are made available. There’s no reason to use this category unless you want to test packages and help fix bugs (for more information, see HelpingWithBugs). This category is not activated by default. It is named after the main release title, so in the case of 11.04 is named natty-proposed.

Unsupported (Backport) Updates: The Backports server allows access to software that’s intended to go into the next version of Ubuntu but has been packaged for the current version. This software might not have been tested thoroughly and so is suitable only for neophiliacs or those who absolutely need the latest version (perhaps because of a vital new feature it offers). This category is not activated by default. As before, its name is derived from the main release, so in the case of 11.04 is called natty-backports.

Repository Components

In addition to the categories listed in the previous section, the Ubuntu repositories are further split into components (effectively subsections) according to how essential the software is to a basic Ubuntu installation or the license that the software uses. Here are the components under which software is typically filed within a repository (although you should note that a third-party repository might have its own names for repository components, and they might vary from this list):

Main: This section contains nearly all the software that’s featured in a basic Ubuntu installation. As such, it’s all free software, and every package is supported by Canonical, the company that oversees the Ubuntu project. That means that updates are frequently provided to fix security holes or simply to keep up with latest releases.

Universe: This section might be referred to as “the rest,” because it contains the majority of free software available at the present time. Much of it is borrowed from the massive Debian software repository, although the packages are sometimes tweaked to work correctly under Ubuntu before being made available (some people who create Debian packages also create the Ubuntu equivalents). Unlike Main and Restricted, the Universe section is not officially supported by the Ubuntu project, which means there’s no guarantee that security flaws will be fixed. Nor is there any guarantee of updates, although most packages are usually updated regularly.

Restricted: Although Ubuntu is mostly free software, it must include some drivers released only in binary form (that is, proprietary) and that, therefore, have license agreements that are not compatible with the goals of free software. That’s what you’ll find in this section. Some hardware simply won’t work fully without software from the Restricted section.

Multiverse: As with the Restricted section, here you’ll find software that’s released under a software license incompatible with either the letter or spirit of free software. However, unlike the software in the Restricted section, none of the software in Multiverse is considered essential to a default Ubuntu installation.

Source Code: This section contains source code packages. Unless you’re a software developer or are thinking of becoming one, this section won’t be of much interest.

Partner: This repository contains software offered by vendors who have partnered with Canonical, the company that sponsors the development of Ubuntu. This software is usually commercial and proprietary (that is, not open source). The precise list of software packages offered differs from release to release, but past examples have included virus scanners, media players, and commercial server software.