Iam a new Debian Linux / Ubuntu Linux LTS user. How do I reinstall a package using apt-get command line? Is there an ‘apt-get force reinstall package’ command? How do I force reinstall apt-get?
The Advanced Packaging Tool (APT) works on both Debian / Ubuntu Linux. It can handle the installation and removal of software including reinstalling packages to fix problems. You need use apt-get command as follows to forcefully reinstall package. This page shows to reinstall packages on an Ubuntu and Debian server or cloud based virtual machine.
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | Linux terminal |
Category | Package Manager |
Prerequisites | apt-get command |
OS compatibility | Debian • Mint • Pop!_OS • Ubuntu |
Est. reading time | 3 minutes |
apt-get force reinstall package
The syntax is as follows for the apt command/apt-get command to force reinstall:# apt-get --reinstall install PackageNameHere
# apt --reinstall install pkg1
# apt-get --reinstall install Package1 Package2
The --reinstall option re-install packages that are already installed and at the newest version. This is also useful when you removed / uninstalled packages like Nginx but want to reinstall it again.
$ sudo mkdir /root/nginx.mmddyyyy/
$ sudo cp -avr /etc/nginx/* /root/nginx.mmddyyy/
How to reinstall a package using apt-get
Let us see some example that shows how to reinstall package and its installed dependencies on a Debian or Ubuntu Linux. The following command will reinstall rsync package. Open a terminal application and then type:$ sudo apt-get --reinstall install rsync
OR# apt-get --reinstall install rsync