Fedora Wiki
Advertisement

RPM[]

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 querying[]

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 rpm[]

Installing packages with no output.

# rpm -i <packagename>

Installing packages with a status bar.

# rpm -ivh <packagename>

Uninstalling packages

# 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.

DNF[]

DNF, or Dandified Yum, is a package manager designed to use the rpm system to query, search, install, and uninstall packages using online public repositories. DNF can search and download the packages listed on the repositories it is configured to use - in the process downloading and installing necessary dependencies.

Usually, DNF 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.

DNF is Fedora's default package manager, which replaced yum in Fedora 22. DNF is used along with RPM to do the bulk of software management in Fedora. DNF can be run from the command line with simple syntax.

Basic DNF usage[]

This section covers the basics of using DNF 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.

DNF maintains a cache containing metadata and package information about enabled repositories. Sometimes, DNF will stop functioning properly. If DNF starts behaving strangly, the first two advised steps in troubleshooting are:

  1. Troubleshooting your connection to verify connectivity and the ability to contact mirrors
  2. Cleaning to DNF cache

The DNF cache can be cleared by issuing:

# dnf clean all

The basic syntax for installing packages with minimal required arguments is:

# dnf install <packagename>

If you don't know the exact name of the package you would like to install, you can search the repositories using DNF from the command line.

# dnf search <search term>

Packages are removed using:

# dnf remove <packagename>

Individual packages can be updated using the "update" argument:

# dnf update <packagename>

Also, the entire system can be upgraded using a single command:

# dnf 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 DNF's remove functionality.

# dnf -y update

Installing more than one package is as simple as adding it to the end of the line.

# dnf install <packagename> <packagename>

In general, it is preferable to use DNF (or rpm) to add or remove software because this will allow you to automatically install and update your software

  1. without time-consuming compile jobs and
  2. allow you to cleanly and easily update your software, and its dependencies, when updates arrive in the repositories.
Advertisement