How to Install RPM Packages on CentOS
Choose a different version or distribution
Introduction
Before we begin talking about how to install RPM Packages on CentOS, let's briefly understand – What is RPM Packages?
RPM (Red Hat Package Manager) packages play a vital role in managing software installations on CentOS, a popular Linux distribution. These packages contain software applications, libraries, and dependencies, ensuring smooth installation and maintenance processes.
With RPM, users can easily install, update, and remove software components, effortlessly managing their CentOS systems. Discover the power of RPM packages for seamless software management on CentOS, enhancing productivity and efficiency.
In this tutorial, you will install RPM Packages on CentOS. We will also address a few FAQs on how to install RPM Packages on CentOS.
Advantages of RPM Packages
- Easy Installation: RPM packages simplify software installation on systems, allowing users to quickly and effortlessly deploy applications.
- Dependency Management: RPM handles dependencies efficiently, automatically resolving and installing required libraries or components.
- Package Verification: RPM incorporates package verification mechanisms, ensuring the integrity and authenticity of installed software.
- Efficient Updates: RPM supports seamless updates, allowing users to easily apply patches and bug fixes to installed packages.
- Uninstallation: Removing RPM packages is straightforward, enabling users to cleanly uninstall software and manage system resources effectively.
Before You Begin
Make sure RPM packages are created for your system architecture and CentOS version before installing them.
This approach should not be used to replace or upgrade vital system packages such as glibc, systemd, or other services and libraries that are required for your system to run properly. This could result in mistakes and system instability.
You must be logged in as a root or a user with sudo rights to install RPM packages.
Normally, you would search for and download an RPM file using a web browser. You can download the file using your browser or a command-line tool like curl
or wget
once you've found it.
Installing RPM packages with yum
In CentOS, yum
is the default package manager. It may be used to install, uninstall, download, query, and update packages from both the official CentOS repositories and third-party repositories.
The first step is to get the RPM file you need to install:
wget https://example.com/file.rpm
Use the yum localinstall
command followed by the package name's path to install the package:
sudo yum localinstall file.rpm
You will be asked to confirm your action by yum
. If you answer yes y
, the RPM package will be installed if it is compatible with your system and all dependencies are met.
yum
will install all dependencies if the RPM package depends on additional packages that are not already installed and are present in the repositories enabled on your system. Otherwise, yum
will display a list of all missing dependencies, which you will have to manually download and install.
Instead of downloading and installing the RPM package, use the yum localinstall
command to pass the URL to the RPM package:
sudo yum localinstall https://example.com/file.rpm
Use the same approach as when installing an RPM package that has already been installed with yum to update it.
If you need to delete an installed package for whatever reason, use the normal yum remove
command followed by the package name:
sudo yum remove file.rpm
Installing RPM packages with rpm
rpm
is a command-line program for installing, uninstalling, upgrading, querying, and verifying RPM packages.
Use the rpm -i
command followed by the RPM package name to install an RPM package:
sudo rpm -ivh file.rpm
The -v
option instructs rpm
to display verbose output, whereas the -h
option instructs rpm to display a hash-marked progress bar.
If a package depends on other packages that aren't installed on the system, rpm
will show a list of all dependencies that are missing. All dependencies must be manually downloaded and installed.
You can use the URL to the RPM package as an argument instead of downloading and installing it:
sudo rpm -ivh https://example.com/file.rpm
Use the -U
option to update a package:
sudo rpm -Uvh file.rpm
The rpm -U
command will install the package you're trying to update if it isn't already installed.
Use the --nodeps
option to install an RPM package without having all the essential dependencies installed on the system:
sudo rpm -Uvh --nodeps file.rpm
Use the rpm -e
command, followed by the package name, to remove (erase) a package:
sudo rpm -e file.rpm
FAQs to Install RPM Packages on CentOS
How can I search for available RPM packages on CentOS?
You can use the yum
or dnf
package manager command with the search
option, followed by the package name or keywords. For example, yum search package_name
will display relevant RPM packages.
How do I install an RPM package on CentOS?
To install an RPM package, use yum
or dnf
followed by the install
command and the package name. For example, yum install package_name
will install the specified RPM package.
Can I install RPM packages from the internet?
Yes, RPM packages can be installed from internet repositories. Configure the repository URL in the /etc/yum.repos.d/
directory, then use the regular yum install
or dnf install
command to download and install RPM packages.
Is it possible to update installed RPM packages?
Yes, you can update installed RPM packages using yum update
or dnf update
commands. This will check for available updates and upgrade the installed packages to their latest versions.
Can I install RPM packages from a local file?
Absolutely. Use the yum
or dnf
command with the localinstall
option, followed by the path to the local RPM file. For example, yum localinstall /path/to/package.rpm
will install the specified RPM package.
How can I view the contents of an installed RPM package?
To list the files included in an installed RPM package, use the rpm
command with the -ql
option and the package name. For example, rpm -ql package_name
will display the contents of the RPM package.
Are there any graphical tools for managing RPM packages?
Yes, CentOS provides graphical tools like gnome-software
and yumex
that offer a user-friendly interface for managing and installing RPM packages.
Conclusion
We've taught you how to install RPM packages on CentOS in this tutorial.
You should use yum instead of rpm because it automatically resolves all dependencies.
If you have any queries, please leave a comment below and we’ll be happy to respond to them.