5.2. Configuring APT for RPM
Generally, if you want to configure apt for RPM, you'll need to download and install it, along with any dependencies. You may also want to install one of the front-end apt package management systems described in Chapter 4, such as aptitude or the Synaptic Package Manager.
If there's one or more apt repositories available for your distribution, you'll want to configure your computer to take updates from that system. Naturally, because there are fewer apt repositories for RPM-based distributions, chances are good that updates will take longer. It is then more important to configure a local apt repository.
If remote apt repositories are available, you can create a local mirror using the techniques described in Chapter 3, "SUSE's Update Systems and rsync Mirrors," and Chapter 4. Otherwise, you may need to create your own apt repositories based on regular package repositories available for your preferred distribution.
5.2.1. Package Options
If you're planning to use apt to manage patches on your system, you may have had trouble in the past with RPM dependency hell, as noted earlier. When you install apt, you may have to deal with the RPM dependency problem one more time.
The packages required for apt vary by RPM-based distribution. Some trial and error may be required. If you're working with Fedora Linux 3 or later, apt RPMs may be downloaded from your favorite repository mirror, in the Extras directory. Related packages are listed in Table 5-1.
Naturally, each of these RPMs includes dependencies. Until you've installed and configured at least the basic apt RPM package and encounter dependencies, you'll have to resolve them the old-fashioned way: with patience and hard work.
If you're using an older (pre-10.0) version of SUSE Linux, navigate to ftp://ftp.gwdg.de/pub/linux/suse/apt/SuSE/9.3-i386/RPMS.suser-rbos/ for apt packages. The packages listed on this server may require other RPMs already available on the SUSE installation CDs/DVD.
5.2.2. Configuring apt
Next, you can modify the apt configuration files to meet your needs. As with Debian Linux, these files are stored in the /etc/apt directory. While apt relies mainly on the sources.list file to find repositories, the locations and details of other apt configuration files vary.
Ideally, you'll have access to some local or nearby network repository and can point your sources.list file to the appropriate URL. You can mirror the apt repository for other computers on your network, and patch management will be a breeze! Well, almost. I hope you're all so fortunate.
5.2.3. Selecting Sources
You might be surprised at the number of apt repositories available for RPM-based distributions. Unless your distribution uses apt as its primary means of updates, there are usually fewer apt repositories available, and they are likely to be further away from your network.
When selecting a source for an apt repository, check the documentation associated with your distribution. You may be pleasantly surprised. For example, one of the rebuilds of Red Hat Enterprise Linux 4, Lineox, uses apt by default for their updates (www.lineox.com).
Lineox also maintains yum repositories for its 64-bit distribution, which avoids the previously described mixed-architecture problem associated with apt. Because there are a number of third parties who create apt repositories for the popular RPM distributions, you may end up associating your sources.list file with several different repositories.
5.2.4. Configuring apt for Fedora Linux
Red Hat has stated that Fedora Linux is the development platform for its enterprise distribution. As such, Fedora Linux evolves quickly. New versions are released every four to eight months, and the patch management tools may change just as frequently. As of this writing, there is no single collection of apt repositories and mirrors for Fedora Linux. After all, because this distribution uses yum by default for patch management, Fedora developers do not maintain apt repositories. One incomplete list of apt repositories is available from www.fedora.us/mirrorlists.
If you're using Fedora Core 4 or later, you'll need to point your apt sources to a third-party repository, such as apt.freshrpms.net. This Web site includes links with apt (and yum) downloads for the released versions of Fedora Core, Yellowdog Linux, as well as several Red Hat Linux versions. More importantly, it includes a list of mirrors you can use in your /etc/apt/sources.list configuration file.
Alternatively, you may find apt repositories for the latest Fedora Core and Red Hat Enterprise Linux (including rebuild) distributions at http://rpmforge.net. While detailed information was not available as of this writing, the RPM Forge team includes luminaries who've created third-party repositories, including Dag Wieers, Matthias Saou, and Dries Verachtert.
If available third-party repositories are not to your satisfaction, continue reading. Later in this chapter, you'll learn how you can create a dedicated repository for your distribution.
After you've configured repositories, you can run all the commands you've read about in Chapter 4. But there is more. If you're familiar with Red Hat or Fedora, you know that packages are organized in groups. You can find a list of groups on your chosen repositories with the following command:
If you ever want to install all the packages in a specific group, make a note of the group name. If you want a list of packages associated with a group, you can find it in the comps.xml file described earlier. For standard 32-bit systems, you can find this file in the /usr/share/comps/i386 directory.
For example, the ftp-server package group includes one package, vsftpd, which is the default FTP server for Fedora. But the comps.xml file may be confusing. You can cut through the clutter by listing the members of this group with the following command:
apt-cache showgroup ftp-server
You can install all packages in this group with the following command:
apt-get groupinstall ftp-server
The packages, along with any dependencies, are installed just as they are when you run the apt-get command on a Debian system. Packages that are marked as optional in comps.xml are not included. You can also remove package groups along with dependencies. For example, if you want to remove the office package group, run the following command:
apt-get groupremove office
As you can see in Figure 5-1, this command specifies the packages to be removed, upgraded, and installed, as well as the results in disk space on your system.
Figure 5-1. Removing a package group
The aforementioned apt-cache and apt-get commands do not work with Debian Linux. They don't even work with the Lineox rebuild of Red Hat Enterprise Linux 4. However, all but the apt-get mirror-select command works with SUSE Linux Professional. Just remember, SUSE organizes package groups differently from Fedora or Red Hat.
However, dependencies that may have been installed with the original installation are not removed. Unlike the result with Debian Linux, the dependencies remain on the computer. That is one flaw with apt on RPM-based distributions that still exists today.
Synaptic with Fedora
You can install the Synaptic Package Manager described in Chapter 4. To do so, run the apt-get install synaptic command. After you do, it should be accessible in the GUI if you click Main Menu -> System Settings -> More System Settings -> Synaptic Package Manager. Alternatively, just run synaptic from a GUI command line interface. As you can see in Figure 5-2, the result is a bit different from what you saw in Chapter 4. By default, the left pane includes the different Fedora package groups.
Figure 5-2. Removing a package group
There is one major difference. In the Fedora version of the Synaptic Package Manager, you can select Edit -> Mark Packages by Task (or Ctrl+G), which opens the window shown in Figure 5-3. If you've run the apt-cache groupnames command described earlier, you'll recognize this window as a list of package groups that you can install with the apt-get groupinstall groupname command. You can mark the group of your choice; Synaptic configures installation of that group, along with any dependencies.
Figure 5-3. Marking package groups for installation
Then you can Apply Marked Changes with Ctrl+P or the Edit -> Apply Marked Changes command. This action opens a window similar to Figure 5-4, where you can and should check those packages that may be installed, upgraded, or removed, to make sure your needs are addressed. You should also make sure that any packages which are to be removed will not alter the basic configuration of your system. When you're satisfied, click Apply. Synaptic begins the process of downloading and then installing the selected packages, just as you've witnessed for Debian Linux in Chapter 4.
Figure 5-4. Confirming changes
When all required packages are downloaded, Synaptic uses the appropriate apt commands to install and or apply them as upgrades to existing packages. You can monitor the progress of the download, as shown in Figure 5-5. After the changes are complete, you can exit the Synaptic Package Manager.
Figure 5-5. Synaptic progress
5.2.5. Configuring apt for SUSE Linux
The SUSE Linux implementation of apt is similar to that for Fedora. While the packages you install differ, the results are similar in terms of the commands that you can run, as well as the way Synaptic interacts with your system. Naturally, you'll need apt-enabled mirrors configured for your version of SUSE Linux.
As with Fedora Linux, you'll have to configure the mirrors yourself. You could use the directives in the default /etc/apt/sources.list file:
rpm ftp://mirrors.mathematik.uni-bielefeld.de/pub/linux/suse/apt/ SuSE/10.0-i386 base update security rpmkeys rpm ftp://ftp.gwdg.de/pub/linux/suse/apt/ SuSE/10.0-i386 base update security rpmkeys
This would connect your computer to the base repository, as well as updates and security-related changes for your distribution.
If you're into experiments, you could use the sample /etc/apt/sources.list file available from ftp.gwdg.de. For SUSE Linux Professional 10.0, you can find this file in the following subdirectory: pub/linux/suse/apt/SuSE/10.0-i386/examples/. This file includes the following very long command line:
rpm file:/ftp/pub/linux/suse/apt SuSE/10.0-i386 suser-guru packman packman-i686 kernel-of-the-day suse-projects rpmkeys base java update-drpm update-prpm update extra kde gnome mozilla openoffice samba3 suser-agirardet suser-rbos suser-crauch suser-jengelh suser-gbv usr-local-bin suser-tcousin suser-scorot suser-scrute suser-jogley kraxel wine suse-people kde3-stable kde-unstable security-prpm security
Now that SUSE has committed to support apt, at least in SUSE 10.0 the number of alternative repositories will soon hopefully increase. The one alternative apt repository available as of this writing is ftp://opensuse.linux.co.nz.
As you've probably observed, the commands in /etc/apt/sources.list follows a specific format:
Package type / URL / Subdirectory / Repository section / Repository section ...
In this case, the package type is rpm; the URL is the FTP site shown; the repositories are stored in the SuSE/10.0-i386 subdirectory. If you want to create your own repository, you'll need to learn more. Navigate to the subdirectory on the noted URL, in this case, ftp://ftp.gwdg.de/pub/linux/suse/apt/SuSE/10.0-i386/. You'll find subdirectories for each of the noted repository sections.
You normally won't configure apt to acquire updates from all sections. In fact, several sections may have no files. Many of these repositories include test packages from specific developers; some of them are SUSE employees.
Therefore, you might want to limit the repository sections in your /etc/apt/sources.list to some of those suggested in Table 5-2. (These sections are subject to change; you might not see every section shown in the Table in the repository list for SUSE 10.0.) You might want to review all sections; SUSE might include important packages in other sections.
If your concern is obtaining stable updates, ignore this list. Accept the default /etc/apt/sources.list file.
After you've configured this file, you can use the Synaptic Package Manager to download and install the latest updates, using these steps:
After Synaptic completes the update process, the job isn't done. You may need to update a number of SUSE configuration files in the /etc/syconfig directory. You can do so after an apt-based update with the following command:
YaST Online Update runs the SuSEconfig command automatically after downloading and installing new packages.
Alternatively, you can use the specialty apt commands associated with Fedora Linux to manage packages by groups. You may have read about the following commands in the previous section:
apt-cache groupnames apt-cache showgroup groupname apt-get groupinstall groupname apt-get groupremove groupname
Be careful when you run these commands. Don't just blindly accept the defaults! The effects of the apt-get groupremove command, for instance, may be unpredictable. For example, I tried to run the following command on my system:
apt-get groupremove Games-9.2-62.noarch
This command proposed that I accept the removal of key packages, such as evolution, gnome-desktop, and kdebase3. If I had accepted the defaults, I probably would have had to restore the files associated with these packages from backup in order to run the KDE Desktop Environment.
5.2.6. Configuring apt for a Red Hat Rebuild
There is at least one rebuild of Red Hat Enterprise Linux 4 that relies primarily on apt for updates. Lineox is somewhat unique for a rebuild distribution of Red Hat Enterprise Linux. It is backed and supported by a separate company in Finland and supports free and paid updates using apt-based tools. Naturally, apt packages are already installed by default on this rebuild distribution. (Lineox includes yum repositories for its 64-bit distribution versions.)
There are other Red Hat rebuilds that have apt repositories available, such as CentOS 4. For more information, see www.caosity.org.
Lineox supports a variety of mirrors worldwide. While the list is not extensive, it makes it possible to use apt to keep this rebuild up to date. The default version of Lineox's /etc/apt/source.list includes the following URLs:
rpm http://www.raimokoski.com/ pub/lineox/4.0/updates/i386 updates rpm http://www.raimokoski.com/ pub/lineox/4.0/i386/os/Lineox os
The mirrors available for Lineox are complete; in other words, you can substitute the base URL of the mirror closest to you and use them to manage patches on your system. For example, the Lineox mirror in the U.S. is located at the Georgia Institute of Technology, at ftp://ftp.gtlib.cc.gatech.edu/. If you're located in the U.S., you should be able to substitute that URL for http://www.raimoski.com/.
The Lineox apt configuration files include suggestions for other repositories. We describe them here in some detail, as they may be useful for any Red Hat or Fedora distribution. These suggestions are located in files in the /etc/apt/sources.list.d directory and are listed in the following sections. All the suggested repositories in this directory are "commented out." You'll need to remove the comment character (#) if the repository noted is suitable for connections to your network.
While you should be able to connect to mirrors customized for your distribution, don't just change version numbers from the configuration files. Check the mirrors for yourself. Make sure that they contain the repositories that you need.
The repositories described in the following sections may be superseded by those associated with the RPMForge.net project. Check the associated Web sites for the latest information.
You may already be familiar with the repositories available from atrpms.net. The atrpms.list file includes the mirror of these repositories, based in Germany. For example, this file for Lineox 4.0 includes the following link to a Fedora Core 2 repository:
#rpm http://apt.physik.fu-berlin.de fedora/2/en/i386 at-testing
The mirrors listed at http://atrpms.net/mirrors/ are all on the European continent. You should be able to substitute their base URL for http://apt.physik.fu-berlin.de, as shown previously. While the examples in the version of Lineox 4.0 available as of this writing list only Fedora Core 1 and 2; Fedora Core 3 and 4 and Red Hat Enterprise Linux 3 and 4 repositories are also available. If later versions of these distributions have been released, check the mirror of your choice. You may be pleasantly surprised.
There are four different directories available from this repository: at-good, at-stable, at-testing, and at-bleeding. They are sequentially inclusive; in other words, all packages in the at-stable directory are included in the at-good directory; all packages in the at-good directory are included in the at-testing directory; all packages in the at-testing directory are included in the at-bleeding directory. Therefore, you do not need to specify more than one directory when you specify an atrpms.net repository. For example, if you do not want to include any unstable packages for a Fedora Core 4 repository, you could substitute the following line in the atrpms.list file:
rpm http://apt.physik.fu-berlin.de fedora/4/en/i386 at-good
As noted earlier, Dag Wieers is a prominent developer who has built a number of binary packages that might otherwise be unavailable. For example, the still popular pine email reader is no longer included with the standard installation packages for some distributions, including Red Hat Enterprise Linux. You can find a pine RPM customized for Red Hat Enterprise Linux 3 and 4 in the associated dag.list repository.
For example, the following example points to an apt repository for Red Hat Enterprise Linux 3 packages:
rpm http://apt.sw.be redhat/el3/en/i386 dag
As documented at http://dag.wieers.com/home-made/apt/FAQ.php#B, separate repositories are available for Red Hat Enterprise Linux 2.1 and 4 at
rpm http://apt.sw.be redhat/el4/en/i386 dag rpm http://apt.sw.be redhat/el2.1/en/i386 dag
freshrpms.list and os.list
As noted earlier, the developers behind freshrpms.net, including Matthias Saou, have created their own apt repositories. You can find a list of mirrors at apt.freshrpms.net. There may be additional apt mirrors available from the list at freshrpms.net/mirrors. I was able to find a suitable repository at one of these mirrors; I've added the following line to my version of /etc/apt/sources.list:
rpm http://ayo.us5.freshrpms.net fedora/linux/4/i386 base core extras updates
Different apt repositories are listed in the freshrpms.list and os.list files in the /etc/apt/sources.list.d directory. But these files do not include a complete list of repositories available from freshrpms.net. As you can see from the Irish mirror at http://ayo.ie.freshrpms.net/fedora/linux/4/i386/, there is a substantial number of ayo repository directories available.
Two developers from Germany, Rudolf Kastl and Dennis Huschens, have created their own repositories for some Red Hat and Fedora Linux updates. For more information, see newrpms.sunsite.dk. As of this writing, their repositories include only untested packages and are not being maintained.