SYS: Learn to use the rpm command.

Share this link

To install (-i) a new package (here httpd-2.2.15-29.el6.x86_64.rpm), type:

# rpm -ivh httpd-2.2.15-29.el6.x86_64.rpm

To upgrade (-U) an existing package (here httpd-2.2.15-29.el6.x86_64.rpm), type:

# rpm -Uvh httpd-2.2.15-29.el6.x86_64.rpm

To erase (-e) an existing package (here httpd-2.2.15-29.el6.x86_64), type:

# rpm -evh httpd-2.2.15-29.el6.x86_64

To get the list of all the installed packages, type:

# rpm -qa

To get some details about a package (here httpd-2.2.15-29.el6.x86_64), type:

# rpm -qi httpd-2.2.15-29.el6.x86_64

To get the package file list (here httpd-2.2.15-29.el6.x86_64), type:

# rpm -ql httpd-2.2.15-29.el6.x86_64

To get the list of all the modified files in the system, type:

# rpm -qVa

To get the change history of a package (here openssl), type:

# rpm -q --changelog openssl
* Thu Oct 16 2014 Tomáš Mráz <tmraz@redhat.com> 1.0.1e-30.4
- use FIPS approved method for computation of d in RSA
...
* Tue Oct 26 1999 Bernhard Rosenkrdnzer <bero@redhat.de>
- inital packaging
- changes from base:
  - Move /usr/local/ssl to /usr/share/ssl for FHS compliance
  - handle RPM_OPT_FLAGS

To get the list of packages coming from a given repository (here remi), type:

#  rpm -qa --qf '%{VENDOR} \t %{NAME}\n' | grep -i remi
Remi Collet      libzip-last
Remi Collet      remi-release
Remi Collet      php-xml
Remi Collet      php-pecl-zip
...

Caution: If it is very useful to know the rpm command to query the system, it’s better not to use it to install a package:

  • This command doesn’t deal with the package dependencies: you will have to do it yourself with all sorts of additional difficulties.
  • It breaks the yum transaction history (=>Warning: RPMDB altered outside of yum).

Use the yum command instead.

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 4.67 out of 5)
Loading...

Leave a Reply

Upcoming Events (Local Time)

There are no events.

RHCSA7: Task of the day

Allowed time: 10 minutes.
Archive and compress the content of the /opt directory (create files if none exists).
Uncompress and unarchive the resulting file in /root

RHCE7: Task of the day

Allowed time: 10 minutes.
Set up a default secure MariaDB database called maria and back up the database with mysqldump.

Follow me on Twitter

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...