10.1.2 Administering RPMs

In Oracle Linux, you can use the yum utility to install or upgrade RPM packages. The main benefit of using yum is that it also installs or upgrades any package dependencies. yum downloads the packages from repositories such as those that are available on the Unbreakable Linux Network (ULN) or the Oracle Yum Server, but you can also set up your own repositories for use by systems that do not have Internet access. This section describes how to use the rpm command to administer packages that are not available in a yum repository.

Note

You need to be root to install, upgrade or erase an RPM.

To install or upgrade a package using rpm, specify the -U option:

# rpm -U package.rpm

If you specify the --test option, rpm tests the installation or upgrade process, but it does not install the package:

# rpm -U --test package.rpm

To remove a package (erase in RPM terminology), use the -e option:

# rpm -e package

To list every RPM package installed on a system:

# rpm -qa

You can filter the output using grep and sort if you are searching for a particular package, for example:

# rpm -qa | grep gcc | sort
gcc-4.4.6-4.el6.x86_64
gcc-c++-4.4.6-4.el6.x86_64
gcc-gfortran-4.4.6-4.el6.x86_64
libgcc-4.4.6-4.el6.i686
libgcc-4.4.6-4.el6.x86_64

To verify that an individual package has been installed, specify the package name, which can be in short form:

# rpm -q package

For example:

# rpm -q gcc-c++
gcc-c++-4.4.6-4.el6.x86_64

To display information about a package, use the -i option:

# rpm -qi package

To list all the files in a package, use the -l option:

# rpm -ql package

For more information about using rpm, see the rpm(8) manual page.