How to re-install a RPM Package using rpm and yum of same version ?

Sometimes we change some file of a rpm package and want to rollback the changes by re-installing the RPM package.

However if you do rpm -Uvh or yum install/update, it will not install the package.

For this we need to use other options with RPM and YUM. First lets see the RPM way.

1. Re-install same version RPM through rpm command.
If you do rpm -Uvh or rpm -ivh, it will not update/reinstall the RPM.

[root@nglinux yum.repos.d]# rpm -Uvh remi-release-6.rpm 
Preparing...                ########################################### [100%]
	package remi-release-6.9-1.el6.remi.noarch is already installed

[root@nglinux yum.repos.d]# rpm -ivf remi-release-6.rpm 
Preparing packages for installation...
	package remi-release-6.9-1.el6.remi.noarch is already installed

Now if i add “–force” derivative it will install the RPM forcefully:

[root@nglinux yum.repos.d]# rpm -ivh remi-release-6.rpm --force
Preparing packages for installation...
remi-release-6.9-1.el6.remi

This is the process of re-installing the RPM using rpm command.

However the recommended way is to do this via YUM.

2. We can achieve this with yum using “reinstall” derivative as seen in below command.

[root@nglinux installcd]# yum reinstall yum
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Reinstall Process
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * epel: epel.mirror.net.in
Resolving Dependencies
--> Running transaction check
---> Package yum.noarch 0:3.2.29-81.el6.centos will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================
 Package                                 Arch                                       Version                                                     Repository                                Size
===============================================================================================================================================================================================
Reinstalling:
 yum                                     noarch                                     3.2.29-81.el6.centos                                        base                                     1.0 M

Transaction Summary
===============================================================================================================================================================================================
Reinstall     1 Package(s)

Total download size: 1.0 M
Installed size: 4.6 M
Is this ok [y/N]: 

I hope you liked the article. Subscribe to the blog from left side menu to receive mails of new articles.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments