Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

2 Answers

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: https://bugs.launchpad.net/ubuntu/+source/apt-cacher-ng/+bug/1006844

share|improve this answer
add comment

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

http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os

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

Set wget to use your apt-cacher-ng proxy

cat ~/.wgetrc

apt-cacher-ng

http_proxy=localhost:3142

Tell wget to get the same file, but note the extra \'s to escape the '&' to get the full url to wget

wget --output-document=- http://mirrorlist.centos.org/?release=6\&arch=x86_64\&repo=os

Answers back with 403 error as above, or correct with list of mirrors...

ttp://mirror.xnet.co.nz/pub/centos/6.4/os/x86_64/ ...

share|improve this answer
add comment

Your Answer

 
discard

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.