I have a Windows machine with internet and an Ubuntu 16.04 machine without an internet connection, and I need build-essentials to compile some of my code. I've read about it online, but I'm having trouble finding a documented way of doing this. What are my options for installing build-essentials offline?

1 Answer 1


In your Ubuntu machine run:

apt-get install build-essential  --print-uris -y | grep -Po "http.*?deb"

it gives you a list of links to deb package (build-essential and its dependecies).

Download them using Windows and finally move them into:


then again run:

sudo apt install build-essential

to install it.

  • From your first command, I get the follow " E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)."
    – ryan
    Commented Jun 19, 2017 at 19:11
  • so you've got some dependencies issue, check this out: askubuntu.com/questions/140246/… it might be helpful to you.
    – Ravexina
    Commented Jun 19, 2017 at 19:13
  • I've looked at this article, but not getting anywhere.. Any suggestions? I've ran sudo apt-get clean and sudo apt-get -f install. Sometimes I get 'Ubuntu-Server 16.04.2 LTS Xenial Xerus - Release amd64 (20170215.8)' in the drive '/media/cdrom/' and press [Enter], but I'm on a VM
    – ryan
    Commented Jun 19, 2017 at 19:52
  • Ok, fixed the above issue. Now your initial command just yields: E: Unable to locate package build-essential
    – ryan
    Commented Jun 19, 2017 at 19:55
  • If you have the installation CD/USB key they are likely on it, so just add the CD/key to your software sources. You don't tell which VM application you are using but if it's VirtualBox you should be able to tell Windows to share the CD or key with the VM.
    – xenoid
    Commented Jun 19, 2017 at 20:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .