How do I install build-essential without an Internet connection? [duplicate]

Open a Terminal by pressing CTRL+ALT+T and type:

sudo apt-get -qq --print-uris install build-essential linux-headers-$(uname -r) | cut -d\' -f 2 > urls.txt

copy the urls.txt to a thumbdrive and move over to a computer with Internet Access. Download all files from urls.txt (if the other computer is running Linux you can use wget < urls.txt) and save them in a folder called deb on your thumbdrive.

Go back to your Ubuntu machine, plug in the thumbdrive and open a Terminal

sudo cp /media/YOUR_USERNAME/THUMBDRIVE_NAME/deb/* /var/cache/apt/archives/
sudo apt-get install build-essential linux-headers-$(uname -r)