How to Create Your Own Debian Mirror Proxy Using Apt-Cache

Updated on January 25, 2017
How to Create Your Own Debian Mirror Proxy Using Apt-Cache header image


Apt-Cache can be used to cache downloaded Debian/Ubuntu packages without the need for additional server configuration, and is very useful for those who have more than two servers.


  • Debian or Ubuntu
  • 10 Minutes time


Apt-Cache is available in the default Debian/Ubuntu repositories and be installed via apt-get as follows:

apt-get install apt-cacher


Apt-Cache accepts all requests by default; as such, we would need to customize its configuration file, /etc/apt-cacher/apt-cacher.conf as follows:

daemon_port = <THE_DAEMON_PORT>

To block specific hosts, you can use the denied_hosts directive:

denied_hosts = <BLOCKED_IP>

To apply our changes, we have to restart the daemon as follows:

service apt-cacher restart


You can now use your Apt-Cacher by editing the /etc/apt/sources.list file on your server. This is how it would look like on Debian Jessie:

deb http://<INSTANCE_IP>:<DAEMON_PORT>/ jessie main
deb-src http://<INSTANCE_IP>:<DAEMON_PORT>/ jessie main

deb http://<INSTANCE_IP>:<DAEMON_PORT>/ jessie/updates main
deb-src http://<INSTANCE_IP>:<DAEMON_PORT>/ jessie/updates main

deb http://<INSTANCE_IP>:<DAEMON_PORT>/ jessie-updates main
deb-src http://<INSTANCE_IP>:<DAEMON_PORT>/ jessie-updates main

This concludes out tutorial. Thank you for reading.