rpm (RPM Package Manager or Red Hat Package Manager) is really two things in one:
- A package manager
- A package
A package contains precompiled programs and information about the program it contains such as dependencies, version, and how the rpm program should install the package (such as where to install config files for the package).
A package manager is a program that reads the package and then figures out the proper installation options and configurations for the system on which the package is being installed. Most package managers automatically resolve - or at least mention - dependencies.
Note that rpm files come in several forms - some rpm files contain pre-compiled binaries, while some are source rpms. Source rpms need to have their binaries built and the package converted into a binary package in order to install the contained software in a fashion usable by the Fedora system.
Basic rpm queryingEdit
RPM, as a package manager, can be used to view information about installed packages - this information is part of what is included with the rpm file.
To query the rpm database for a list of all installed packages:
# rpm -qa
This will output all packages installed - for those unfamiliar with Linux systems, package managers, and rpm, this can be a lot of packages. To only display information about a particular package, use a pipe (|) in conjunction with the grep utility. For example, the following will show all packages matching the pattern "firefox":
# rpm -qa | grep firefox
To show files included with a package:
# rpm -ql <packagename>
To show general information:
# rpm -qi <packagename>
Installing, updating, and erasing packages with rpmEdit
Installing packages with no output.
# rpm -i <packagename>
Installing packages with a status bar.
# rpm -ivh <packagename>
# rpm -e <packagename>
rpm can also be pointed to a specific ftp or http url to fetch the package from an online location and then install it immediately.
# rpm -ivh <full_URL>
rpm can, further, be used to upgrade packages that have been previously installed, when a new version has been released.
# rpm -Uvh <packagename>
To remove a package with rpm:
# rpm -e <packagename>
Of course, be careful about what you are erasing.
Yum is a package manager designed to use the rpm system to query, search, install, and uninstall packages using online public repositories. Yum can search and download the packages listed on the repositories it is configured to use - in the process downloading and installing necessary dependencies.
Usually, yum is used to "fetch" and install packages from available public mirrors. Alternatively, one can set up local repositories that don't require an active internet connection.
Yum is Fedora's default package manager. yum is used along with RPM to do the bulk of software management in Fedora. Yum can be run from the command line with simple syntax.
Basic yum usageEdit
This section covers the basics of using yum with the assumption that you are using online mirrors and thus that you have an active Internet connection - preferably broadband; currently-supported Fedora releases can receive large amounts of updates in short periods of time - if you do not have a broadband connection, keeping Fedora updated at all times may not be a reasonable proposition. Installing only critical security updates (or other updates you really desire or need) can ease the load on your internet connection.
NB: third-party repository mixing should be done only with caution - specifically, Livna is not considered compatible with ATRPMs or Freshrpms.
Yum maintains a cache containing metadata and package information about enabled repositories. Sometimes, yum will stop functioning properly. If yum starts behaving strangly, the first two advised steps in troubleshooting are:
- Troubleshooting your connection to verify connectivity and the ability to contact mirrors
- Cleaning to yum cache
The yum cache can be cleared by issuing:
# yum clean all
The basic syntax for installing packages with minimal required arguments is:
# yum install <packagename>
If you don't know the exact name of the package you would like to install, you can search the repositories using yum from the command line.
# yum search <search term>
Packages are removed using:
# yum remove <packagename>
Individual packages can be updated using the "update" argument:
# yum update <packagename>
Also, the entire system can be upgraded using a single command:
# yum update
The -y option can be used to answer yes to all questions. This can be helpful when doing updates so you can set it and forget it. However, doing so could cause you to install an application you did not want. Use at your own risk; if in doubt, do not use the -y switch. It is especially not advised to use the -y switch in conjunction with yum's remove functionality.
# yum -y update
Installing more than one package is as simple as adding it to the end of the line.
# yum install <packagename> <packagename>
In general, it is preferable to use yum (or rpm) to add or remove software because this will allow you to automatically install and update your software
- without time-consuming compile jobs and
- allow you to cleanly and easily update your software, and its dependencies, when updates arrive in the repositories.
yumex is a graphical interface to the yum application and can be installed from the install media or from the repositories using yum.