Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Say, I have foo-1.2.3.deb which depends on perl and python, however, running command:

dpkg -i ./foo-1.2.3.deb

won't install these dependencies. So I must apt-get install perl python by hand.

How to make dpkg -i install these dependencies for me automatically?

share|improve this question

7 Answers 7

up vote 55 down vote accepted

You can install gdebi-core, which is the command line version of the GDebi package installer from 10.04 and earlier. In the newer versions of Ubuntu, the Software Center is used to install debs, which doesn't have a command line equivalent.

To install a deb package using gdebi, just run:

sudo gdebi my_package_1.0.deb
share|improve this answer

After using dpkg, running the following command helped me to install the dependencies :

sudo apt-get -f install
share|improve this answer
1  
Should I run sudo dpkg -i mypackage.deb again ? –  Muhammad Gelbana Nov 22 '13 at 13:41
3  
After running sudo apt-get -f install my package and it's dependencies were all installed. Running sudo dpkg -i my_package.deb is unnecessary and will just install the package again. –  Gus E Dec 13 '13 at 16:20

Gdebi install gdebi

gdebi installs a deb package and its dependencies. To use it run:

sudo gdebi package.deb

In newer versions of Ubuntu, this is not installed by default, so you will need to install it from the repositories.

See man gdebi for a full list of options.

gdebi is the command line equivalent to the graphical tool of the same name that used to be included by default in Ubuntu. The command for the graphical tool is gdebi-gtk and has similar functionality:

gdebi-gtk

share|improve this answer

running

sudo apt-get install -f

after installing package with dpkg may solve broken depencies (at least man apt-get say so...). Ill update when i will check it.

share|improve this answer
    
Should I run sudo dpkg -i mypackage.deb again ? –  Muhammad Gelbana Nov 22 '13 at 13:42

dpkg doesn't have dependency support. There is a way around it but that would require you to make a local database (and thus you would already know the dependencies) and it is considered obsolete (...).

Does it have to be command line? (server install?) If so also have a look at apt-get -f but be careful: solving dependencies after install could have you end up with a broken system.

gdebi (gui frontend) used to be able to do this but got replaced with USC.

How did you download the .deb. Some of the new 11.04 features is the handling of .deb downloaded from a website: it gets opend in USC so dependencies will be solved by the installer.

EDIT based on comment by andrew: sudo gdebi foo-1.2.3.deb would do the trick!!

share|improve this answer
    
gdebi can still be used for this. Software Center is now just the default app. Also, as Chen Xiao-Long notes, gdebi can also be used on the command line. –  andrewsomething May 4 '11 at 16:26
    
cool! then the question has an answer because gdebi can be used on commandline too it seems. –  Rinzwind May 4 '11 at 16:50

You could create a file dpkg-dep-inst with the following content.

#!/bin/bash

DEBIAN_FILE1=$1
dpkg -i $DEBIAN_FILE1
apt-get install -f

I assume you created the file in your home folder. Make it executable with chmod +x dpkg-dep-inst and move it to /usr/local/bin with sudo cp dpkg-dep-inst /usr/local/bin.

Now you can install the debian package with dependencies automatically with:

sudo dpkg-dep-inst foo-1.2.3.deb
share|improve this answer
    
Use apt-get --yes --fix-broken install and make the fixing automatic. –  Lucas Mar 4 at 18:12

As an alternative to gdebi-gtk you can use Ubuntu Software Center.

Double click on the package and an install button should be available.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.