Apt on Suse Linux

Package Mix

By Mirko Albrecht

Debian's Advanced Packaging Tool, Apt, is often regarded as the ultimate choice for convenient package management in Linux. But what if you don't use Debian? This article describes how you can use the powerful Apt package management tool with RPM-based Linux distributions.

Advanced Packaging Tool, Apt, is a simple and powerful system for installing software on Debian systems. Debian-specific packages are available in both binary and source code versions, and users can access a centrally managed repository to update their complete software collection via the Internet. Package management tools automatically handle any dependencies that arise during the update.

Now, users with RPM-based distributions can also harness the convenience of Debian's package management tools. Using a Suse system as an example, this article will show you how to manage your software conveniently and reliably with Apt for RPM.

Installation and Configuration

If you intend to use Apt with Suse, you will need a working broadband Internet connection, as the tool downloads the packages for the install off the Internet. Before you can do so, users of Suse 9.2 first need to install the two packages, apt-0.5.15cnc6-rb.suse092.6.i586.rpm and apt-libs-0.5.15cnc6-rb.suse092.6.i586.rpm. Both packages are available from [1].

If you prefer to use the Apt GUI, make sure that you install the synaptic-0.55.3-0.suse092.rb1.i586.rpm package too.

After completing this step, you will need to set up a file called sources.list (see "Box 1: Repositories"). This file specifies which repositories you will be using and which you prefer not to use. Repositories as Apt understands them are collections of software packages - typically sorted by category. The sources.list file below /etc/apt allows you to specify the repositories you will be using to update your system. More cautious users will tend to avoid adding branches such as kde-unstable or kernel-of-the-day to their source lists. Also, the packages from the usr-local-bin repository should be handled with caution. And if you are happy with the GUI as it is, it makes sense to remove the X.org branch.

Figure 1: The "apt -s upgrade" command allows you to check the results before updating.

Working with root privileges, open the /etc/apt/apt.conf.d/gpg-checker.conf file and replace the value of true for GPG::CHECK with a value of false. This tells Apt to accept unsigned packages. If you do not do this, a large number of packages will fail to load because they lack a signature.

Cautious users will prefer to avoid automatic kernel updates. To avoid automatic kernel updates, open the /etc/apt/apt.conf.d/apt.conf file and add the following to the RPM section for a kernel 2.6 system:

Hold {"kernel-default"; U
 "kernel-source"; };

If you still use a kernel 2.4 system, you need the following line instead:

Hold {"k_deflt"; U
"kernel-source"; };

If you prefer to avoid text file based configuration chores, you can use the Synaptic GUI to modify the sources list; select Settings | Package sources to do so.

Using the Console

Apt has powerful features for modifying your computer's software collection. However, it is not easy to understand how it works. We will be concentrating on the options available to users with a good working knowledge of YaST and the YOU online update tool. More inquisitive readers might like to check out the Apt manpages for a more in-depth look at Apt.

After configuring a sources.list below /etc/apt, you can enter the apt-get update command in a shell. The command tests the software structure, locates current data as specified in your sources.list, and displays your update options.

Type apt-get install packagename or apt-get remove packagename at the console to install or remove the named package respectively. Bolder users might be tempted to update the complete system using apt-get upgrade. Do not attempt an update of this kind unless you are sure of the outcome. Badly informed or incautious decisions may lead to you installing from a repository with questionable or unstable packages. Make sure you run apt-get -s upgrade first to check which packages Apt is thinking of updating. If, on the other hand, you simply need to install official security packages or software from the kde-stable tree, the fast command line approach is just what the doctor ordered. If you prefer to delve deeper into the subject, you should consider using the Synaptic GUI tool.

Figure 2: Synaptic is a comfortable GUI front-end for Apt.

Using Synaptic

If you have not already installed the synaptic-0.55.3-0.suse092.rb1.i586.rpm package, do so as the root user by typing apt-get install synaptic. This assumes that the Gtk toolkit is installed on your machine, or that your sources.list has an entry for the base repository. In the latter case, Apt may offer to install the other required packages.

After completing the install, you should find a link to the program below System | Configuration | Synaptic Package Manager, assuming you have a recent KDE version with so-called vFolder technology. After entering your root password, note that the left-hand side of the program window is subdivided into sections in a similar way to YaST. Synaptic lists the program packages on the right. A green checkbox means the program has already been installed. A checkbox with an asterisk means a more recent version is available. Check out Help | Icon Legends.

Box 1: Repositories

The repository always has one path for binary files (RPMS.name) and a second path for the program source code (SRPMS.name). Only the former is important for a running system, but you do need to specify the SRPMS path if you wish to install the source files. An example of a repository list is available for downloading from [2]; you can copy the file to /etc/apt and rename it to sources.list.

A fairly conservative sources.list, which does not update every available program to a more recent version number, might look like this:

#
# Repository created by: aptate (version 0.69.0)
# At: Fri Jan 28 17:16:18 MET 2005
# More info about aptate at: http://apt4rpm.sourceforge.net
#
rpm ftp://ftp.gwdg.de/pub/linux/U
suse/apt suse/9.2-i386rpmkeys U
base funktronics update misc U
mozilla suser-rbossuser-guru U
suser-gbv packman packman-i686U
wine suse-projects U
kde3-stable security

If you prefer, you can browse the numerous repositories yourself and add the ones that suit your fancy.

