PHP development friends all know that before you run apt-get install php7.1-fpm
, you must first add the source
The usual approach is: add-apt-repository ppa:ondrej/php
Originally, there was nothing wrong with this step, but it was too slow! !
So, I would like to ask, how to cache these packages locally?
You only need to add it once. . . I don’t understand you, the slow downloading package is basically a problem with your network
The cache directory of the APT installation software
/var/cache/apt/
You can directly go there to find the software package you just installed.Command to download software package
apt-get download <package-name>
Command to create local source
dpkg-scanpackages /home/ubuntu-local/wily /dev/null |gzip > /home/ubuntu-local/wily/Packages.gz -r
local source
echo "deb http ://localhost/ubuntu-local/wily /" > /etc/apt/source.list.d/local.list
Back up the list of installed software packages
sudo dpkg --get-selections > /home/package.selections
Download software packages in batches according to the software list
for req in $(cat ~/package.selections | cut -f 1 | cut -f 1 -d ":" ); do apt-get download $req; done