CentOs is a popular operating system which is based on Red Hat. Like RedHat, CentOS uses the rpm
package type in order to manage, install, update, and remove packages in an operating system. We can install RPM files by using different commands like rpm, dnf, or yum in the CentOS distribution. In this tutorial, we examine different methods to install RPM files in CentOS.
Install with rpm Command
The rpm
command can be used to install RPM files or packages in CentOS. Actually, the rpm command is the native method to install RPM packages where you can understand their names. The -i
option and the package file name are provided as parameters to the rpm command. In the following example, we assume the RPM file named “httpd.rpm” is located in the current working directory.
$ sudo rpm -i http.rpm
If the httpd.rpm file is located in another directory than the current working directory we should provide the exact path of the rpm package file.
$ sudo rpm -i /home/ismail/http.rpm
Install with yum Command
The yum
command is used to install packages in a more interactive and easy way for the CentOS operating system. The yum command install packages by downloading them from repositories but it can be also used to install RPM package file. In the following example, we install the RPM package file httpd.rpm using the yum command.
$ sudo yum install http.rpm
If the httpd.rpm file is located in another directory than the current working directory we should provide the exact path of the rpm package file.
$ sudo yum install /home/ismail/http.rpm
Install with dnf Command
We can also use the dnf
command which is the successor of the yum command, to install RPM packages.
$ sudo dnf install http.rpm
If the httpd.rpm file is located in another directory than the current working directory we should provide the exact path of the rpm package file.
$ sudo dnf install /home/ismail/http.rpm