Download all dependencies of a package on Ubuntu/Debian

UPDATE: Thanks To Julian, Now I know you can simply use

aptitude download ‘?reverse-depends(PKGNAME)’

Awesome.


Hey there!

Several days ago a colleague asked me if there’s a way to download the dependencies of a package in a Debian based distribution, for an offline use.
Sound like an easy task, and after a while of thinking, i got remembered in a tool that used to ship with Ubuntu back in the days, called “Synaptic”, that used to have that tool.

However, there are some cons to that tool. first of all it’s a GUI one (GUI? Eeeeww!”), and second, it downloads only the packages missing to your current installation, so if you’re offline installation dismatch your own one, you’ve got a problem.

So I decided to take it as a challenge, and ended up with a little script I hope will help ya’ll. And you may find it in my github of course…

https://github.com/Ddorda/dl-deb-deps/blob/master/dl-deb-deps.sh

I think it’s pretty much straight-forward code, but if you have any questions you’re more than welcome to ask.

Dor.

4 thoughts on “Download all dependencies of a package on Ubuntu/Debian

  1. aptitude download ‘?reverse-depends(PKGNAME)’

  2. Oh great now my code is useless! how could you do that to me?!
    (Awesome! thanks! 🙂 )

  3. After running the script , it created a folder containing .deb files,
    which one should i run first ?

    what command should i run on a offline ubuntu PC so that they get installed in chronological order .

Leave a Reply

Your email address will not be published. Required fields are marked *