In this post, I will explain you the usage of RPM (Red Hat Package Manager) command with an example. RPM commands are widely used in Linux operating system to install, remove or update the packages on operating system.
RPM (Red Hat Package Manager) is a default open source and package management utlity which is widely used on Redhat, CentOS linux operating system. You can install , remove, upgrade the packages using this commnad. In this post We will explain each syntax with an example so you can understand how this command is very useful on linux operating system. So here, we will explain best 20 example which is related to Red Hat Package Manager.
1. How to Check an RPM Signature Package:
This command with syntax is used for to check the PGP signature of packages before installing them on your Linux systems and make sure its integrity and origin is fine.
[root@locahost]# rpm --checksig vsftpd-2.2.2-14.el6.x86_64.rpm
vsftpd-2.2.2-14.el6.x86_64.rpm: rsa sha1 (md5) pgp md5 OK
2. How to Install an RPM Package:
Using below syntax you can install the rpm packages on the linux system.
[root@localhost]# rpm -ivh vsftpd-2.2.2-14.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:vsftpd ########################################### [100%]
On the above syantx we are using "-i" option to install the rpm packages on Linux operating system.
3. How to check dependencies of RPM Package before Installing:
If you want to check which packages or dependency is required for RPM packages then you can run the below command to check the dependency.
[root@localhost]# rpm -qpR samba-winbind-3.6.23-12.el6.x86_64.rpm
Here, you can find the syantx meaning of the above command.
-q : Query a package.
-p : List capabilities this package provides.
-R: List capabilities on which this package depends.
4. How to Install a RPM Package Without Dependencies:
If you want to install the packages without any dependency please use the below syntax.
[root@localhost]# rpm -ivh --nodeps samba-winbind-3.6.23-12.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:Samba-winbind ########################################### [100%]
The above command forcefully install rpm package by ignoring dependencies errors, but if those dependency files are missing, then the program will not work at all, until you install them.
5. How to check an Installed RPM Package:
If you want to check which RPM package is installed on the operating system then please use -q option with package name.
[root@localhost]# rpm -q samba
package samba is not installed
If you see the samba packages is not installed on my system so it is show you this message.
[root@localhost]# rpm -q vsftpd
vsftpd-2.2.2-14.el6.x86_64
You can see the above ftp server packages is installed on the system.
6. How to Upgrade a RPM Package:
If you want to upgrade any RPM packages then please use "-U" syntax with rpm name.
[root@localhost]# rpm -Uvh vsftpd-3.0.2-11.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:vsftpd ########################################### [100%]
If you see the above example the packages is upgrade with the new version of vsftpd.
7. How to Remove a RPM Package:
If you want to uninstall or remove the package from the server then please use "-e" erase option is used to remove package.
[root@localhost]# rpm -evv vsftpd
Using above command we can remove the packages with all dependency.
8. How to Remove an RPM Package Without Dependencies:
If you want to remove installed packages without any dependecy then use the below syntax to remove the rpm.
[root@localhost]# rpm -ev --nodeps vsftpd
Using above syntax "--nodeps" we can remove the packages without dependency.
9. How to Import an RPM GPG key:
If you want to import the RPM GPG key then please verify RHEL/CentOS/Fedora packages, you must import the GPG key.
[root@localhost]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
So using above syantx we can import the GPG key on the server.
10. How to List all Imported RPM GPG keys:
To print all the imported GPG keys in your system, use the following command.
[root@localhost]# rpm -qa gpg-pubkey*
gpg-pubkey-0608b895-4bd22942
gpg-pubkey-7fac5991-4615767f
You can see the above entry these are the GPG key which is installed on the server.
No comments:
Post a Comment