This article will list a few command line methods that can be used to install standalone “.deb” installers that are not available in official repositories of Ubuntu. Some other useful commands helpful for handling “.deb” packages will also be covered. So let’s jump in.

List All Dependencies of a Deb File

To view information about a “.deb” file and all of its dependencies, run the command below:

$ dpkg -I /path/to/file.deb

The example below shows information about persepolis download manager “.deb” file.

How to Manually Install a Deb Package Using Command Line in Ubuntu Debian ubuntu Utilities

This command is specially useful if you want to check what is being installed beforehand.

List All Files That will be Installed From a Deb Package

To see all files that a “.deb” package will install on your system along with their destination paths, run the command below:

$ dpkg-deb -c /path/to/file.deb

The example below shows files that will be installed on the system if you manually install persepolis download manager “.deb” package. Note that Ubuntu’s apt package manager also lists included files but requires you to install the package first. However, this method doesn’t require you to install the “.deb” package and it is really useful if you want to analyze which file goes where.

How to Manually Install a Deb Package Using Command Line in Ubuntu Debian ubuntu Utilities

Extract All Files from a Deb Package

Sometimes you may want to extract a deb package to check a piece of code or use some of its included files for debugging and other purposes. To extract all files from a deb package, you can run a command in following format:

$ dpkg-deb –extract /path/to/file.deb

Note that extracting files is not the same as installation of a deb package. You will just get extracted contents of a “.deb” package in a local folder.

Install a Deb File Using Dpkg

Dpkg is a package management utility for managing “.deb” (debian) packages. To install a “.deb” package using dpkg, run the command below:

$ sudo dpkg -i /path/to/file.deb

The above command will install the standalone deb package only, without any dependencies. To fix this, you will have to run a command to auto-install required dependencies. Otherwise your system may be left in a broken state. To fix the unmet dependency issue, run the command below:

Install a Deb File Using Gdebi

Gdebi is a nice command line and graphical application solely dedicated for installing standalone “.deb” packages stored on your local drive. It automatically resolves dependencies as well, as long as they are available in official Ubuntu repositories (requires network connection).

To install gdebi in Ubuntu, run the command below:

To install a “.deb” package using Gdebi, run the command below:

$ sudo gdebi /path/to/file.deb

Since gdebi will take care of installation of dependencies, you don’t have to manually run another command to fix broken packages. However, if you want to check if there are broken packages or not and fix them automatically, you can run the command mentioned above again:

Using Apt to Install a Deb Package

You can also use Ubuntu’s default “apt” package manager to install standalone “.deb” files. To do so, run the following command:

$ sudo apt install /path/to/file.deb

If you launched terminal inside the directory of “.deb” file, run following command instead:

$ sudo apt install ./file.deb

Like gdebi, apt will automatically install all the required dependencies. To confirm, run the command below:

Conclusion

These are a few commands you can use to install “.deb” files without using any graphical interface. They are useful if you are running and managing Ubuntu server edition or using Ubuntu without any desktop environment.

About the author

How to Manually Install a Deb Package Using Command Line in Ubuntu Debian ubuntu Utilities

Nitesh Kumar

I am a freelancer software developer and content writer who loves Linux, open source software and the free software community. I maintain a blog that lists new Android deals everyday.