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?

3
  • 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, 2013 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. Feb 1, 2013 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, 2013 at 23:34

2 Answers 2

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

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/

1
  • can you please format a bit your answer? Hard to get which part is code ;)
    – Askar
    Mar 13, 2015 at 6:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .