Install dependencies for a dpkg package?

All we need is an easy explanation of the problem, so here it is.

I have a dpkg file that i want to install.

But I get error messages that it is depending on other packages.

I used:

dpkg -i file.dpkg

Is there a way to install dependencies automatically without having to use apt-get/aptitude (the latest version of this dpkg wasnt available)

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

If this is a one-off, copy-paste the package names from the dpkg error message to an aptitude install command line. Otherwise, set up an apt repository for your own package, it’s not hard. Here are a few possible methods:

  • If this is for Ubuntu, you can create your own personal package archive. This will make your packages easily available to everyone, so this method is suitable for generally-useful packages but not for in-house stuff.

  • You can set up a local repository using reprepro. It takes a couple of minutes to set up, but after that adding new packages is trivial (reprepro includedeb mydistribution /path/to/my.deb).

  • Another way to set up a local repository is to use apt-ftparchive from the apt-utils package. This is less automated than reprepro.

  • If all you’re doing is patching or recompiling existing packages, apt-build is also an option.

Method 2

You might break dependencies but here is a way to fool apt-get to install your own tar ball.
http://www.debian.org/doc/manuals/apt-howto/ch-helpers.en.html#s-equivs

Method 3

Manually installing missing dependencies can be a pain – which is why tools like gdebi exist:

sudo apt-get install gdebi

sudo gdebi package.deb

This should resolve the dependencies, and install them, all in one go. Note that you may need to add repositories to your apt sources.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply