Home >Operation and Maintenance >CentOS >How to install rpm package on centos

How to install rpm package on centos

coldplay.xixi
coldplay.xixiOriginal
2020-07-28 14:36:1931815browse

How to install the rpm package in centos: first download and install the RPM file; then use the yum localinstall command followed by the path to the package name; then if the RPM package depends on other packages that you have not installed, all will be installed Dependencies; finally pass the URL to the RPM package.

How to install rpm package on centos

How to install rpm package in centos:

1. Use YUM to install RPM package

Yum is the default package manager tool in CentOS. It is used to install, remove, download, query and update packages from the official CentOS repository as well as other third-party repositories.

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

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

To install the package, follow the yum localinstall command with the path to the package name:

sudo yum localinstall file.rpm

Yum You will be prompted to confirm. Assuming it is compatible with your system and all dependencies are met, entering y will install the RPM package.

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

Instead of automatically downloading and then installing the RPM package, you can pass the URL directly to the RPM package yum localinstall:

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

If you want to update an RPM package that has been installed using yum, use install with The same process applies to software packages.

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

sudo yum remove file.rpm

2. Use RPM to install the RPM package

RPM is a low-level tool that can be used to install, uninstall and upgrade RPM packages.

To install an RPM package using the rpm tool, use the install option -i followed by the RPM package name:

sudo rpm –ivh file.rpm

If the package depends on other packages that you have not installed, then rpm will display a list of all missing dependencies. You must download and install all dependencies manually.

You can skip the download part and provide the RPM package URL to the rpm command:

sudo rpm –ivh https://example.com/file.rpm

When using update package rpm, please use the -U option which stands for "update":

sudo rpm –Uvh file.rpm

To delete a package using this rpm command, use the –e (erase) option, followed by the package name:

sudo rpm –e file.rpm

Recommended related tutorials: centos tutorial

The above is the detailed content of How to install rpm package on centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn