How to install RPM packages on CentOS

Official CentOS repository contains thousands of RPM packages, you can use yum command-line utility for installation. By enabling the appropriate repository, you can easily install the package standard CentOS repository does not exist.

But not all software vendors offer a yum repository for their applications. Usually in these cases, they will have a download page, where you can download and install RPM packages, or download and compile the source code from the software.

In this tutorial, we'll show you how the two methods of RPM packages installed on CentOS.

Ready to work

When installing RPM packages, make sure that they are for your system architecture and CentOS release build.

You should avoid using this method to update or replace essential system packages, such as glibc, systemd or other system running critical services and libraries. Doing so may cause errors and system instability.

To install the RPM packages, you need to log in as a user with sudo privileges.

Typically, you would use a Web browser to search for and download the RPM file. When you find the file, you can use the browser or use such as curl or wget command line tool to download the file.

Use YUM to install RPM packages

CentOS Yum is the default package management tool. It is used to install from the official repository for CentOS and other third-party repositories, delete, download, query and update packages.

The first step is to download the RPM file you want to install:

wget https://example.com/file.rpm

To install the package, the command yum localinstall path followed by the package name:

sudo yum localinstall file.rpm

Yum prompts you to confirm. Assuming that it is compatible with your system and meets all dependencies, enter y to install the RPM package.

If the RPM package depends on other packages you have not installed and enabled these packages on your system repository available, all dependencies will be installed. Otherwise, yum will print a list of all missing dependencies you must download and manually install these packages.

You can directly pass the URL to the RPM package, rather than automatically download and install the RPM package yum localinstall:

sudo yum localinstall https://example.com/file.rpm

If you want to update using the yum install RPM packages, use the same software package with the installation process.

If for some reason you want to remove an installed software package, use the standard yum remove command, followed by the package name:

sudo yum remove file.rpm

Using RPM install RPM packages

RPM is a low-level tool for installing, uninstalling, and upgrading RPM packages.

To use this tool to install rpm RPM packages, use the install option -i, followed by the name of the RPM package:

sudo rpm –ivh file.rpm

If the package is dependent on other programs that you have not installed the package, rpm displays a list of all dependencies missing. You have to manually download and install all dependencies.

You can skip the download section and provide URL as the rpm command RPM package:

Sudo rpm ivh https://example.com/file.rpm

rpm, when using the update package, use -U stands for "update" option:

sudo rpm –Uvh file.rpm

To use the rpm command to remove the package, use the -e (erase) option followed by the package name:

sudo rpm -e file.rpm

to sum up

In this tutorial, you learned how to install RPM packages on CentOS. Compared to rpm, you should prefer to use yum, because it all for you automatically resolve dependencies.

Guess you like

Origin www.linuxidc.com/Linux/2019-08/159875.htm