manage rpm packages on centos

How to Manage RPM Packages on CentOS

Spread the love

RPM is short for Red Hat Package Manager. It is the standard package management system for all Red Hat based distros such as CentOS, RHEL and Fedora. RPM is a very powerful utility that allows users to manage, install, uninstall, upgrade, query and verify UNIX system software packages. The default extension for files that can be managed with this package manager is .rpm

Advantages of RPM include straightforward program installation and uninstallation, automatic installation, ease of updating programs originally installed with RPM, and availability of versions for most Red Hat distributions of Linux.

In this article, we will describe some of the most useful RPM usage scenarios that might be helpful to all users that have a Red Hat-based Linux distro installed on their server.

1. List all installed RPM packages

The following command will print a list of installed RPM packages on your Linux VPS

rpm -qa

npm-3.10.8-1.6.9.1.4.el7.x86_64
bash-4.2.46-21.el7_3.x86_64
grep-2.20-2.el7.x86_64
iptables-1.4.21-17.el7.x86_64
...

2. Install RPM packages

We can easily install an RPM package using the package manager. In this example, we will install the Nano text editor from a downloaded RPM package

rpm -ivh nano-2.3.1-10.el7.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
1:nano-2.3.1-10.el7                ################################# [100%]

You can confirm that Nano is successfully installed by executing the following command

nano --version
GNU nano version 2.3.1 (compiled 04:47:52, Jun 10 2014)
(C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2008, 2009 Free Software Foundation, Inc.
Email: [email protected]    Web: http://www.nano-editor.org/
Compiled options: --enable-color --enable-extra --enable-multibuffer --enable-nanorc --enable-utf8

You can install packages without checking for dependencies using –nodeps

rpm -ivh --nodeps package

3. Upgrade RPM packages

Upgrading an existing package is very simple and it can be done using the -U option.  The package manager checks if there is an older version of the package installed on the server, and in case it is not found, RPM will still install it. For example, if you have an older version of Nano already installed on your server, you can upgrade it using the -U option.

rpm -Uvh nano-2.3.1-10.el7.x86_64.rpm
Preparing...                ########################################### [100%]
1:nano                     ########################################### [100%]

4. Remove RPM packages

If you want to remove an RPM package, you have to use the -e option as shown in the example below

rpm -e nano-2.3.1-10.el7.x86_64

You can also remove an RPM package without checking for dependencies, but please be careful because removing a file without checking the dependencies may break some application.

rpm -e --nodeps package

5. Information about installed RPM packages

If you need more information about some of the installed RPM packages you can run the following command

rpm -qi nano
Name        : nano
Version     : 2.3.1
Release     : 10.el7
Architecture: x86_64
Install Date: Mon 06 Mar 2017 08:42:24 CST
Group       : Applications/Editors
Size        : 1715901
License     : GPLv3+
Signature   : RSA/SHA256, Thu 03 Jul 2014 22:53:43 CDT, Key ID 24c6a8a7f4a80eb5
Source RPM  : nano-2.3.1-10.el7.src.rpm
Build Date  : Mon 09 Jun 2014 23:47:54 CDT
Build Host  : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://www.nano-editor.org
Summary     : A small text editor
Description :
GNU nano is a small and friendly text editor.

Of course, you don’t have to do any of this if you use one of our Server Management Services, in which case you can simply ask our expert Linux admins to help you with your RPM packages. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *