Monday, April 23, 2012

CentOS / RHEL: yum Command Reinstall Package

I accidental deleted the configuration file stored in /etc/ directory and the latest backup were made yesterday. How do I resinstall the package using the yum command under RHEL / CentOS Linux server?

You can use the yum command with reinstall option. This will reinstall the identically versioned package as is currently installed. The syntax is as follows:
 
yum reinstall packageName
yum reinstall packageName1 packageName2
 
In this example reinstall a package called keepalived, type:
# yum reinstall keepalived
Sample outputs:
Loaded plugins: product-id, rhnplugin, subscription-manager
Updating certificate-based repositories.
Setting up Reinstall Process
Resolving Dependencies
--> Running transaction check
---> Package keepalived.x86_64 0:1.2.2-2.el6 will be reinstalled
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================
Reinstalling:
keepalived x86_64 1.2.2-2.el6 epel 147 k
Transaction Summary
=================================================================================================================================================
Reinstall 1 Package(s)
Total download size: 147 k
Installed size: 380 k
Is this ok [y/N]: y
Downloading Packages:
keepalived-1.2.2-2.el6.x86_64.rpm | 147 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : keepalived-1.2.2-2.el6.x86_64 1/1
Installed products updated.
Installed:
keepalived.x86_64 0:1.2.2-2.el6
Note: This does not work for "installonly" packages such as RHEL kernels packages.

No comments:

Post a Comment