Книга: Fedora™ Unleashed, 2008 edition

Getting Started with yum

Getting Started with yum

As noted earlier, yum acts like a wrapper around rpm, allowing you to work easily with multiple files, both to install and include dependencies. This section introduces you to yum and makes sure you have the basics.

yum

yum is controlled entirely from the command line, so you have to memorize some useful switches to get the most from it. But before you go into yum itself, it is worth while understanding what goes on behind the scenes. How does yum actually work?

It is easiest to think of yum as a software layer that utilizes the rpm command. When you issue commands to yum, it automatically accesses various repositories and down loads the rpm headers that you requested and then queries them with the rpm command. The advantage to this is that all the processing takes place locally, without the need to download the entire RPM itself. Typically, the RPM header makes up a very small portion of the file, which makes it easy to handle and quick to download. yum builds and maintains a local cache of header files, attributed to the supplying repository, and queries this when you use yum. Each time yum is invoked, it checks the repositories for any updates. If any are found, it adds new headers to its cache, thereby making it as up-to-date as possible when you need to use it. Because yum uses rpm, there should be no dependency problems, making it a fast and easy way to install and update software.

yum is primarily controlled by its configuration file, yum.conf, and by the contents of the yum.repos.d directory, both of which can be found in /etc. By default, yum uses the Fedora repositories for updates, but you can easily add more of your own if you want to install other software that is not available from the default repositories. yum is incredibly easy to use, requiring a single command with a switch to update all the software in Fedora.

To get going with yum, you will need to open a terminal. Check that yum is installed and working by simply typing the following:

$ yum

This brings up the usage options for yum and lets you know that you have it installed.

After you have verified that yum is available, you should switch to super user and enter the following command:

# yum check-update

This command initializes yum and asks it to scan the installed RPMs on your machine, scan the repositories for header files, and then start building a cache of header files. After several minutes of frantic activity, yum will have completed its local cache of header files and will be ready for you to start downloading and installing updates and new software.

To perform a quick and easy update of all the software on your system, enter the following command:

# yum update

This asks yum to download header information from the registered repositories, check that against your currently installed packages, and update any that are marked as having new versions. This can take some time, depending on how often you run the command and how many packages you have installed on your system.

When yum has finished downloading the headers and working out dependencies, you are prompted with a list of the packages to be updated or installed and asked to give the go-ahead. Enter y at the command prompt and yum commences downloading the RPM files.

After the download finishes, yum runs the installation and a test to ensure that everything completed correctly. When yum is satisfied that everything is present and correct, you are returned to the command prompt with a freshly updated system.

This is great when you want to update your entire system, but what if you want to update only certain packages? Again, yum can easily take care of this for you. You can identify the package you want and then use yum to check for its availability by using the command shown here:

# yum list <packagename>

This command asks yum to cross-reference the package name with packages registered at the repositories and let you know what is available. You can use wildcards as part of the command to find out which associated packages are available. For instance, the command

# yum list kde*

searches for any packages containing kde, which is useful if you want to selectively update packages. Use the command shown here to update a single package:

# yum update <packagename>

Or use this command to update more than one package at a time:

# yum update <packagename1> <packagename2>

Of course, when yum is processing the required packages, it also solves any dependency issues. You will get the opportunity to see not only the packages that will be updated, but also which packages were required to satisfy dependency issues.

About yum

yum is not developed solely by Red Hat. Instead, Duke University has the honor of being the creator and maintainer of yum and its related technology. In particular, Seth Vidal has spent a lot of time and effort ensuring that yum improves in both speed and functionality. Subscribe to the yum mailing list at https://lists.dulug.duke.edu/mailman/listinfo/yum for the latest information and updates on yum. Seth has now moved across to Red Hat and spends most of his time working on yum!

Оглавление книги


Генерация: 1.084. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз