How to set up a local apt cache for Ubuntu

RustyRazorblade Consulting RustyRazorblade Consulting
1 min read

Setting up a local cache is a smart idea if you’re going to be running a VM server, whether it be KVM, VirtualBox, or any other option really. I assume the same instructions will work with Debian, but I haven’t tried.

First up - install apt-cacher-ng.

apt-get install apt-cacher-ng

Add this to the bottom of your /etc/services:

apt-cacher 3142/tcp apt-cacher 3142/udp

Edit /etc/default/apt-cacher and set AUTOSTART to 1.

See this post in the ubuntu forums for more details.

Setting up a local cache is a smart idea if you’re going to be running a VM server, whether it be KVM, VirtualBox, or any other option really. I assume the same instructions will work with Debian, but I haven’t tried.

First up - install apt-cacher-ng.

apt-get install apt-cacher-ng

Add this to the bottom of your /etc/services:

apt-cacher 3142/tcp apt-cacher 3142/udp

Edit /etc/default/apt-cacher and set AUTOSTART to 1.

See this post in the ubuntu forums for more details.

Restart the service.

/etc/init.d/apt-cacher-ng restart

Bam! You should now have a fully working apt-cacher-ng service, which will make your updates a ton faster. It will also make it easier for you to bootstrap new VMs if you’re using vmbuilder.

RustyRazorblade Consulting

RustyRazorblade Consulting

Apache Cassandra Consultant and Distributed Systems Expert

Related Posts

Need Expert Help with Apache Cassandra?

Get professional consulting for your distributed systems challenges. Performance optimization, architecture design, and troubleshooting.