How to test rpm package before installation

In this tutorial we will know, how to test rpm package before installation .You may have seen while installing the rpm package file by using rpm -i command, some problem may occur. It can be issue with dependency,GPG signature or corrupt rpm package etc.

As a Linux System Engineer,this command is very useful and should be in regular practice.
Mostly I use this command,it helps me to know before if there is any issue in rpm package installation.

Note: rpm command available in Red Hat based operating system.

How to test rpm package

To test the rpm package before installation we will use the --test option with rpm command.
The command will not install rpm package but it only test the rpm package.

Syntax:
Replace the PACKAGE-NAME.rpm with actual rpm package name in your system.

rpm -ivh --test PACKAGE-NAME.rpm

Example: In this example, we are testing epel-release-6-8.noarch.rpm file. But here it will not install this file.
By using rpm -qa|grep epel , we are verifying if epel-release-6-8.noarch.rpm is installed.Blank output shows ,epel-release-6-8.noarch.rpm is not installed.

As well as,you can see there is no error message is shown.Hence, we can install epel-release-6-8.noarch.rpm

[root@localhost ~]# rpm -ivh --test epel-release-6-8.noarch.rpm 
Preparing...                ########################################### [100%]
[root@localhost ~]# 
[root@localhost ~]# rpm -qa|grep epel
[root@localhost ~]# 
[root@localhost ~]# 

2 thoughts on “How to test rpm package before installation”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.