I want to download a package and all of its dependencies that I would typically use
apt-get to install on Ubuntu. How do I download a package and its dependencies locally on Ubuntu? I am using Ubuntu 14.04 and Ubuntu 16.04 for this tutorial.
How to Download Ubuntu Packages and Dependencies Locally
We require Internet access to download the packages locally. First, we should always update our package sources.
sudo apt-get update
Afterwards, we should make a directory to store the packages that we want to download.
Now, we download the package inside that directory. For instance, let’s say that we wanted to download
vim and not install it. Where
vim is, you can replace with the name of any package available through
for i in $(apt-cache depends vim | grep -E 'Depends|Recommends|Suggests' | cut -d ':' -f 2,3 | sed -e s/'<'/''/ -e s/'>'/''/); do sudo apt-get download $i 2>>no32.txt; done
Any errors will be outputted inside
no32.txt. If you
ls, then you should see all of the deb packages and dependencies.
libacl1_2.2.52-1_amd64.deb libc6_2.19-0ubuntu6.9_amd64.deb libgpm2_1.20.4-6.1_amd64.deb libpython2.7_2.7.6-8ubuntu0.2_amd64.deb libselinux1_2.2.2-1ubuntu0.1_amd64.deb libtinfo5_5.9+20140118-1ubuntu1_amd64.deb no32.txt vim-common_2%3a7.4.052-1ubuntu3_amd64.deb vim-doc_2%3a7.4.052-1ubuntu3_all.deb vim-runtime_2%3a7.4.052-1ubuntu3_all.deb vim-scripts_20130814ubuntu1_all.deb
How to Install .deb Files
sudo dpkg -i *
Errors are processed in