svg
Post Image
By Daniel Tanque12 de Outubro, 2023In BashDevOpsLearning

Package Manager

At some point you need to install software on your machine, and then do the same on the servers, for that you can use RPM (Red Hat Package Manager), but in certain cases you need to have dependencies installed to be able to install a specific package and for that you can use YUM.

In this article you will learn about RPM and YUM, why are they needed and how to operate.

What’s the purpose of a Package Manager?

A package manager is a software tool used in operating systems to simplify the installation, removal, and management of software packages. The primary purposes of a package manager are software installation, dependency management, version control, conflict resolution, removal and uninstall, search and query, and more.

RPM is a low-level package management system used primarily in Red Hat-based Linux distributions, such as Red Hat Enterprise Linux, CentOS, and Fedora.

It is a file format and a set of tools for installing, updating, and managing individual software packages. RPM packages typically have a .rpm file extension and contain the files, metadata, and scripts needed to install and manage a specific piece of software.

You can use RPM to install and query packages, as well as check package dependencies, but it doesn’t handle automatic dependency resolution.

Yum is a high-level package management utility used in Red Hat-based Linux distributions as well. It simplifies package management by providing automatic dependency resolution.

Yum uses RPM as its package format and relies on RPM for package installation and removal. Yum maintains a repository of available software packages and their dependencies. It can automatically download and install software and its required dependencies.

Yum makes it easier to keep your system up-to-date and manage software installations without having to manually deal with individual RPM files and their dependencies.

Basic usage of RPM

To install you run:

rpm -i telnet.rpm

To uninstall you run:

rpm -e telnet.rpm

To query you run:

rpm -q telnet.rpm

As mentioned previously rpm just adds one package and doesn’t look for dependencies. So if for instance you try to install Ansible, it will only install that package, but it will not run because requires other packages like python and more. That’s when Yum enters.

Basic usage of Yum

Yum is a high-level package manager that queries for additional packages and installs all of them. Per example to install Ansible you run:

yum install ansible

To list all repositories you run:

yum repolist

To see where all repos are configured you run:

ls /etc/yum.repos.d/

To get the repo url you run:

cat /etc/yum.repos.d/CentOS-Base.repo

To list the information available about a package you can run:

yum list <package name>

To remove a package:

yum remove <package name>

To see if there are duplicates you run:

yum --showduplicate list <package name>

To install a specific version you run:

yum install <package name>-<version>

Note: sometimes to have permission you may have to increase the privileges by using sudo.

Conclusion

Now you know how to install on Linux environment the packages and it’s associated dependencies, you can do it locally and as well in the servers.

svgVi Editor - Basics
svg
svgService Unit Files

Leave a reply