How to install and manage packages on CentOS using RPM

RPM is the abbreviation for Red Hat Package Manager. Applications can be managed on CentOS using RPM as well as YUM. This article focuses on RPM use.

-Advertisement-

Every Linux distribution has its own way to manage software packages. CentOS uses two package management commands: a low-level RPM and a high-level YUM command.

RPM is the abbreviation for Red Hat Package Manager. Yes, it is used by Red Hat Enterprise Linux, Fedora, Oracle Linux, and Scientific Linux as well. It is used to manage packages, and in this article, I will show you some basic operations with RPM.

Package installation with RPM on CentOS

We use RPM to install a package from a .rpm file. We need to have a file, so in order to demonstrate it to you, we will download a .rpm file for a package called epel-release, which is a set of additional repositories (you can think of these as software stores) for Fedora and CentOS. It can be found at the following address:

https://dl.fedoraproject.org/pub/epel/6/x86_64/

-Advertisement-

download-epel
Epel download

Right-click on the epel-release-6.8.noarch.rpm and choose Copy link address. Now go to your Linux command line and download the file using curl.

curl-download
Downloading .rpm with curl

Once downloaded, we can install the .rpm file by using -i option to rpm command.

-Advertisement-

rpm-install
Installing .rpm package

Listing installed packages

Now we expect the package to be installed and available but how can we make sure it really is? Rpm command has an option to list all installed rpm packages, using the -qa option.

This will list all installed packages but we use can use grep to filter the results to only show our package. So let’s do it.

list-packages
Filter installed packages

-Advertisement-

On clean CentOS 6 minimal installation, there are a lot of installed packages, and you can see their exact number by counting the lines.

packages-number
Showing the number of installed packages

Removing packages

If we decide that we don’t need a package anymore, we can uninstall it. It can be done using the same rpm command, only with a different option, -e, followed by a package name. Note that this is NOT the file name.

package-removal
Removing installed package

After removal, we listed installed packages, and see that there isn’t epel-release any more. Did you notice that I did not specify the full package name with the version number? Well, you don’t have to specify the version number, basic package name will suffice.

Offline Installation

Although the usual way of installing a .rpm file is to install it from a local file system, you can also install it from a remote location. Let’s use the download link we obtained before, and just use it as if it is a physical file:

remote-install
Installing package remotely

Listing package files

There is one useful option to rpm command, and that is -ql option. It lists all the files that are installed with the package. epel-release is not very interesting, so we might try to list files that belong to one installed package called openssh-server.

openssh-server-files
Contents of openssh-server package

Package “ownership” of a file

You may ask the question: which package installed a specific file, or rather, to which package a file belongs to. Option -qf followed by a file name(full path) shows a package that installed a file.

ls-package
Ls command belongs to a coreutils package

Package information

We can get more information about the installed package like its version and release numbers, description when it was installed and so on. It is used with -qi option to rpm, followed by an installed package name.

package-information
Information about installed package

Even more, with -qip option to rpm, we can get information about the package from the package file, before it was even installed. It is quite useful sometimes when we need to know some additional information.

package-file-information
Information about the package from the package file

The outputs look almost the same. Can you spot the difference? I’ll leave this one to you.

Conclusion

Not so long time ago, rpm and source installs were the main methods to install Linux software packages. Source install (compiling source files) is by default complicated and time-consuming (it can take even hours), and .rpm packages can leave you in a so-called rpm dependency hell.

Luckily, in the last few years, most of the software package producers allow you to configure your system to use the yum installer, even for latest versions of the software. This method is easier and takes care of dependencies automatically.

However, some features of rpm command are still essential to know as a Linux administrator, so getting to know more advance rpm features makes you feel more comfortable while working with Linux in the command line. Therefore rpm is definitely old but not depreciated!

-Advertisement-
Kiran Kumar
Hi there! I'm Kiran Kumar, founder of FOSSLinux.com. I'm an avid Linux lover and enjoy hands-on with new promising distros. Currently, I'm using Ubuntu as a daily driver and run several other distros such as Fedora, Solus, Manjaro, Debian, and some new ones on my test PC and virtual machines. I have a day job as an Engineer, and this website is one of my favorite past time activities, especially during Winter ;). When I'm not writing for FOSSLinux, I'm seen biking and hiking on scenic trails. I hope you enjoy using this website as much as I do writing for it. Feedback from readers is something that inspires me to do more and spread Linux love!. If you find a time, drop me an email or feedback from the 'Contact' page. Or simply leave a comment below if you found this article useful. Have a good day!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

23,631FansLike
360FollowersFollow
16SubscribersSubscribe

LATEST ARTICLES

Top 20 Git Commands with Practical Examples

If you are here reading this post, there is a high probability that you have heard or interacted with Github, and you now want to learn Git. Before we continue with showing you some of the cool Git commands, let's understand the difference between Git and GitHub.

Top 10 New Features in Linux Kernel 5.7

Linus Torvalds has announced the release of Linux Kernel 5.7 after seven weeks of development. The release announcement comes as a piece of exciting news as it brings a host of new features for the hardware manufacturers as well as the developers.

How to install CMake on Ubuntu

CMake is a cross-platform free and open-source software tool designed to build, test, and package the software. CMake uses a simple platform and compiler-independent configuration files to control the software compilation process.

How to install Lightworks on Ubuntu

Even though Linux may not get a native installer of video editing software like Adobe Premiere or Final Cut Pro, that doesn't mean there are no industry standards tools available. Lightworks is non-linear editing (NLE) video mastering app for Windows, Linux, and macOS. Installing it on Ubuntu is simple due to deb package availability.

How to install DaVinci Resolve on Fedora

Davinci Resolve is a professional application used for color correction, video editing, visual effects, and motion graphics. It is one of the extensively used software by movie industries located in Hollywood.

The 10 Best Programming Languages for Hacking

One of the significant entities we have in Cyber Security is Ethical Hacking (ETH). It is the process of detecting and finding flaws or vulnerabilities in a system that a hacker would exploit.

MUST READ

Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.
Elementary OS 5.1 Hera has received a point release with a handful of new features and bug fixes, and we will be reviewing the significant changes in this article. For those new to elementary OS, this Ubuntu-based Linux distribution uses their inhouse built Pantheon desktop environment and AppCenter.

What is FOSS, and how does it differ from Freeware

The rise of the Linux operating system, in all its various distributions, over the past few decades has catapulted the popularity of Free or Open Source Software (FOSS). Let's guide you in understanding what is FOSS, how it differs from freeware and is Linux a FOSS.

7 Best Ways to Kill Unresponsive Programs in Linux

For dealing with a frozen app or desktop, you can't use the CTRL+ALT+DEL in Linux system. Instead, there are powerful alternatives that come in handy in frustrating situations. We pick the best methods available for you.

10 Best Screen Capturing Software for Linux

Do you want to make a video tutorial for YouTube or show-off your epic victory royale to your friends? Look no further — as we have compiled the 10 Best Screen Capturing Software for Linux. Whether you need to record your desktop screen or take a simple screenshot, FOSSLinux has got your back.

6 cool and fun Linux commands you don’t want to miss

The real purpose of this article is to help Linux newbies get comfortable and confident with the Linux command-line.  While knowledge and comfort of the Linux GUI allow great power, it is the mastery of the command line, or CLI, affords the Linux user unlimited power and certifies them as a Linux power user well on their way to becoming an expert.