Red Hat Package Manager (RPM) is a powerful package management system for installing, upgrading, erasing and verifying software packages through command line.
Firstly you need to download the rpm package you want to install from the official project web page. In my case, I need to install java-1.7.0-openjdk with architecture version: x86_64 1:22.214.171.124-126.96.36.199.el6_8
The rpm file was downloaded from here
The rpm file name is java-1.7.0-openjdk-188.8.131.52-184.108.40.206.el6_8.x86_64.rpm and is stored in the Downloads folder(Default location).
You have to log in as root user in order to install packages using rpm command. If you are a non-root user, use ‘sudo’ before the command.
To install the rpm file,
rpm -ivh <packagename>
sudo rpm -ivh /home/cloudera/Downloads/java-1.7.0-openjdk-220.127.116.11-18.104.22.168.el6_8.x86_64.rpm
To upgrade the rpm file,
rpm -Uvh <packagename>
To erase the rpm file,
rpm -ev <packagename>
For more information about rpm, check the rpm man page