Skip to content

How to reinstall a package using apt-get? – Debian/Ubuntu

JA linux apt get force yes 108



The APT or Advanced Packaging Tool works on both Debian and Ubuntu. It is an excellent command line tool in ubuntu Linux for installing, updating, reinstalling, and removing the deb packages.

This page answered these Frequently asked questions:

  • How to fully reinstall a package on debian?
  • How do I force reinstall apt?
  • How do I reinstall an application in Linux?
  • How do I reinstall a program in Ubuntu?
  • Why apt-get install not working?
  • How do I fix programs not installing?
  • How to reinstall APT package?
1. How to update and upgrade the ubuntu using terminal?


apt-get force reinstall package

The --reinstall the flag is a quick command for reinstalling the packages with installing time.

sudo apt-get install --reinstall <PkgName>

2. how do I force reinstall apt package?


for example, if you want to apt-get install reinstall the apache2 package. The syntax is:

sudo apt-get install --reinstall apache2

if you want to apt-get install reinstall multiple packages at once

sudo apt-get install --reinstall <PkgName1> <PkgName2> <PkgName3>

suppose you apt-get reinstall force nginx, htop at once

sudo apt-get install --reinstall nginx htop 

3. Why apt-get install not working?

please update and upgrade your apt packages by entering this command

sudo apt-get update && sudo apt-get upgrade -y

or visit this page for detailed instructions and different methods of installing and upgrading ubuntu packages

4. Reinstall the package and its installed dependencies

If you want to apt-get install force reinstall the packages and check all dependencies run this apt-cache command:

apt-cache depends <package>

Using the results of that command, we get the following one, which re-installs <package> and its dependencies:

for a detailed and customized command to get the dependencies

apt-cache depends <package> | grep Depends:

The apt get force reinstall dependencies

using the aptitude command you can forcefully update or install all dependencies

the command is

sudo aptitude reinstall <pkg>
5. What if I want to reinstall all packages?

if your want to update your all packages please enter the aptitude command

sudo aptitude reinstall '~i'

The Short Note:

In this tutorial, we learned the different ways to reinstall the packages using different commands. you can enter the below commands to see the hard core manual of apt-get utility

man apt-get

Still, have any doubt reading the force installing the packages feel free to comment now

Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *