How to reinstall an installed package using YUM/DNF in linux ?
In this post, we will see how to reinstall any installed package in Linux using Yum or dnf.
1. Check out the package and version available to install/reinstall.
[ngeroot@ngelinux01 grub2]# yum list all | grep -i kernel abrt-addon-kerneloops.x86_64 2.1.11-60.el7 @rh7-updates-Server kernel.x86_64 3.10.0-1160.31.1.el7 @rh7-updates-Workstation kernel.x86_64 3.10.0-1160.71.1.el7 @rh7-updates-Server kernel.x86_64 3.10.0-1160.90.1.el7 @rh7-updates-Server kernel.x86_64 3.10.0-1160.99.1.el7 installed
2. Reinstall the package now
[ngeroot@ngelinux01 grub2]# yum reinstall kernel.x86_64 Loaded plugins: product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Skipping the running kernel: kernel-3.10.0-1160.90.1.el7.x86_64 Resolving Dependencies There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help). --> Running transaction check ---> Package kernel.x86_64 0:3.10.0-1160.31.1.el7 will be installed ---> Package kernel.x86_64 0:3.10.0-1160.71.1.el7 will be installed ---> Package kernel.x86_64 0:3.10.0-1160.99.1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================== Package Arch Version Repository Size ============================================================================================================================== Reinstalling: kernel x86_64 3.10.0-1160.31.1.el7 rh7-updates-Server 50 M kernel x86_64 3.10.0-1160.71.1.el7 rh7-updates-Server 50 M kernel x86_64 3.10.0-1160.99.1.el7 rh7-updates-Server 52 M Transaction Summary ============================================================================================================================== Reinstall 3 Packages
3. Specify package with version number
[ngeroot@ngelinux01 grub2]# yum reinstall kernel-3.10.0-1160.99.1.el7.x86_64 Loaded plugins: product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Resolving Dependencies There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help). --> Running transaction check ---> Package kernel.x86_64 0:3.10.0-1160.99.1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================== Package Arch Version Repository Size ============================================================================================================================== Reinstalling: kernel x86_64 3.10.0-1160.99.1.el7 rh7-updates-Server 52 M Transaction Summary ============================================================================================================================== Reinstall 1 Package Total download size: 52 M Installed size: 66 M Is this ok [y/d/N]: y Downloading packages: No Presto metadata available for rh7-updates-Server kernel-3.10.0-1160.99.1.el7.x86_64.rpm | 52 MB 00:00:02 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : kernel-3.10.0-1160.99.1.el7.x86_64 1/1 Verifying : kernel-3.10.0-1160.99.1.el7.x86_64 1/1 Installed: kernel.x86_64 0:3.10.0-1160.99.1.el7 Complete! [ngeroot@ngelinux01 grub2]#