Connect with us

Website Tutorials

Understanding RPM And Basic Package Management

Published

on

Understanding RPM And Basic Package Management

Linux and Unix-like operating systems are made up of files and folders. Before package managers, this meant manually copying programs and associated files to their correct location. Package management changed this as it allows the maker of the software or a third party to package software to make the installation and removal of software much easier to work with. In this post, we will look at the basics of these concepts, how to install, and how to remove software.

What Is A Package Manager?

The concept of package managers has been around for quite some time, but to summarize the concept is to centralize software distribution methods. Package managers will attempt to solve dependencies (additional software packages) the program relies on when installing software.

The concept is to have one place to install, upgrade, configure, and remove software packages. Linux and Unix-like operating systems were truly ahead of their time envisioning different ways of doing this. These days we see centralized software management the most with app stores for example desktop operating systems like macOS, Windows, and even mobile operating systems.

What Is A Software Repository?

A software repository is a place where software packages are stored and can be retrieved by a package manager for installation upon the user’s request for a specific software package.

What Is A RPM Package?

RPM files are an installation file, an archive that typically is pre-compiled. Being pre-compiled reduces installation time and decreases CPU usage during installation. The package is then read by the rpm package manager and installed. Originally the rpm package manager was created for Red Hat Linux and has since spread to many other Linux distributions.

What Linux distributions use RPM for package management

Although RHEL, CentOS, and Fedora Linux are the first people think about there are quite a few Linux distributions including OpenSUSE, Almalinux, and Rocky Linux to name a few. For a full list check out this list.

Advertisement

How To Install A Package From A Repository

To install a package from a repository you will need a front-end the most common are the Yum command and Dnf command. The reason you need a package in between is that rpm doesn’t interact with remote repositories.

To check to see if yum and/or DNF are installed you can use the below command.

which yum dnf 2>/dev/null || echo "YUM and DNF are not installed."

If you see both you should be able to use one of the below, otherwise choose what is installed.

For YUM:

yum install somepackage

For DNF:

Advertisement
dnf install somepackage

With both you will be asked to confirm before the operation starts.

Note: For other distributions that are RPM-based and don’t use YUM or DNF please refer to the official documentation to confirm what package manager you should use.

What Is the Difference Between YUM And DNF?

The Yum package manager is the older of the two, though they both offer the same core functionality. DNF is the successor to YUM and builds on things learned and should be considered the preferred choice of the two.

How To Install A Local RPM File

Though not the preferred method it may be necessary to install rpm packages manually sometimes. This could be for many different reasons but it could include the vendor not providing a repository to use, development, and testing among other reasons.

To install an rpm file use the following command:

Advertisement
rpm -i path-to-package.rpm

Be aware that by using rpm software dependencies are not solved automatically. For a solution that does consider using YUM or DNF as shown below.

Using YUM and DNF

For YUM:

yum localinstall path-to-package.rpm

For DNF:

dnf localinstall path-to-package.rpm

As shown above the syntax is the same between both YUM and DNF just the command is diffentent.

Remove An Installed RPM Package

To uninstall an installed package using rpm use the following command

Advertisement
rpm -e packagename

Using YUM and DNF

Though rpm is the most universal method to uninstall a package it doesn’t remove all the dependencies, for that will want to use a rpm front-end like yum and dnf.

For YUM:

yum remove packagename

For DNF:

dnf remove packagename

Conclusion

Centralized software distribution has become more popular over the years and has become commonplace but it wasn’t always this way. Package managers existed before many of the examples that exist today, in this post, we have discussed background information and more. Like what is a package manager, what a software repository, what an RPM package is, and some of the many Linux distributions using RPM for package management. We wrap up on how to install RPM packages in a few ways and how to remove them.

Additional Resources

If you would like to do some more reading why not check out the links below?

Advertisement

Stephen Oduntan is the founder and CEO of SirsteveHQ, one of the fastest growing independent web hosts in Nigeria. Stephen has been working online since 2010 and has over a decade experience in Internet Entrepreneurship.

Continue Reading
Advertisement
Comments

Trending

Copyright © 2024 SirsteveHQ. All Rights Reserved.