Install apt-cache-ng to cache packages for Debian’s apt-tool (Ubuntu too).
Install the required software
sudo apt-get update
sudo apt-get install apt-cacher-ng
Setup a static IP address on server machine; in this guide I will use 192.168.1.100.
If you want you can use my minimal acng.conf
file
sudo cp ./cfg/acng.conf /etc/apt-cacher-ng/acng.conf
You’d like to custom the settings below:
In case you will change path settings like CacheDir
, remember to change the ownership and permissions
sudo chown -R apt-cacher-ng:apt-cacher-ng /path/to/folder
sudo chmod -R 2755 /path/to/folder
To add a login to the acng-report’s functions, edit /etc/apt-cacher-ng/security.conf
sudo chmod 666 /etc/apt-cacher-ng/security.conf
sudo echo "AdminAuth: Username:Password" >> /etc/apt-cacher-ng/security.conf
sudo chmod 640 /etc/apt-cacher-ng/security.conf
Once everything is done, check that apt-cacher-ng is configured to start up on boot
sudo systemctl is-enabled apt-cacher-ng
If it is not
sudo systemctl enable apt-cacher-ng
And restart it
sudo systemctl restart apt-cacher-ng
Based on your apt-cache-ng network configurations:
detect-http-proxy
: set yours apt-proxies’ IPs and ports in the format IP:PORT;00aptproxy
: set yours apt-proxies’ IPs and ports in the format IP:PORT (even if they are commented);I used the Server Machine’s IP with the default apt-cacher-ng’s port: 192.168.1.100:3142
.
Copy scripts from cfg/
folder to the apt’s folder
sudo cp ./cfg/detect-http-proxy /etc/apt/detect-http-proxy
sudo chmod 755 /etc/apt/detect-http-proxy
sudo cp ./cfg/00aptproxy /etc/apt/apt.conf.d/00aptproxy
sudo chmod 755 /etc/apt/apt.conf.d/00aptproxy
Now when you’ll run the apt-get update
or apt update
commands, you will see
...
Proxy that will be used: http://192.168.1.100:3142
...
or in case of issues contacting the apt proxy server
...
No proxy will be used
...