Last active
April 19, 2022 04:21
-
-
Save nayyaung/afaedbbcd14864cba150a8f6ce9dd99c to your computer and use it in GitHub Desktop.
Create offline apt package to install on Linux system without internet access
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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