Mostly, A Linux system administrator installs rpm packages on Linux by using yum command, but you can use rpm command in Linux to install rpm on CentOS, Fedora, RHEL, etc, while packages do not exist on the repository. At the end of this article, you will learn how to install an rpm on CentOS.
Yum command download package from Official CentOS repository, and installed on your system. The repository contains thousands of RPM packages.
But if you want to install an rpm package which is not existing on the repository, rpm command in Linux will be helpful to install rpm on centos and other rpm bases Linux distributions.
RPM Package Manager (RPM) is a free and open-source package management system for installing, uninstalling and managing software packages in Linux.
Prerequisites to run rpm command in Linux
Before you begin, you need to know about prerequisites, so later you will not face problems running rpm command in Linux. Keep in mind the following points.
- A user account with sudo privileges or root user.
- You must have access to a terminal window/command line.
- RPM, DNF, & YUM Package Managers (all included by default).
- RPM package is built for your system architecture and your CentOS version, which you want to install.
Check system architecture and Version
If you have 32 bit operating system installed on your system, you must download 32 bit rpm package.
64 bit package doesn’t work on 32 bit system. So, You must know the system architecture. you can use following command to get information about system architecture.
uname -r
[root@localhost ~]# uname -r 4.18.0-147.5.1.el8_1.x86_64 [root@localhost ~]#
In the above example you can see I am running 64 bit CentOS. I can install 64 bit rpm packages.
Download rpm package for CentOS
Basically, user prefer to use a web browser to locate and download a .rpm file, but you could also use command-line tools like wget command or curl command.
In the example, I am going to install one of the most famous software team viewer.
First, I will use wget command to download teamviewer. You must know the downloading address of the package.
Better, you can use web browser to download teamviewer package.
[root@localhost ~]# wget https://download.teamviewer.com/download/linux/teamviewer.x86_64.rpm --2020-05-03 13:20:16-- https://download.teamviewer.com/download/linux/teamviewer.x86_64.rpm Resolving download.teamviewer.com (download.teamviewer.com)... 104.16.63.16, 104.16.62.16, 2606:4700::6810:3f10, ... Connecting to download.teamviewer.com (download.teamviewer.com)|104.16.63.16|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://dl.teamviewer.com/download/linux/version_15x/teamviewer_15.5.3.x86_64.rpm [following] --2020-05-03 13:20:17-- https://dl.teamviewer.com/download/linux/version_15x/teamviewer_15.5.3.x86_64.rpm Resolving dl.teamviewer.com (dl.teamviewer.com)... 104.16.63.16, 104.16.62.16, 2606:4700::6810:3e10, ... Connecting to dl.teamviewer.com (dl.teamviewer.com)|104.16.63.16|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 14565386 (14M) [application/x-redhat-package-manager] Saving to: ‘teamviewer.x86_64.rpm’ teamviewer.x86_64.r 100%[===================>] 13.89M 354KB/s in 2m 58s 2020-05-03 13:23:17 (79.9 KB/s) - ‘teamviewer.x86_64.rpm’ saved [14565386/14565386] [root@localhost ~]#
Alternate method to download package:
For downloading TeamViewer Go the following link Click here. Choose a suitable file as per your architecture and Os Version.

Install rpm on CentOS by rpm command
Finally I am on the right way. Before, run the rpm command please check the status of downloaded file.
You can use the ls command to verify downloading file.
ls
Now, run rpm command followed by -i option and rpm package name. See the syntax below:
#rpm -i package_name.rpm
[root@localhost ~]# rpm -i teamviewer.x86_64.rpm warning: teamviewer.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 0c1289c0: NOKEY error: Failed dependencies: libQt5DBus.so.5()(64bit) >= 5.5 is needed by teamviewer-15.5.3-0.x86_64 libQt5Gui.so.5()(64bit) >= 5.5 is needed by teamviewer-15.5.3-0.x86_64 libQt5Qml.so.5()(64bit) >= 5.5 is needed by teamviewer-15.5.3-0.x86_64 libQt5Quick.so.5()(64bit) >= 5.5 is needed by teamviewer-15.5.3-0.x86_64 libQt5WebKit.so.5()(64bit) >= 5.5 is needed by teamviewer-15.5.3-0.x86_64 libQt5WebKitWidgets.so.5()(64bit) >= 5.5 is needed by teamviewer-15.5.3-0.x86_64 libQt5Widgets.so.5()(64bit) >= 5.5 is needed by teamviewer-15.5.3-0.x86_64 libQt5X11Extras.so.5()(64bit) >= 5.5 is needed by teamviewer-15.5.3-0.x86_64 qt5-qtdeclarative >= 5.5 is needed by teamviewer-15.5.3-0.x86_64 qt5-qtquickcontrols >= 5.5 is needed by teamviewer-15.5.3-0.x86_64 [root@localhost ~]#
In the above example teamviewer didn’t install. It is showing error: Failed dependencies. Teamviewer need some other packages to work properly.
Check RPM dependencies
Installation has been failed due to missing dependencies. You can use rpm command followed by -qpR or -qR option and package name to check for missing dependencies.
The command syntax as follows:
#rpm -qpR package_name.rpm
OR
#rpm -qR package_name.rpm.
I am trying to install teamviewer so my syntax will be as follow:
[root@localhost ~]# rpm -qpR teamviewer.x86_64.rpm warning: teamviewer.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 0c1289c0: NOKEY /bin/bash /bin/bash /bin/bash /bin/bash libQt5DBus.so.5()(64bit) >= 5.5 libQt5Gui.so.5()(64bit) >= 5.5 libQt5Qml.so.5()(64bit) >= 5.5 libQt5Quick.so.5()(64bit) >= 5.5 libQt5WebKit.so.5()(64bit) >= 5.5 libQt5WebKitWidgets.so.5()(64bit) >= 5.5 libQt5Widgets.so.5()(64bit) >= 5.5 libQt5X11Extras.so.5()(64bit) >= 5.5 libc.so.6(GLIBC_2.17)(64bit) libdbus-1.so.3()(64bit) qt5-qtdeclarative >= 5.5 qt5-qtquickcontrols >= 5.5 rpmlib(BuiltinLuaScripts) <= 4.2.2-1 rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(PayloadIsXz) <= 5.2-1 [root@localhost ~]#
In the above example, you can see lots of missing dependencies on the screen. You need to install every package before installing teamviewer.
Installing RPM packages with yum command
As you have seen above, you can use rpm command only for installing an independent package.
If you want to install dependent package on CentOS or other rpm based Linux distros like RHEL or Fedora, You will have to use the handy tool called yum where You don’t have to worry about dependencies.
This yum package manager can pull all of the required dependencies and set them up for us.
You can use the yum command to install our downloaded package with the following command:
#yum localinstall package_name.rpm
My syntax as below:
[root@localhost ~]# yum localinstall teamviewer.x86_64.rpm Last metadata expiration check: 0:10:02 ago on Sun 03 May 2020 01:14:59 PM IST. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: teamviewer x86_64 15.5.3-0 @commandline 14 M Installing dependencies: qt5-qtbase x86_64 5.11.1-7.el8 AppStream 3.3 M qt5-qtbase-common noarch 5.11.1-7.el8 AppStream 39 k qt5-qtbase-gui x86_64 5.11.1-7.el8 AppStream 6.0 M qt5-qtdeclarative x86_64 5.11.1-3.el8 AppStream 3.4 M qt5-qtlocation x86_64 5.11.1-2.el8 AppStream 3.0 M qt5-qtquickcontrols x86_64 5.11.1-2.el8 AppStream 1.0 M qt5-qtsensors x86_64 5.11.1-2.el8 AppStream 220 k qt5-qtwebchannel x86_64 5.11.1-2.el8 AppStream 92 k qt5-qtx11extras x86_64 5.11.1-2.el8 AppStream 34 k qt5-qtxmlpatterns x86_64 5.11.1-2.el8 AppStream 1.1 M xcb-util-image x86_64 0.4.0-9.el8 AppStream 21 k xcb-util-keysyms x86_64 0.4.0-7.el8 AppStream 16 k xcb-util-renderutil x86_64 0.3.9-10.el8 AppStream 19 k xcb-util-wm x86_64 0.4.1-12.el8 AppStream 32 k pcre2-utf16 x86_64 10.32-1.el8 BaseOS 228 k qt5-qtwebkit x86_64 5.212.0-0.36.alpha2.el8 epel 13 M Transaction Summary ================================================================================ Install 17 Packages Total size: 46 M Total download size: 32 M Installed size: 191 M Is this ok [y/N]:
After type “Y”, It will install our package along with dependencies.
Remove RPM Package by rpm command
The rpm command works well for removing packages from the system. You can usee the RPM installer with -e and package name to remove (or uninstall) a software package.
Enter the following command syntax into a terminal window:
#rpm -e package_name.rpm
The -e option instructs RPM to erase the software.
Conclusion
I’ve tried my best to cover most of the basic uses of rpm command in Linux to install the rpm package on centOS you can use yum command to doing the same.
For more detailed information, you can check the manual page. To display the manual page use man command from the terminal.
If I’ve missed any important command, please do share it with me via the comment section.