Monday, September 12, 2016

How to Install DEB package with All Necessary Dependencies Automatically

When you are installing .deb packages with dpkg -i command, it does not automatically install necessary dependencies. For example, when I was trying to install Dropbox client on my freshly installed Ubuntu, I get
$ sudo dpkg -i dropbox_2015.10.28_amd64.deb 
Selecting previously unselected package dropbox.
(Reading database ... 211659 files and directories currently installed.)
Preparing to unpack dropbox_2015.10.28_amd64.deb ...
Unpacking dropbox (2015.10.28) ...
dpkg: dependency problems prevent configuration of dropbox:
 dropbox depends on python-gtk2 (>= 2.12); however:
  Package python-gtk2 is not installed.

dpkg: error processing package dropbox (--install):
 dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160701-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 dropbox

This is quite annoying. One solution is to remove Dropbox and install dependency first and re-install Dropbox. This process is outlined here for Google Chrome installation, but the same holds for any other .deb packages.

Well, it turns out that there is a good utility that will do this for you automatically. Try this!
$ sudo apt-get install -y gdebi
...
$ sudo gdebi dropbox_2015.10.28_amd64.deb Reading package lists... Done
Building dependency tree        
Reading state information... Done
Reading state information... Done
Requires the installation of the following packages: python-gtk2 

cloud synchronization engine - CLI and Nautilus extension
 Dropbox is a free service that lets you bring your photos, docs, and videos
 anywhere and share them easily.
 .
 This package provides a command-line tool and a Nautilus extension that
 integrates the Dropbox web service with your GNOME Desktop.
Do you want to install the software package? [y/N]:y
Fetched 0 B in 0s (0 B/s)                                            
Selecting previously unselected package python-gtk2.
(Reading database ... 218142 files and directories currently installed.)
Preparing to unpack .../python-gtk2_2.24.0-4ubuntu1_amd64.deb ...
Unpacking python-gtk2 (2.24.0-4ubuntu1) ...
Setting up python-gtk2 (2.24.0-4ubuntu1) ...
Selecting previously unselected package dropbox.
(Reading database ... 218162 files and directories currently installed.)
Preparing to unpack dropbox_2015.10.28_amd64.deb ...
Unpacking dropbox (2015.10.28) ...
Setting up dropbox (2015.10.28) ...
Please restart all running instances of Nautilus, or you will experience problems. i.e. nautilus --quit
Dropbox installation successfully completed! You can start Dropbox from your applications menu.
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160701-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...

Much easier, right?

No comments:

Post a Comment