Install packages on a standalone Linux environment without Internet

Zing Zai
1 min readJan 29, 2020

Transfer Linux packages from online to offline envs

Linux Penguin

Pre-requisites

  1. PC #1: Ubuntu machine with Internet access;
  2. PC #2: Ubuntu machine without Internet access (target machine)
  3. Storage Media: To transfer packages from PC #1 to PC #2.

PC #1 (Online)

URLS=$(sudo apt-get install PACKAGE_NAME --print-uris -qq | sed -n "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/ \1/p")for URL in $URLS
do
axel $URL
done
  • Create a file (download.sh) and paste in the contents below;
  • Replace PACKAGE_NAME with package name(s) ;
    (E.g. install vim build-essential)
  • Open Terminal and execute the script (./download.sh)
  • Copy downloaded packages from PC #1 to Storage Media;

PC #2 (Offline)

  • Insert Storage Media to PC #2;
  • Open Terminal and execute sudo dpkg -i *.deb;
  • Packages will be installed automatically;

Acknowledgements

Full script can be found, here.

--

--