rpm: Red Hat Package Manager


rpm: Red Hat Package Manager

The rpm (Red Hat Package Manager) utility works only with software packages that have been built for processing by rpm; it installs, uninstalls, upgrades, queries, and verifies rpm packages. Because Red Hat released rpm under the GPL (page 4), rpm is used by several distributions. The rpm utility keeps track of the locations where software packages are installed, the versions of the installed packages, and the dependencies between the packages.

Source rpm packages are frequently found in a directory named SRPMS (source rpms), whereas binary rpm packages usually reside in RPMS. When you download binary packages, make sure that they are relevant to the local operating system (both distribution and releasefor example, Fedora Core 5).[1] They should also be compiled for the appropriate architecture:

[1] Many rpm packages run on releases and even distributions other than the ones they were compiled for. However, installing packages intended for other distributions can create problems. In particular, Mandriva packages are rarely compatible with other systems.

  • i386 covers all Intel- and most AMD-based systems.

  • i586 covers Pentium-class processors and above.

  • i686 refers to Pentium II or better, and includes MMX extensions.

  • S390 is for IBM System/390.

  • ia64 is for the 64-bit Intel processor.

  • alpha is for the DEC/Compaq Alpha chip.

  • athlon denotes the AMD Athlon family including x86_64 and AMD64.

  • ppc is for the Power PC chip.

  • sparc covers the Sun Sparc processor).

The name of the rpm file contains almost all the necessary information.

yumdownloader


See page 482 for instructions on using yumdownloader to download rpm package files.

Fedora download site


Go to download.fedora.redhat.com/pub/fedora/linux to browse the Fedora Project's extensive collection of files that you can download. From this page select core for packages that are part of the Fedora release and extras for other packages. Next select the release of Fedora you want to download a package or updates for. Finally select the architecture or SRPMS if you want to download source files. Select a mirror site from the list at fedora.redhat.com/download/mirrors.html if the Red Hat site is busy.

rpmfind.net


Other sites, such as rpmfind.net, also hold rpm packages. Each of the following lines from a search for sendmail on rpmfind.net provides the information you need to select the appropriate sendmail package:

[View full width]

sendmail-8.13.5-2mdk.x86_64.html ... Mandriva devel cooker amd64 sendmail-8.13 .5-2mdk.x86_64.rpm sendmail-8.13.5-2mdk.i586.html ... Mandriva devel cooker i586 sendmail-8.13 .5-2mdk.i586.rpm sendmail-8.13.5-2mdk.i586.html ... Mandriva devel cooker cooker sendmail-8.13 .5-2mdk.i586.rpm sendmail-8.13.5-2mdk.src.html ... Mandriva devel cooker SRPMS sendmail-8.13 .5-2mdk.src.rpm sendmail-8.13.5-2.5.0.amd64.html ... OpenPKG sendmail-8.13.5-2 .5.0.amd64.rpm sendmail-8.13.5-2.5.0.ix86.html ... OpenPKG sendmail-8.13.5-2 .5.0.ix86.rpm sendmail-8.13.5-2.5.0.sparc64.html ... OpenPKG sendmail-8.13.5-2 .5.0.sparc64.rpm sendmail-8.13.5-2.1.ppc.html ... Fedora Core Development ppc sendmail-8.13.5-2 .1.ppc.rpm sendmail-8.13.5-2.1.s390.html ... Fedora Core Development s390 sendmail-8.13.5-2 .1.s390.rpm sendmail-8.13.5-2.1.s390x.html ... Fedora Core Development s390x sendmail-8.13.5-2 .1.s390x.rpm sendmail-8.13.5-2.1.ppc64.html ... Fedora Core Development ppc64 sendmail-8.13.5-2 .1.ppc64.rpm sendmail-8.13.5-2.1.x86_64.html ... Fedora Core Development x86_64 sendmail-8.13.5-2 .1.x86_64.rpm sendmail-8.13.5-2.1.i386.html ... Fedora Core Development i386 sendmail-8.13.5-2 .1.i386.rpm sendmail-8.13.5-2.1.ia64.html ... Fedora Core Development ia64 sendmail-8.13.5-2 .1.ia64.rpm sendmail-8.13.5-2.1.src.html ... Fedora Core Development Sources sendmail-8.13.5-2 .1.src.rpm


Click the html filename at the left to display more information about the file. (Not all packages have an HTML description file.) Click the rpm filename at the right to download the file. Both of these names tell you the name of the program, its version number, and its format (source or compiled for i386, alpha, ia64, and so on). The column to the left of the rpm filename tells you which distribution the file is for.

Packages marked noarch ("no architecture") contain resources, such as images or scripts, that are run by an interpreter. You can install and run noarch packages on any architecture.

Querying Packages and Files

