Skip to main content
Engineering LibreTexts

11-B.2: rpm / yum How To

  • Page ID
    41936
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    EXAM OBJECTIVES COVERED
    2.1 Given a scenario, conduct software installations, configurations, updates, and removals.

    Using rpm & yum

    The rpm Command

    The rpm command is a free and open-source package management system. Though it was created for use in Red Hat Linux, rpm is now used in many Linux distributions such as Fedora, CentOS, OpenSUSE, OpenMandriva, and Oracle Linux.

    Syntax:

    rpm [ OPTIONS ] [ PACKAGE NAME ]

    As always with Linux commands, rpm has an abundance of options that allow the user to run commands in a wide variety of output and formats.

    Options:

    Options Option Meaning
    -U, --upgrade Upgrade/install
    -I, --install Install
    -e, --erase Remove
    -q, --query Query
    -V, --verify Verify

    Using the rpm command one can install install, upgrade, query and remove software packages.

    RPM: Install a Package

    The most common command to install a package is:

    rpm -Uhv package_file.rpm 

    This command upgrades a package with extra output. If the package has not been installed, this command installs the package.

    RPM: Upgrading Software

    Almost all installation steps use the rpm command with the –U option, short for upgrade. The basic syntax is:

    pbmac@pbmac-server $ rpm  -U  package_name 

    For example:

    pbmac@pbmac-server $ rpm –U jikes-1.16-1.i386.rpm 

    You can also use the --upgrade long option in place of -U .

    Unless something goes wrong, you won’t see any response except for the shell prompt ready for your next command.

    RPM: Check the Package Is Installed

    Use the rpm –q command to query whether a package has been installed. To verify, you need to use the name of the installed package, not the name of the RPM file. You can also use a partial package name, such as jikes in this case. For example:

    pbmac@pbmac-server $ rpm –q  jikes  
    jikes-1.16-1
    

    The response shows that the package named jikes-1.16-1 has been installed. This package name corresponds to the RPM file used in the preceding installation example.

    The rpm -q command just asks the RPM database if the package has been installed. There may be other issues with the package that this command won’t show. For now, though, the rpm –q command verifies that the package has been installed.

    There are a couple of options that are often found with the -q:

    • -qa - Query all packages
    • -qi - Display a lot of package information including description
    • -qc - List configuration files

    So, the command in the example below

    pbmac@pbmac-server $ rpm –qc jikes  

    will show the configuration files for the jikes package.

    The yum Command

    yum: Checking For Updates

    You can use the yum check-update command to see which installed packages on your system have updates available:

    pbmac@pbmac-server $  yum check-update 
    Loaded plugins: langpacks, presto, refresh-packagekit
    
    PackageKit.x86_64                    0.6.14-2.fc15                 fedora
    PackageKit-command-not-found.x86_64  0.6.14-2.fc15                 fedora
    PackageKit-device-rebind.x86_64      0.6.14-2.fc15                 fedora

    yum: Updating a Single Package

    To update a single package, enter yum update package_name , for example:

    pbmac@pbmac-server $  yum update gdb 
    Loaded plugins: langpacks, presto, refresh-packagekit
    Setting up Update Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package gdb.x86_64 0:7.2.90.20110411-34.fc15 will be updated
    ---> Package gdb.x86_64 0:7.2.90.20110429-36.fc15 will be an update
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ================================================================================
     Package     Arch         Version                          Repository      Size
    ================================================================================
    Updating:
     gdb         x86_64       7.2.90.20110429-36.fc15          fedora         1.9 M
    
    Transaction Summary
    ================================================================================
    Upgrade       1 Package(s)
    
    Total download size: 1.9 M
    Is this ok [y/N]:

    yum: Updating All Packages and Their Dependencies

    To update all packages and their dependencies, simply enter the yum update command (without any arguments):

    pbmac@pbmac-server $  yum update 

    yum: Listing Packages

    yum list and related commands provide information about packages, package groups, and repositories. Variations of the yum list command include:

    yum Command Meaning
    yum list all Lists all installed and available packages.
    yum list installed Lists all packages installed on your system. The rightmost column in the output lists the repository from which the package was retrieved.
    yum list available Lists all available packages in all enabled repositories.
    yum grouplist Lists all package groups.
    yum repolist Lists the repository ID, name, and number of packages it provides for each enabled repository.

    yum: Display Package Information

    The yum info package_name [ more_names ] command displays information about one or more packages (glob expressions are valid here as well). For example, to display information about the abrt package, type:

    pbmac@pbmac-server $  yum info abrt 

    yum: Install Packages

    You can install a package and all of its non-installed dependencies by entering:

     pbmac@pbmac-server $ yum install  package_name  

    You can install multiple packages simultaneously by appending their names as arguments:

     pbmac@pbmac-server $ yum install  package_name  [ more_names ] 

    yum: Remove Packages

    The yum remove package_name uninstalls (removes in RPM and Yum terminology) the package, as well as any packages that depend on it. As when you install multiple packages, you can remove several at once by adding more package names to the command. For example, to remove totem, rhythmbox, and sound-juicer, type the following at a shell prompt:

    pbmac@pbmac-server $  yum remove totem rhythmbox sound-juicer 

    Adapted from:
    "The evolution of package managers" by Steve Ovens, OpenSource.com is licensed under CC BY-SA 4.0
    "Cap. 2. RPM Overview" by Ben Cotton is licensed under CC BY-SA 3.0
    "Chapter 4. Yum" by Multiple Contributors, Fedora 15 Deployment Guide is licensed under CC BY-SA 3.0


    This page titled 11-B.2: rpm / yum How To is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Patrick McClanahan.

    • Was this article helpful?