A Quick Performance Boost Tip for Foreman

It doesn’t make sense to continually download the same operating system packages when you can cache them along side your Foreman installation. Assuming you use a debian based OS, in order to do this and have a cached copy of all packages you use within your infrastructure simply install apt-cacher or apt-cacher-ng. Our preference is for apt-cacher-ng but we’ll show you how to install both.

# Installing apt-cacher-ng

[gist id=3720930]

You shouldn’t have to adjust the configuration of apt-cacher-ng for the basic functionality it offers, however if you need to adjust settings in `/etc/apt-cacher-ng/acng.conf`.

# Installing apt-cacher

[gist id=3718168]

Then set the contents of `apt-cacher-conf` to:

[gist id=3718171]

***Note:*** you might want to change the hostname of the ubuntu mirror and interface (eth1 is specific to previous articles on Foreman)

Reports are created every 24 hours, which can be accessed at `http://$FOREMAN:3241/report`. To force the creation run:

[gist id=3718175]

# Configuring Foreman
Once you have setup apt-cacher you can then create a new Foreman “Installation Media Source”. Simply supply a sensible name and importantly set the URL of that installation media source to `http://$FOREMAN:3241/ubuntu`, where $FOREMAN is either the IP or FQDN of your Foreman host.


Leave a Reply

Your email address will not be published. Required fields are marked *