The rpm utility can be run from a command line. Use rpm qa to get a list of one-line summaries of all packages installed on the system (any user can run this utility). Use rpm q, followed by the name of the package, to display more information about a particular package. For instance, rpm q nis tells you whether NIS is installed and, if so, which version. Use the ql options to list the files in a package:

$ rpm -q nis package nis is not installed $ rpm -ql logrotate /etc/cron.daily/logrotate /etc/logrotate.conf /etc/logrotate.d /usr/sbin/logrotate /usr/share/doc/logrotate-3.7.3 /usr/share/doc/logrotate-3.7.3/CHANGES /usr/share/man/man8/logrotate.8.gz /var/lib/logrotate.status


With the qi options, rpm displays information about a package:

$ rpm -qi logrotate Name        : logrotate                    Relocations: (not relocatable) Version     : 3.7.3                             Vendor: Red Hat, Inc. Release     : 2.2.1                         Build Date: Sat 11 Feb 2006 05:02:04 PM PST Install Date: Mon 13 Feb 2006 02:29:03 AM PST      Build Host: hs20-bc1-4.build.redhat.com Group       : System Environment/Base       Source RPM: logrotate-3.7.3-2.2.1.src.rpm Size        : 53982                            License: GPL Signature   : (none) Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> Summary     : Rotates, compresses, removes and mails system log files. Description : The logrotate utility is designed to simplify the administration of log files on a system which generates a lot of log files.  Logrotate allows for the automatic rotation compression, removal and mailing of log files.  Logrotate can be set to handle a log file daily, weekly, monthly or when the log file gets to a certain size.  Normally, logrotate runs as a daily cron job. Install the logrotate package if you need a utility to deal with the log files on your system.


You can use the qf options to determine which package a file belongs to. The following command shows that more is part of the util-linux package.

$ rpm -qf /bin/more util-linux-2.13-0.20


You can include the p option with other options to query an uninstalled rpm file.

Installing, Upgrading, and Removing Packages

Although it is frequently easier to use yum (page 478) or pirut (page 483), you can use rpm to install, upgrade, or remove a package. Log in as or su to root. (Although you can run rpm as a nonprivileged user, you will not have permission to write to the necessary directories during an install or uninstall, and the procedure will fail. During a query, you do not need this permission, so you can and should work as a nonprivileged user.) Give the U option, followed by the name of the file that contains the rpm version of the package you want to install. The U option upgrades existing packages and installs new packages (as though you had used the i option). For kernels, use i (not U) to leave the old kernel intact when you install a new kernel. Add the v (verbose) option to display more information about what is happening and the h (or hash) option to display hash marks as the package is unpacked and installed. For example, while you are logged in as root, give the following command to install samba on the local system:

# rpm -Uvh samba-3.0.21b-2.i386.rpm Preparing...                 ########################################### [100%]    1:samba                   ########################################### [100%]


When you install a package, the rpm file must be in the working directory or you must use a pathname that points to the rpm file.

To remove the same package, give the following command from any directory:

# rpm -e samba error: Failed dependencies:         samba is needed by (installed) system-config-samba-1.2.34-1.noarch


When you run this command, rpm reports that another package, system-config-samba, is dependent on the samba package. To remove the samba package, you have two choices: You can ignore the dependency by including rpm's nodeps option or you can remove the dependent package and then remove the samba package.

# rpm -e system-config-samba # rpm -e samba


If you remove the samba package without removing the package that is dependent on it, the utilities within the dependent package will not work. In the preceding example, the system-config-samba utility will not work.

When you use rpm to remove a package, rpm queries its database to find the information it needs to uninstall the package and removes links, unloads device drivers, and stops daemons as necessary. Refer to the rpm man page for more rpm options.

Installing a Linux Kernel Binary

The following steps install a new Linux kernel binary. Refer to Chapter 15 when you want to configure and rebuild a kernel from source files, rather than installing a new, prebuilt kernel binary.

  1. Run rpm with the i option to install the new kernel. Do not use the U option: You are installing a new kernel that has a different name than the old kernel; you are not upgrading the existing kernel.

  2. Make sure the new kernel works before you remove the old kernel. To verify that the new kernel works, reboot the system using the new kernel.

  3. Remove the old kernel by removing files whose names contain the release number (and EXTRAVERSION number [page 530], if applicable) from /boot or / (root). Remove information about the old kernel from grub.conf. You may want to wait a while before removing the old kernel to make sure that no problems arise with the new one. Instead of removing the old kernel manually, you may be able to remove it with the tool you used to install it (rpm, yum, or other).




A Practical Guide to Red Hat Linux
A Practical Guide to Red HatВ® LinuxВ®: Fedoraв„ў Core and Red Hat Enterprise Linux (3rd Edition)
ISBN: 0132280272
EAN: 2147483647
Year: 2006
Pages: 383

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