Red Hat Package Manager RPM

 < Day Day Up > 

Although the Red Hat Package Manger (RPM) sounds as though it may be a Red Hat-only product, it is used in many other Linux distributions. The command line RPM functionality is easy to understand. What's more, many graphical tools have been built around it as well. RPM files contain a lot of important information related to software installation such as the version of the program, installation scripts, a description of the program, and so on. If you need more information about RPM, you can get it at www.rpm.org.

The examples in this chapter come from a variety of systems, including the Integrity server that you just installed and an IA-32 system. RPM works the same on all systems, even though you'll be running 64-bit applications on your Integrity server and 32-bit applications on your IA-32 systems. Because different versions of RPM exist (versions 3 and 4 are available at the time of this writing), you need to know which version you are running in order to avoid incompatibility.

Let's start by running RPM at the command line. The command rpm - -help is issued in the following listing to give a run down on all the commonly used RPM options:

# rpm --help Usage: rpm [OPTION...] Query options (with -q or --query): -c, --configfiles list all configuration files -d, --docfiles list all documentation files --dump dump basic file information -l, --list list files in package --queryformat=QUERYFORMAT use the following query format -s, --state display the states of the listed files -v, --verbose display a verbose file listing -a, --all query/verify all packages -f, --file query/verify package(s) owning file -g, --group query/verify package(s) in group -p, --package query/verify a package file (i.e. a binary *.rpm file) --querytags display known query tags --specfile query a spec file --whatrequires query/verify the package(s) which require a dependency --whatprovides query/verify the package(s) which provide a dependency Verify options (with -V or --verify): --nomd5[|=0x1] don't verify MD5 digest of files --nofiles[|=0x10000] don't verify files in package --nodeps[|=0x20000] don't verify package dependencies --noscript[|=0x40000] don't execute %verifyscript (if any) -a, --all query/verify all packages -f, --file query/verify package(s) owning file -g, --group query/verify package(s) in group -p, --package query/verify a package file (i.e. a binary *.rpm file) --querytags display known query tags --specfile query a spec file --whatrequires query/verify the package(s) which require a dependency --whatprovides query/verify the package(s) which provide a dependency Signature options: --addsign add a signature to a package --resign sign a package (discard current signature) -K, --checksig verify package signature --nogpg[&=~0x4] skip any GPG signatures --nomd5[&=~0x2] do not verify file md5 checksums Database options: --initdb initialize database --rebuilddb rebuild database inverted lists from installed package headers Install/Upgrade/Erase options: --allfiles[|=0x40] install all files, even configurations which might otherwise be skipped --allmatches[|=0x2] remove all packages which match <package> (normally an error is generated if <package> specified multiple packages) --badreloc[|=0x8] relocate files in non-relocateable package -e, --erase=<package>+ erase (uninstall) package --excludedocs[|=0x20] do not install documentation --excludepath=<path> skip files with leading component <path> --force[|=0x74] short hand for --replacepkgs --replacefiles -F, --freshen=<packagefile>+ upgrade package(s) if already installed -h, --hash[|=0x2] print hash marks as package installs (good with -v) --ignorearch[|=0x2] don't verify package architecture --ignoreos[|=0x1] don't verify package operating system --ignoresize[|=0x180] don't check disk space before installing --includedocs install documentation --install=<packagefile>+ install package --justdb[|=0x8] update the database, but do not modify the filesystem --nodeps do not verify package dependencies --noorder[|=0x8] do not reorder package installation to satisfy dependencies --noscripts[|=0xff0000] do not execute package scriptlet(s) --notriggers[|=0x990000] do not execute any scriptlet(s) triggered by this package --oldpackage[|=0x40] upgrade to an old version of the package (--force on upgrades does this automatically) --percent[|=0x1] print percentages as package installs --prefix=<dir> relocate the package to <dir>, if relocatable --relocate=<old>=<new> relocate files from path <old> to <new> --repackage[|=0x400] save erased package files by repackaging --replacefiles[|=0x30] install even if the package replaces installed files --replacepkgs[|=0x4] reinstall if the package is already present --test[|=0x1] don't install, but tell if it would work or not -U, --upgrade=<packagefile>+ upgrade package(s) Common options for all rpm modes: --version print the version of rpm being used --quiet provide less detailed output -v, --verbose provide more detailed output --define='<name> <body>' define macro <name> with value <body> --eval=<expr>+ print macro expansion of <expr>+ -r, --root=<dir> use <dir> as the top level directory (default: "/") --macros=<file:...> read <file:...> instead of default macro file(s) --rcfile=<file:...> read <file:...> instead of default rpmrc file(s) --showrc display final rpmrc and macro configuration Options implemented via popt alias/exec: --scripts list install/erase scriptlets from package(s) --setperms set permissions of files in a package --setugids set user/group ownership of files in a package --conflicts list capabilities this package conflicts with --obsoletes list other packages removed by installing this package --provides list capabilities that this package provides --requires list capabilities required by package(s) --info list descriptive information from package(s) --changelog list change logs for this package --triggers list trigger scriptlets from package(s) --last list package(s) by install time, most recent first --filesbypkg list all files from each package --redhatprovides find package name that contains a provided capability (needs rpmdb-redhat package installed) --redhatrequires find package name that contains a required capability (needs rpmdb-redhat package installed) --buildpolicy=<policy> set buildroot <policy> (e.g. compress man pages) --with=<option> enable configure <option> for build --without=<option> disable configure <option> for build Help options: -?, --help Show this help message --usage Display brief usage message #

rpm --help provides a good summary of rpm functionality. To get the details on all rpm options, see the rpm man page.

In this example, you want to know if the telnet java package is installed on my IA-32 system. To do so, combine the q option for query and the a option for all to find all the installed gcc packages (rpc -qa | grep gcc).

 # cd /mnt/cdrom/RedHat/RPMS # rpm -qa | grep gcc cc-objc-2.96-110 gcc-g77-2.96-110 gcc-2.96-110 gcc-c2.96-110 # 

This output shows that there are several gcc-related packages installed, but not the java package you'd like to use. So, install the correct package from the CD-ROM. After mounting the CD-ROM at /mnt/cdrom, we can traverse its hierarchy to look for software. (Note that the following examples all assume we have mounted the CD-ROM at /mnt/cdrom.) The CD-ROM in this example is part of the Red Hat distribution. The CD-ROM may have to be mounted before you can load the software:

 # cd /mnt/cdrom/RedHat/RPMS # ls | grep gcc gcc-2.96-110.i386.rpm gcc-c2.96-110.i386.rpm gcc-chill-2.96-110.i386.rpm gcc-g77-2.96-110.i386.rpm gcc-java-2.96-110.i386.rpm gcc-objc-2.96-110.i386.rpm # rpm -i gcc-java* error: failed dependencies:                   libgcj >= 2.96 is needed by gcc-java-2.96-110                   libgcj-devel >= 2.96 is needed by gcc-java-2.96-110 # 

Installation fails because the dependencies listed by the rpm command are not installed. You want to have these dependencies installed in order for the install of the gcc java package to succeed.

You can also use wildcards when installing with rpm. In the following example, the system has no apache-related software installed. To install all of it, use rpm and specify apache* so that all apache-related software on the CD-ROM will be installed. After you're done installing the software, query the system to confirm that all apache-related software was installed. After all that, use rpm to remove one of the packages:

 # cd /mnt/cdrom/RedHat/RPMS # rpm -iv apache* Preparing packages for installation... apache-1.3.23-11 apacheconf-0.8.2-2 apache-devel-1.3.23-11 apache-manual-1.3.23-11 # rpm -qa | grep apache apache-1.3.23-11 apache-devel-1.3.23-11 apache-manual-1.3.23-11 apacheconf-0.8.2-2 # rpm -ev apache-manual-1.3.23.-11 # rpm -qa | grep apache apache-1.3.23-11 apache-devel-1.3.23-11 apacheconf-0.8.2-2 # 

This example shows installing all apache software (rpm -iv apache*), querying to see that it was installed (rpm -qa | grep apache), removing a select package (rpm -ev apache-manual-1.3.23.-11), and then re-querying to ensure that the select package was removed (rpm -qa | grep apache).

The previous examples were performed on an IA-32 system. Now, take a look at the gcc-related files installed on the Integrity server. You will start again with the query all option (rpm -qa | grep gcc).

 # rpm -qa | grep gcc gcc3-g77-3.0.4-1 gcc-objc-2.96-112.7.2 gcc-2.96-112.7.2 libgcc-3.0.4-1 gcc-g77-2.96-112.7.2 gcc-chill-2.96-112.7.2 gcc3-objc-3.0.4-1 gcc3-c3.0.4-1 gcc-c2.96-112.7.2 gcc3-3.0.4-1 gcc3-java-3.0.4-1 # 

gcc-related tools are essential to many of the software development work done on Integrity servers, so the packages listed are vital to this work.

As you can see, working with rpm on IA-32 systems and Integrity servers is nearly identical, although the progams that run on the two platforms are different in that applications must be ported from IA-32 to Itanium. In RHEL 3, there are IA-32 packages installed on Integrity servers, so don't be surprised when you see this.

A variety of graphical tools use rpm. One of the most commonly used is gnorpm, which runs on the Integrity server and IA-32 systems. gnorpm is invoked from the command line with the gnorpm command, or from the Programs menu. Pick Programs-System-GnoRPM in Advanced Server. This tool runs on both GNOME and KDE desktops. Figure 2-16 shows the gnorpm interface from the Integrity server running Advanced Server.

Figure 2-16. gnorpm Interface with samba-swat Selected


gnorpm organizes the packages in a hierarchical fashion and displays the information graphically. Figure 2-16 shows that samba-swat is selected (one of the packages you use in the Samba chapter), which is under Packages-Applications-System.

You can perform a variety of tasks from the gnorpm window using the toolbar at the top of the gnorpm window. For example, assuming samba-swat-2.2.1a-5 is selected (as shown in Figure 2-16), clicking the Query tool produces the window shown in Figure 2-17.

Figure 2-17. Query of samba-swat


Query provides a lot of useful information. From this window, you can Verify or Uninstall the package.

Clicking Web find in the main gnorpm window causes gnorpm to search the Web for your software. The Preferences button allows you to specify the Internet servers which gnorpm uses to find Web information. The Preferences button also allows you to select a variety of setup options for gnorpm, such as Behaviour, Package Listing, Install Window, Network, Rpmfind, and Distributions.

As with most GUIs, you need to work through a few screens to get the feel for gnorpm. At its core, however, gnorpm is using rpm commands to accomplish its work with packages. Thus, if you become comfortable with rpm at the command line, you probably won't be using the GUI too much. On the other hand, if you're only going to be loading software occasionally, gnorpm will probably be your preferred method for loading packages.

Red Hat 8.0 (to be replaced by Fedora), which was for IA-32 systems only, has another great graphical tool called Package Management. You can invoke it by selecting System Settings Packages from the GNOME menu. From this tool, you can select any packages or packages you would like to install. We use this tool later to install OpenOffice. This was done by opening Package Management and then selecting Applications => Office/Productivity => Details => OpenOffice.

     < Day Day Up > 


    Linux on HP Integrity Servers. A System Administrator's Guide
    Linux on HP Integrity Servers: A System Administrators Guide
    ISBN: 0131400002
    EAN: 2147483647
    Year: 2004
    Pages: 100

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