0% found this document useful (0 votes)
4 views3 pages

Installing and Removing Package With Rpm Command

The document provides a comprehensive guide on using the rpm utility for managing packages in Linux, including commands for querying, installing, upgrading, and removing packages. It includes examples for listing installed packages, displaying package information, and finding files associated with packages. Additionally, it features a cheat sheet summarizing common rpm commands and their usage.

Uploaded by

Gaytri Dhingra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Installing and Removing Package With Rpm Command

The document provides a comprehensive guide on using the rpm utility for managing packages in Linux, including commands for querying, installing, upgrading, and removing packages. It includes examples for listing installed packages, displaying package information, and finding files associated with packages. Additionally, it features a cheat sheet summarizing common rpm commands and their usage.

Uploaded by

Gaytri Dhingra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

he rpm utility provides many useful options for querying and verifying packages,

as well as installing, upgrading, and removing packages. The following provides


examples of these options.

Query Packages
1. Listing all installed packages
To list all installed packages, use the following command:

# rpm -qa | more

NetworkManager-team-1.8.0-9.el7.x86_64
pyxattr-0.5.1-5.el7.x86_64
HPOvXpl-11.14.014-1.x86_64
bind-utils-9.9.4-51.el7.x86_64
pyOpenSSL-0.13.1-3.el7.x86_64
....

The format of rpm package names is name-version-release.architecture.


The example shows packages for version 7 of EnterPrise Linux (el7) with
architectures of either:

 x86_64: Any AMD64 or Intel 64 CPUs


 noarch: Any CPU architecture

 i686: 32-bit OS

2. Display Package Information


To display detailed package information (of the bash package, for example),
enter:

# rpm -ql bash

/etc/skel/.bash_logout
/etc/skel/.bash_profile
/etc/skel/.bashrc
/usr/bin/alias
/usr/bin/bash
/usr/bin/bashbug
/usr/bin/bashbug-64
/usr/bin/bg

3. Find the package from a file


To perform a reverse search, that is to determine what package a specific file
(/etc/hosts, for example) belongs to, enter:
# rpm -qf /etc/hosts

setup-2.8.71-7.el7.noarch

4. Find configuration files of a package


To list configuration files associated with a package (the bash package, for
example), enter:

# rpm -qc bash

/etc/skel/.bash_logout
/etc/skel/.bash_profile
/etc/skel/.bashrc

Installing and Updating Packages


1. Installing or Upgrading packages
Using the rpm -U package_name command upgrades installed packages, as
well as installs
new packages. For example, to install or upgrade the rsync package:

# rpm –Uvh rsync-3.0.9-18.el7.x86_64.rpm

 -v (verbose) option displays more information


 -h (hash) option displays progress.

2. Installing a New Kernel


When installing a new kernel, use the –i option so as not to upgrade the current
kernel, for example:

# rpm –ivh kernel-3.10.0-229.el7.x86_64.rpm

Removing Packages
To remove a package (the rsync package, for example), enter:

# rpm –e rsync

rpm command cheat sheet for Linux


Syntax Description Example(s)
rpm -ivh mozilla-mail-1.7.5-
17.i586.rpm
rpm -ivh {rpm-file} Install the package
rpm -ivh --test mozilla-mail-
1.7.5-17.i586.rpm
rpm -Uvh mozilla-mail-1.7.6-
12.i586.rpm
rpm -Uvh {rpm-file} Upgrade package
rpm -Uvh --test mozilla-mail-
1.7.6-12.i586.rpm
Erase/remove/ an installed
rpm -ev {package} rpm -ev mozilla-mail
package
Erase/remove/ an installed
rpm -ev --nodeps {package} package without checking rpm -ev --nodeps mozilla-mail
for dependencies

Display list all installed rpm -qa


rpm -qa
packages rpm -qa | less
Display installed information
rpm -qi {package} along with package version rpm -qi mozilla-mail
and short description
Find out what package a file
rpm -qf /etc/passwd
rpm -qf {/path/to/file} belongs to i.e. find what
rpm -qf /bin/bash
package owns the file
Display list of configuration
rpm -qc {pacakge-name} rpm -qc httpd
file(s) for a package
Display list of configuration
rpm -qcf
rpm -qcf {/path/to/file}
files for a command /usr/X11R6/bin/xeyes
Display list of all recently
rpm -qa --last
rpm -qa --last
installed RPMs rpm -qa --last | less
rpm -qpR mediawiki-1.4rc1-
rpm -qpR {.rpm-file} Find out what dependencies
4.i586.rpm
rpm -qR {package} a rpm file has
rpm -qR bash

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy