Выбрать главу

exclude=kernel

This tells yum to ignore any packages that start with kernel, and should limit the amount of repair work you have to do when a new kernel version is installed.

Using pirut for Software Management

Up to now we've focused solely on command-line utilities that you can use to manage your software. Fedora also offers a number of graphical tools for package management, including pirut, yumex (Yum Extender), and pup. Chapter 2, "Fedora Quick Start" covered pup, so the next two sections cover pirut and yumex. The default graphical package management tool in Fedora is an application named pirut, which cunningly has been renamed Add/Remove Software in the Applications menu. This application replaces kpackage, gnorpm, and xrpm — all of which are no longer provided. Add/Remove Software allows you to select packages arranged in categories and install or remove them.

Launch pirut by clicking the Applications menu on your desktop, and then choose Add/Remove Software. You are asked for the super-user password, and then the package management tool launches with the package-browsing screen, shown in Figure 34.2.

FIGURE 34.2 The initial screen of pirut allows you to browse through packages sorted by groups.

The packages listed in the screen are organized into broad categories, with subcategories listed on the right side. Tick the box next to each subcategory to select the default pack ages for it. The numbers to the bottom of the package group window indicate the number of packages installed on your system and the total number of packages available in the group. In Figure 34.3, you can see that 24 of 78 possible KDE packages have been installed.

FIGURE 34.3 All three main window managers have been selected in this view.

You can see brief information about the subcategories in the box below the selection. Use the Optional Packages button to get access to all the optional packages related to that subcategory. Just check each box to select that package, and click Close to return to the main window. Clicking the Apply button starts the download and installation process, which can take some time, depending on the number of packages you specify.

The pirut tool also enables you to search for specific packages and to browse through a long list of packages. Just tick each package you want to install and click the Apply button. With the search function, pirut remembers each package that you check, so you can search again and again within one session to build up a list of required packages.

Using Yum Extender

Although pirut is the default package management tool for Fedora, development work has also been carried out by the community on a more powerful tool called Yum Extender (yumex). Yum Extender has gained in popularity since its release just over two years ago, mainly because of its friendly user interface and because it is more feature laden than pirut.

Yum Extender is not installed by default, so you need to drop to a command line to run the following command

# yum install yumex

to download and install the Yum Extender package. After yum has finished, you will find an entry under the Applications, System Tools menu. Figure 34.4 shows Yum Extender in action.

FIGURE 34.4 The Yum Extender, making yum even more useful!

Creating a Local yum Repository

When yum is active, it can download a lot of information in the form of RPM headers and files, which can easily eat up bandwidth. If you have three or more Fedora-based machines on a local network, creating a local yum repository can be a good way to conserve bandwidth and save time.

Before you start setting up the repository, you need to have the rsync and createrepo packages installed because you will need them both. Use the command yum install rsync createrepo to make sure that they are installed.

To begin, create a directory that will house your repository. In the example, we use /home/andrew/repo/ as the target directory. Next, find the site you want to mirror (a selection of sites for Fedora can be found at http://fedora.redhat.com/download/mirrors.html). This example uses the UK Mirror service in Canterbury, Kent.

# rsync -avz rsync://rsync.mirrorservice.org/sites/ \

download.fedora.redhat.com/pub/fedora/linux/updates/ \

7/i386/ /home/andrew/repo

rsync then starts to download the files it finds within that directory to /home/andrew/repo. This can take some time. (At the time of writing, about 5GB of updates are available at the previous address.) To ensure that rsync really is working, use Nautilus to navigate to /home/andrew/repo; here you should see a number of packages appearing one after the other.

After you have completed downloading the updates you want, you need to create your repository. This is where the createrepo command comes in.

createrepo is a program designed to quickly and efficiently draw the relevant information from a collection of RPM files to make the metadata yum requires to successfully install or update your currently installed package base.

The command is simply the following:

createrepo /yourtargetdirectoryhere

So, if we were to use the example in the previous section, the syntax would look something like this:

$ createrepo /home/andrew/repo

This would give you the following output:

88/88 — alsa-lib-1.0.6-5.i386.rpm

Saving Primary metadata

Saving file lists metadata

Saving other metadata

This shows that 88 RPMs were cataloged and that the relevant metadata was saved. The program automatically uses the given directory, so you do not have to worry about making several copies of directories.

At this point, you need to move your newly created repository into a subdirectory of /var/www/html/ so that they are accessible via apache and the HTTP protocol. Use this command:

#mv /home/andrew/repo /var/lib/html/

After this is done, you are ready to include your new repository into the /etc/yum.conf file or into its own file under /etc/yum.repo.d. Let's take a look at a typical configuration file for use with yum:

$ cat /etc/yum.repos.d/local.repo

[local]

name=Fedora $releasever - $basearch - Updates

baseurl=http://192.168.0.5/repo

enabled=1

gpgcheck=0

This file is fairly easy to read. Line one is the name of the repository that is passed to yum. The name must be enclosed in square brackets for it to be picked up; in this case, it is simply local. Line two provides the display name for yum to show while it is busy working; for this repository, it uses Fedora $releasever - $basearch - Updates, which prints the release version (in this case 4) and the base architecture (i386). Next comes the base URL, or the primary download point. This is used for yum to scan and download the metadata it needs. The fourth line shows whether this repository is enabled: enabled=0 means it is disabled, and enabled=1 means it is enabled and able to be used. The final line determines whether the RPMs are checked with a GnuPG key. You are advised to obtain the relevant GnuPG key from the original repository to ensure that the packages you install have not been tampered with. Use the following command to import this into the RPM database: