Install a .deb file in Ubuntu

In this article, we would cover how to install a .deb file in Ubuntu. There are times when packages we need are aren’t available through standard Ubuntu repository. In that case, if we still want to go ahead then we look to install it from other external sources. One of the most common way to install the packages is through .deb files.

It is worth mentioning here that, we advise you to download packages (i.e. .deb files) from trusted sources. And, always prefer to install packages from standard Ubuntu repository when available.

There are two methods which we cover here to install .deb files in Ubuntu –

  1. apt and,
  2. dpkg.

Note: Following operations would require superuser privileges. In case you don’t have one then, we advise you to contact your System Administrator for assistance.

Install a .deb file in Ubuntu

Method I. Here, we use apt to install the .deb file. The following is the syntax for installing .deb files through apt –

sudo apt install ./<package-name.deb>

where, package-name.deb is the .deb file we intend to install.

Its very rare for a package to not have dependencies. Above command will take care of dependencies if those are available through standard Ubuntu repository. Otherwise, we need to install them separately if our system supports.

Method II. The other way to install .deb files is through dpkg. dpkg is Debian’s package manager. The following syntax we follow to install .deb files through dpkg –

sudo dpkg -i <package-name.deb>

where, package-name.deb is the .deb file we intend to install.

If the installation process has got dependency related issues then, issue a separate command –

sudo apt install -f

But, for the above to work just let the installation process to finish first even if with errors. Let it state that we have got dependency related issues. Then, issue the above apt command. This takes of all the dependencies if available through standard Ubuntu repository. Otherwise, we need to install the dependencies separately.

In conclusion, we have covered two methods to install a .deb file in Ubuntu here. We again reiterate that – always install packages from trusted sources. If you want to check how to upgrade packages in Ubuntu using dpkg then, follow the link.