RPM (RPM Package Manager)

rpm is a powerful Package Manager, which can be used to build, install, query, verify, update, and erase individual software packages. A package consists of an archive of files and meta-data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package. Packages come in two varieties: binary packages, used to encapsulate software to be installed, and source packages, containing the source code and recipe necessary to produce binary packages.

One of the following basic modes must be selected: Query, Verify, Signature Check, Install/Upgrade/Freshen, Uninstall, Initialize Database, Rebuild Database, Resign, Add Signature, Set Owners/Groups, Show Query tags, and Show Configuration.

Installing

To install a package, log in as root and type the following command at a shell prompt:

# rpm -Uvh foo-1.0-1.i 386.rpm

Where U-upgrade v-verbose h-hash

Package Already Installed

# rpm -ivh –replacepkgs foo-1.0-1.i 386.rpm

Conflicting Files

# rpm -ivh –replacefiles foo-1.0-1.i 386.rpm

Unresolved Dependency

RPM packages can, essentially, depend on other packages, which means that they require other packages to be installed to run properly. If you try to install a package which has an unresolved dependency, output similar to the following is displayed:

error: Failed dependencies:

bar.so.2 is needed by foo-1.0-1

Suggested resolutions:

bar-2.0.20-3.i386.rpm

Use below command

# rpm -ivh foo-1.0-1.i 386.rpm bar-2.0.20-3.i 386.rpm

If it does not suggest a package to resolve the dependency, you can try the –redhatprovides option to determine which package contains the required file. You need the rpm db-redhat package installed

to use this option.

   # rpm -q –redhatprovides bar.so .2

If the package that contains bar.so.2 is in the installed database from the rpm db-redhat package, the name of the package is displayed:

bar-2.0.20-3.i386.rpm

To force the installation anyway (which is not recommended since the package may not run correctly), use the –nodeps option.

Uninstalling

Uninstalling a package is just as simple as installing one. T ype the following command at a shell prompt:

     # rpm -e foo

You can encounter a dependency error when uninstalling a package if another installed package depends on the one you are trying to remove. For example:

error: Failed dependencies:

foo is needed by (installed) bar-2.0.20-3.i386.rpm

To cause RPM to ignore this error and uninstall the package anyway, which may break the package depending on it, use the –nodeps option.

Upgrading

Upgrading a package is similar to installing one. Type the following command at a shell prompt:

  # rpm -Uvh foo-2.0-1.i 386.rpm

To force RPM to upgrade anyway, use the –oldpackage option:

  # rpm -Uvh –oldpackage foo-1.0-1.i 386.rpm

Querying

Use the rpm -q command to query the database of installed packages. The rpm -q foo command displays the package name, version, and release number of the installed package foo

Instead of specifying the package name, use the following options with -q to specify the package(s) you want to query. These are called Package Selection Options.

-a queries all currently installed packages.

-f <file> queries the package which owns <file>. When specifying a file, you must specify the full path of the file (for example, /bin/ls).

-p <packagefile> queries the package <packagefile>.

There are a number of ways to specify what information to display about queried packages. The following options are used to select the type of information for which you are searching. These are called Information Query Options.

-i displays package information including name, description, release, size, build date, install date, vendor, and other miscellaneous information.

-l displays the list of files that the package contains.

-s displays the state of all the files in the package.

-d displays a list of files marked as documentation (man pages, info pages, READMEs, etc.).

-c displays a list of files marked as configuration files. These are the files you change after installation to adapt the package to your system (for example, sendm ail.cf, passwd, inittab, etc.).

For the options that display lists of files, add -v to the command to display the lists in a familiar ls –l format.

Verifying

The command rpm -V verifies a package. You can use any of the Package Verify Options listed for querying to specify the packages you wish to verify.

Leave a Reply

Your email address will not be published. Required fields are marked *