Linux 101: Simplify your life with Linux package managers

Package managers, which are included in many Linux distributions, can simplify the overall decision making process and save you time and frustration.
Written by Jaqui Greenlees, Contributor

Package managers, which are included in many Linux distributions, can simplify the overall decision making process and save you time and frustration.

There are two major package manager systems available for Linux:

  1. Debian's apt based .deb system
  2. Red Hat's rpm based .rpm system

Mandrivia uses a tool called urpmi, which is only a customized version of rpm. (The first rpm system that could work with .bz2 source archives) The options for urpmi and rpm are the same, the command line interface is the same, but the GUI interface is completely different.

Slackware uses .tgz instead of .deb or .rpm, but a .tgz file is a .tar.gz archive, not a binary package. So Slackware is not really using a package manager, instead it's building from sources. (In this, Slackware is one of the few distributions that remains close to the original UNIX model, where every install is a custom compile for the hardware being used).

What benefits are there to using package managers?
Package managers make it relatively simple to install or remove software from the system. They also handle the addition to ld (dynamic loader) the library paths of the new software, and the removal of the path when uninstalling it.

What drawbacks are there?
With package managers, regardless of which one, you have one major weakness--the command line interface. That weakness being: you must know the exact name of the package to install it or remove it through the command line interface. This does not show up in the GUI versions, as the GUI adds convenient browse packages functionality.

Should they be used?
For most people, yes, the convenience and ease of use is worth the loss of control.

What loss of control? When you build software from sources you have absolute and total control over which features are enabled, what path's it will be using and where it will install. When using a package manager you lose most of these controllable options. You can choose where it will install by passing special options through the command line interface, but this does affect the paths and may break the application until you edit the config files to point to the right location.

Working with Mandriva'sDrakx versionof urmpi
I was going to cover RPM package managers using Red Hat's Fedora, but the same problems that originally turned me off of using Red Hat's products showed up with Fedora Core 4--some six years after I last looked at Red Hat's products. (See my blog entry, My Misadventures with Fedora Core 4 for details on this).

This whole process is accessed in the Software Management section of the Mandriva Control Center. (Star button on Taskbar | System, Configuration | Configure Your Computer) This Control Center will allow full control of every aspect of your system, including hardware changes.

Adding sources
This is also called adding media, as most commonly, sources for packages are on a CDROM or DVD.

Mandriva has made this an extremely simple process; they divided the Package Management into four different tools, one of which is the Sources Control, called Media Manager. This is a perfectly simple tool, you only have to click the button that is labeled Add then pick the type of source (updates or distribution sources), then pick a mirror site from the list presented to you.

You do have to do this twice, once for updates then one for adding the online repository of software available.

During the add process the tool downloads a file for each source type. With distribution sources, this is two files, Main and Contrib hdlist.cz, which contain a listing of available packages.

Once both an update source and a Distribution source have been added, You exit the Media Manager by clicking the OK button.

Installing updates
This section of the tool is Called Software Packages Update. This also is an extremely simple tool to work with, the default is to list security updates. Right at the top of the listing is a small check box, labeled All. What a concept, click once and select every security update and then you can make a choice to view and install bug fix updates and regular updates or to install the security updates. (Recommended; I just did a fresh, clean install today, and security updates was 500 MB in size).

To actually install them, click the button labeled install in the bottom left corner of the window.

When you finish installing a section of updates, the list will be empty. By checking the next box for update types the listing with regenerate itself. The actual process is the same for each type of updates.

To Exit, click the OK button.

Installing software
This tool, properly named Software Packages Installation, is again very simple to work with. However, if you are completely new to Linux, then this one will take quite some time. The full mirror site for Mandriva, single version only, is over 200GB including the ISO images; this means that there is approximately 60 GB of packages in the listing available. And because a package averages under 1 MB, that is a lot of software to pick from.

Mandriva gives you three options for browsing the available software (available meaning it is not already installed), including: Their "Choices", an Alphabetical Listing of everything, or by grouping by subject. If you want to see what is available, and learn what each does, then use the Alphabetical listing of all packages. If you want to work with a smaller set, but still see all, use the grouping. For the smallest number of options, use the default Mandriva's Choices. If you know what the package name contains, you can search for all packages containing that. [ For example, search for any portion of Mozilla, and every bit of Mozilla software will be listed under Search results.)

To browse the available packages, when you highlight a package in the list, the right side of the window will display some information about the package, including what it does, file size, and version number. You can get maximum information by clicking on the tab right above that pane to display it, which will add the files installed and the paths to the files to the listing.

As with installing updates, clicking the check box will select a package for installation. When you have selected all that you want to install, click the install button. To exit the tool, click the Quit button.