Installing or updating a package follows a similar pattern to YaST. Select the required package and choose Mark for installation or Mark for upgrade in the drop-down menu. Then click on Apply in the toolbar to launch into the download and install procedure. If you simply want to check for new versions (apt-get update), select Reload in the toolbar.

The Settings menu has a number of fairly self-explanatory configuration options. You might like to keep track of which packages come from which repository; to do so, additionally select the Components column in the Columns and Fonts tab below Settings | Configuration. If multiple versions of a package are available from various repositories, you can select Package | Force version to install the required package. The Package | Lock version option helps you avoid inadvertently updating a package.

Box 2: Apt for Older Suse Versions

Apt for Suse not only works on the latest version of the popular operating system, Version 9.2, but also on any Suse Linux version higher than 7.3. The AMD64 architecture is supported by Suse 9.x or later.

Packages for apt, apt-libs and synaptic are available from [1]. Simply replace version number 9.2 in the URL with the version that matches your Suse release. To run Apt on pre 8.2 Suse versions, you will additionally need the lua-5.0.2-rb1.i586.rpm package.

You will also notice a few differences from running Apt on Suse 9.x. For example, Suse 7.3 through 8.1 all store the apt.conf file directly below /etc/apt/.

The packages are grouped by category in the left-hand panel of the Synaptic window to give users a better overview. Below the list are some buttons that you can click to change the display. The Status option allows you to sort installed or available program packages based on selected criteria.

Practical

As mentioned earlier, a complete update of a system is not recommended unless you already have good working knowledge of Apt. Concentrate on security updates via the security repository and on updating specific packages.

Let's assume you are still running Suse 9.0 or 9.1, and are a bit scared of a big upgrade. Despite this, you would really like to update to the latest version of the KDE desktop, as you have read all about the many improvements and enhancements.

The manual installation using the Suse packages nearly drove you to distraction because it left a lot of unresolved dependencies. Now you can search for "kde" in Synaptic. The search gives you a list of packages you need to install and update. All you need to do is to select the packages you want to update. When you launch into the upgrade, Apt will automatically handle any removed or recently introduced KDE packages and resolve all dependencies.

The approach is similar if you have the current Suse 9.2 version but are missing some important multimedia components because Novell/Suse does not include them on the installation media for licensing reasons. Previously, users had to download these packages from the website [3] and then install the packages. Sometimes this meant poring over forums to discover the right order for the package installation. However, if you add packman and packman-i686 to your sources.list, installing Xine or MPlayer & Co. is very easy.

Tips and Tricks

Apt may make it easier to install software, but you may still appreciate some tips on the secure use of the package management system.

Before you launch into a major upgrade, check out which new packages have been released. The Freshrpms site at [4] is an ideal place to check for packages. To locate the right page, add #suse92 or #suse73 to the URL, depending on the version you use.

Occasionally, an installation attempt for a package like abc will fail with a message that tells you paket-xyz.so.2 requires abc. You can tell Apt to look for the missing package with paket-xyz.so.2 by entering apt-get install abc paket-xyz.so.2.

The apt-iselect tool combines the functionality of apt-cache search and apt-get install to give you a more user-friendly console-based approach. You can install the tool from the suser-oc2pus repository by typing apt install apt-iselect.

Figure 3: apt-iselect quickly finds all the packages that match a specific keyword.

Entering apt-iselect libgnutls-extra.so.11, for example, tells you that the file you requested is located in the gnutls package. You can view details of the current package (checksum, additional dependencies, description, filenames, file size, etc.) and even install the file if you so desire. This is also a good way of finding out what kind of packages are available for a keyword such as, say, "chess" (Figure 3).

When you need to remove a package, remember that the typical apt-get remove packagename will only remove the program; it will not remove any packages installed to resolve dependencies. However, apt-get -D remove packagename allows you to ditch these packages too.

You'll find a HOWTO for Apt on Suse at [5], along with a comprehensive collection of other HOWTOs on running Apt with RPM-based distributions.

Table 1: Major Console Commands
apt-get updateRe-parse the available software repositories
apt-get upgradeAutomatically upgrade all available and installed packages
apt-get -s upgradeChecks the scope of the planned upgrade
apt-get -s installChecks the scope of the planned installation
apt-get install packagenameInstalls a package (incl. dependencies)
apt-get remove packagenameRemoves a package

Conclusions

It is not difficult to set up an Apt system on Suse, and the configuration steps are not too time-consuming. The excellent, and powerful, Synaptic GUI front-end gives newcomers the simple tool they need to get working with Apt. Complete system updates with Apt require more experience due to the decentralized approach to repository organization. If in doubt, never change a running system.

Apt is not restricted to Suse users. The tool is available for most major RPM-based, commercial distributions. The installation and configuration are very similar to the steps described in this article, although the number of repositories may vary from distribution to distribution. Check out [6] and [7] for more details.

INFO

[1] Apt for RPM: http://ftp.gwdg.de/pub/linux/suse/apt/suse/9.2-i386/RPMS.suser-rbos

[2] Sample sources.list file: http://ftp.gwdg.de/pub/linux/suse/apt/suse/9.2-i386/examples/

[3] PackMan: http://packman.links2linux.org/

[4] Freshrpms: http://linux01.gwdg.de/apt4rpm/freshrpms.html

[5] Apt for Suse: http://linux01.gwdg.de/apt4rpm/apt4suse.html

[6] Apt for Red Hat: http://apt.42h.de/index.en.shtml

[7] Apt4rpm: http://apt4rpm.sourceforge.net/