yum: Updates And Installs Packages

 < Day Day Up > 

yum: Updates And Installs Packages

Early releases of Linux did not include a tool for managing updates. The RPM tool could install or upgrade individual software packages, but it was up to the user to locate the packages and the packages they were dependent on. When Terra Soft produced its Linux distribution for the PowerPC, the company created the Yellow Dog Updater to fill this gap. This program has since been ported to other architectures and distributions. The result, named Yellow Dog Updater, Modified (yum), is included with many Linux distributions. The yum home page is linux.duke.edu/projects/yum and more information is available at apt.freshrpms.net.

Configuring yum

The yum utility is designed to be easy to use. The configuration file, /etc/yum.conf, has two parts: The [main] section contains general settings and the rest of the file holds a list of servers.

The [main] section must be present for yum to function. The cachedir specifies the directory yum uses to store downloaded packages and logfile specifies where yum keeps its log. The amount of information logged is specified by debuglevel, with a value of 10 producing the most information.

 $ cat /etc/yum.conf [main] cachedir=/var/cache/yum debuglevel=2 logfile=/var/log/yum.log pkgpolicy=newest distroverpkg=fedora-release tolerant=1 exactarch=1 ... 

The pkgpolicy defines which version of a software package yum installs; always set it to newest to install the newest version of a package. You can also configure yum to try to install from a specific server, falling back to other servers on failure and ignoring package versions. The distroverpkg specifies which distribution the system is running.

With tolerant set to 1, yum automatically corrects simple command line errors, such as attempting to install a package already on the system. Setting tolerant to 0 turns this feature off. Setting exactarch to 1 causes yum to update packages only with packages of the same architecture preventing an i686 package from replacing an i386 one, for example.

The last sections contain lists of servers holding updates. They are marked with [core], [updates], or other similar labels. Frequently the last section contains updates that are not ready for release and is commented out; do not uncomment it unless you are testing unstable packages. Never uncomment this section on production systems. Each server section contains a name, baseurl, and gpgcheck flag:

 $ cat /etc/yum.conf ... [core] name=Fedora Linux $releasever - $basearch - core baseurl=http://ayo.freshrpms.net/fedora/linux/$releasever/$basearch/core gpgcheck=1 ... 

The name provides a friendly name for the server. The baseurl indicates the location of the server. Set gpgcheck to 1 if you want yum to check the gpg signatures of the packages it downloads. Set it to 0 otherwise. These definitions use two variables: yum sets $basearch to the architecture of the system and $releasever to the version of the release. Refer to the yum.conf man page for more options.

Using yum

Working as root, you can run yum from a command line. Its behavior depends on the options you specify. The update option updates all installed packages: It downloads package headers for installed packages, prompts you to proceed, and downloads and installs the updated packages.

 # yum update Gathering header information file(s) from server(s) Server: Fedora Core 3 - i386 - Base Server: Fedora Core 3 - i386 - Released Updates Finding updated packages Downloading needed headers getting /var/cache/yum/updates-released/headers/pango-0-1.6.07.i386.hdr pango-0-1.6.0-7.i386.hdr  100% |=========================| 6.5 kB 00:00 ... [update: rhn-applet 2.1.4-3.i386] Is this ok [y/N]: y Getting pango-1.6.0-7.i386.rpm pango-1.6.0-7.i386.rpm    100% |=========================| 341 kB 00:06 ... 

You can update individual packages by specifying the names of the packages on the command line following the word update.

To install a new package together with the packages it is dependent on, give the command yum install followed by the name of the package as shown on the next page.

 # yum install tcsh Gathering header information file(s) from server(s) Server: Fedora Core 3 - i386 - Base Server: Fedora Core 3 - i386 - Released Updates Finding updated packages Downloading needed headers getting /var/cache/yum/base/headers/tcsh-0-6.13-9.i386.hdr tcsh-0-6.13-9.i386.hdr    100% |=======================| 3.8 kB    00:00 Resolving dependencies Dependencies resolved I will do the following: [install: tcsh 6.13-9.i386] Is this ok [y/N]: y Getting tcsh-6.13-9.i386.rpm tcsh-6.13-9.i386.rpm      100% |=======================| 443 kB    00:10 Running test transaction: Test transaction complete, Success! tcsh 100 % done 1/1 Installed:  tcsh 6.13-9.i386 Transaction(s) Complete 

You can also use yum to remove packages, using a similar syntax:

 # yum remove tcsh Gathering header information file(s) from server(s) Server: Fedora Core 3 - i386 - Base Server: Fedora Core 3 - i386 - Released Updates Finding updated packages Downloading needed headers Resolving dependencies Dependencies resolved I will do the following: [erase: tcsh 6.13-9.i386] Is this ok [y/N]: y Running test transaction: Test transaction complete, Success! Erasing: tcsh 1/1 Erased:  tcsh 6.13-9.i386 Transaction(s) Complete 

     < Day Day Up > 


    A Practical Guide to LinuxR Commands, Editors, and Shell Programming
    A Practical Guide to LinuxR Commands, Editors, and Shell Programming
    ISBN: 131478230
    EAN: N/A
    Year: 2005
    Pages: 213

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net