Install downloaded packages in Ubuntu

In this article, we cover how we can install downloaded packages in Ubuntu. Most of us would use standard Ubuntu repositories to install packages. If we have got two systems running the same Ubuntu release. Then, in such a case, we have to download the packages twice.

We consider two scenarios here:

  1. We have downloaded the .deb file and want to install it.
  2. We have already installed/upgraded one system and want to install similar packages in others.

Note: Following operations require Administrative Rights. If you don’t have the necessary rights then contact your System Administrator for assistance.

Install downloaded packages in Ubuntu

We can use either dpkg or apt command-line tool to install packages (i.e. .deb file)

Case I: We have already downloaded the .deb file. Let’s say it was: test-file.deb

Use either of the following commands:

sudo dpkg -i test-file.deb

where -i option installs the package.

or,

sudo apt install ./test-file.deb

We don’t have to require additional commands to install dependencies when we install .deb files through apt. dpkg (Debian’s Package Manager) and apt (Advanced Packaging Tool).

Case II: Let’s say we have two systems running the same Ubuntu release. In that case, it would be wise to install packages in one system and then copy them to the other system to save network data.

The packages which get installed in our system are stored in the directory:

/var/cache/apt/archives

Copy the packages from here to the destination directory:

sudo cp /var/cache/apt/archives/*.deb /destination-directory

Take the packages to another system. The easiest way would be to use Synaptic Package Manager. If you don’t have it then, install:

sudo apt update
sudo apt install synaptic

Launch Synaptic Package Manager. Go to File –> Add Downloaded Packages. Head to the directory where all packages are stored. And, click the Open button. You would notice that the packages we added have now been copied to /var/cache/apt/archives directory.

From here, we can install/upgrade packages.

It is worth mentioning here that, even if we are not connected to the internet. It would still install the packages if all its dependencies are available.

In conclusion, we have covered here how to Install downloaded packages in Ubuntu.

Similar Posts