This question already has an answer here:

I have a Ubuntu Server setup, and it doesn't have internet, so I'm downloading packages from http://packages.ubuntu.com and installing them manually (instead of using apt-get).

But the problem is, some of the package dependencies just doesn't install! For instance, the build-essential package depends on another package which depends on five other packages and so on.

It's going to take me an hour to click all the download links and download all of them.

What should I do?

marked as duplicate by Eliah Kagan, karel, Rinzwind, Eric Carvalho, Panther Jun 15 '14 at 20:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • you could install the dependencies through gdebi. But it needs an internet connection. – Avinash Raj Jun 14 '14 at 17:05
  • @AvinashRaj which is exactly what I don't have..... or else I would use apt-get – Louis Hong Jun 14 '14 at 17:06
  • @Creator who said I was satisfied? – Louis Hong Jun 14 '14 at 17:49
  • @Louie ignore it not for you – Chinmaya B Jun 14 '14 at 17:51

Use the following command to list everything a package needs for its installation and then download all of them:

$ sudo apt-get --print-uris --yes install <package-name> | grep ^\' | cut -d\' -f2 > downloads.list

And read this if you need more information.

  • then from where are you downloading packages?? – Chinmaya B Jun 14 '14 at 17:52
  • This is very useful, but this assumes I have another linux machine with internet. But I really can't ask for more I guess. I'll wait a bit and if there isn't anything beter I'll choose you – Louis Hong Jun 14 '14 at 17:53
  • Yes, my question assumes I have another machine with internet, sadly my other machine does not run linux, but I guess you're answer is pretty good already, I'll install linux on my other machine just to run this line..... – Louis Hong Jun 14 '14 at 17:54
  • doesn't work on 16.04, grep: invalid argument ' for '--directories' – Yaakov Ainspan May 3 '17 at 19:31

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