Monday, January 26, 2015

Using gdebi to install and resolve dependencies for a local deb file

Debian comes with over 37,500 packages in its default distribution. Yet, occasionally, we still need to install a package which has not made it into the default distribution.

If your current system already has all the prerequisite packages installed, then life is good. You simply download the deb file, and install it with the dpkg command:

$ sudo apt-get update
$ sudo dpkg -i somelocal.deb

But, if you run into package dependency problems, you are on your own. The dpkg command does not resolve dependency problems for you.

For a Debian or Ubuntu system, a better way to install a local package is to use the gdebi command. The gdebi command accesses the repositories specified in your /etc/apt/sources.list file to resolve any dependencies.

First, install gdebi by running the following commands.

$ sudo apt-get update
$ sudo apt-get install gdebi

You need to be root in order to run the gdebi command to install a package.

$ sudo apt-get update
$ sudo gdebi somelocal.deb

Using the gdebi command saves you time if you run into dependency problems while installing a local deb package.