Skip to content

Instantly share code, notes, and snippets.

@nayyaung
Last active April 19, 2022 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nayyaung/afaedbbcd14864cba150a8f6ce9dd99c to your computer and use it in GitHub Desktop.
Save nayyaung/afaedbbcd14864cba150a8f6ce9dd99c to your computer and use it in GitHub Desktop.
Create offline apt package to install on Linux system without internet access
# Reference: https://stackoverflow.com/questions/22008193/how-to-list-download-the-recursive-dependencies-of-a-debian-package
# download the dependencies into a directory
apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances <your-package-here> | grep "^\w" | sort -u)
# package them
dpkg-scanpackages . | gzip -9c > Packages.gz
# copy all downloaded *.deb and Packages.gz from previous step to your target machine
# create deb on target system without internet access
echo "deb [allow-insecure=yes] file:<your folder here> ./" | sudo tee -a /etc/apt/sources.list
# update repository
sudo apt-get update
# install the package you downloaded
sudo apt-get install <your-package-here>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment