Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I am using VirtualBox with Ubuntu 12.04 as the host and CentOS 6.3 as the guest OS. apt-cacher-ng is configured on the host OS for caching the packages.

I did a bit of googling, but could not figure out how to cache the CentOS guest packages on the Ubuntu host using apt-cacher-ng. How to configure this?

Also, what is the preferred approach to cache the packages in CentOS?

share|improve this question
Are you aware that CentOS uses Yum repositories? It's a completely different design from APT repositories, so I doubt that you'll get this to work. Would setting up a regular HTTP proxy such as Squid also do the job for you? – gertvdijk Feb 1 '13 at 17:10
CentOS doesn't use apt, at least not by default, does it? If so, apt-cacher-ng isn't going to help you. You'll need to start with the CentOS method to cache packages, and then see about getting that method to work on Ubuntu. Or alternatively, take a look at more general web caching with squid. – Robie Basak Feb 1 '13 at 17:10
apt-cacher-ng works for caching rpm's out of the box, but is supposedly buggy. I'm experimenting with it now. I did find that you have to tell your CentOs install to use the proxy: edit your /etc/yum.conf file to include the line proxy=yourhost:yourport – SW1 Apr 7 '13 at 23:34

2 Answers 2

It's been working ok for me using the latest apt-cacher-ng on 12.04 from the backports (sudo apt-get install apt-cacher-ng/precise-backports). Otherwise you need to edit the VfilePattern in acng.cnf to add some of the centos/rhel patterns.
See this for more info:

share|improve this answer

Backports version contains more fixes than just the one listed in the bug above. If you just use the Precise ordinary version (with the fix above), you get the following error

403 Forbidden file type or location

Because the first thing Centos does is check for local mirror locations with this

And something in that URL is not liked by apt-cacher-ng.

The Precise backports version fixes this issue.

You can verify you have (or have fixed) the issue from your Ubuntu machine with these steps.

1) Firstly, set wget to use your apt-cacher-ng proxy

nano ~/.wgetrc

# wget run control file for current user
# tell wget to use a proxy, apt-cacher-ng which listens on 3142

2) Now ask wget to retrieve the mirror file. Note the extra \'s to escape the '&' to get the full url to wget

wget --output-document=-\&arch=x86_64\&repo=os

3) This will answer back with either 403 error as above (problem not yet fixed), or a correct list of mirrors...

share|improve this answer
can you please format a bit your answer? Hard to get which part is code ;) – oscar Mar 13 at 6:17
Done, thanks for the tip. – David McNeill Sep 17 at 3:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.