Removing software
This is almost identical to the installing software tool, but it only lists the software currently installed on the computer. The only difference is that the bottom left corner button is labeled remove. The usage is exactly the same as with installing software, the end result is reversed.

Using URPMI on the command line
This is most commonly done when one of two conditions are met.

  1. The software is not in the listing from the Distribution.
  2. There were errors during installation. (If this is the case, unless you KNOW for sure that the package is not corrupted, do not use the command line interface to force installation.)

The usage for urpmi is quite simple for installing:

urpmi name of package to be installed.rpm

There are a number of switch options available to urpmi--type in the following to display the options:

urmpi -h or urpmi --help

If you are installing a package that errors, and you KNOW it is not corrupt, then the following would install the package:

urpmi --nodeps --force name of package.rpm

This occasionally happens with third party applications where using the command line version and the switches to force installation is needed. It is most definitely not a recommended activity unless there is no other option.

Working with Debian's package manager
Debian has three tools for installing and removing software. Two of which are interfaces to make it easier to work with the foundation command line interface tool apt. Debian based distributions do not require you to set up an update source to finish installing the system for more than a base system, the package manager has had online repository for software and updates configured in it. While this model is considered minimalist, it is also the most complex model for an install. It does give you more control than any but a roll your own distribution, but adds complexity in that the install is now a two stage process rather than a single stage process. A roll your own, like Slakware, Gentoo, or Linux From Scratch, is several orders of magnitude more complex, as you are compiling everything from source code.

Synaptic, the GTK interface for APT
For those who are new to either Linux or Debian, this will be the simplest tool to work with, it is completely a GUI environment for picking the software, installing it, or removing it. It is also the tool for installing updates from a GUI.

Once you find Synaptic in the menu for the GUI you installed (System Submenu of the application menu) and have it running you will notice that the interface is quite clean, five buttons on the toolbar and four menus on the menu bar, with three panels in the body of the window.

The left panel displays Group Headings for software, defaulting to show an alphabetical list of software. The top right panel is the listing of packages. The bottom right panel is a description of whichever package is highlighted in the panel above. The status bar tells you that the default full listing is 15197 packages. One thing that Mandriva does slightly better, is that the listing in Mandriva does NOT include those packages already installed; reducing the stress of figuring out if you actually need to do anything with any one package.

To update software, with security patches, bug fixes or just general upgrades to newer versions, Synaptic has a simple fix, a button to select all updates, which gives you the option of normal operation or smart operation. Going with the latter is simpler; you don't have to know dependencies. Picking any additional packages is simply a matter of clicking the checkbox, and then clicking Mark for Installation. One big irritant is the constant triple checking that Debian does with both the NCurses-based Aptitude and GTK-based Synaptic.

When you are ready to get the software installed / updated / uninstalled in Synaptic, all you have to do is click the apply button, and then the two verification boxes that open afterwards. Then you get to wait while the software is downloaded, and click ok to install, then click through the configuration screens that get tossed up, finally, it's installing / patching / removing the software.

Using Aptitude, the Ncurses-based interface
This is slightly different from Synaptic, in that it lists the packages by installed, not installed, virtual packages, and tasks. To browse the not installed you use the arrow keys to highlight not installed packages then hit the enter key.

Now you have to pick what category you want to view and hit the enter key then highlight main and hit the enter key, now we can finally see some packages. Highlighting a package will display a description in the bottom panel, hitting enter will show more details. Hitting the + key, (not the = key the shift key is required), will mark it for installation. To unselect a package you hit the - key.

When you get tired of reading the list and decide to actually install some software (or you have picked what you want to install), you hit the g key, then hit the g key, then hit the enter key. (Remember the triple checking everything irritant I mentioned with Synaptic?)

Now we wait for the packages to be downloaded and hit enter to start the installation. You will have to hit the enter key a few more times, maybe with a few y keys to mark yes as well for the configuration screens. We are off, the software is installing.

To get the updates / patches with Aptitude, hit the u key. You then get another Category listing on the screen, Updates. Updating would be the only time you would consider installing All. To install ALL, highlight the main submenu and hit the + key, which is the same as installing new packages, then the g key, the g key, and then the enter key.

The command line interface Apt tool
This is only really of use if you know the package name you want to install, if you don't, use either Aptitude or Synaptic instead, they have much nicer interfaces for browsing the list of packages.

If you use the command line interface, it would look like this:

apt-get install packagename

The command apt-get help will display the help page, with a brief description of the available switches / options.

Three interfaces
And there you have it, three interfaces for the same tool. While I may sound like I'm knocking Debian, in reality, I'm poking fun at the person responsible for picking a triple check level of authentication for updates, and package management.

Note: Root access, most commonly through su, is required to install or remove any software so the entire system will be affected, if you do install without using root access you will only change your own account settings.

Editorial standards