3

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?

Seth
  • 59,332

2 Answers2

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

Carlos
  • 21
  • 2
2

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 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
http_proxy=localhost: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=- http://mirrorlist.centos.org/?release=6\&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...

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

David McNeill
  • 356
  • 2
  • 7