Author Topic: How to install and configure apt-cacher-ng manually  (Read 1184 times)

niz23

  • Guru
  • ****
  • Posts: 361
    • View Profile
How to install and configure apt-cacher-ng manually
« on: August 25, 2009, 10:18:33 pm »
Hi.

As you might have noticed there is now a apt cache functionality in our alpha to offload your internet connection when doing several updates.
Like when you update your core and later all MDs packages will only be downloaded once.
However it is not automatically installed unless you do a new installation.

For those of you that already have a working 0810 alpha alpha installed you can use this script.
The script below will install apt-cacher-ng on your core.
Then configure all your MDs to use the cache.

I have only tested my script once and it work on my core.


Code: [Select]
#!/bin/bash

echo "installing apt-cacher-ng"
apt-get update
apt-get -y install apt-cacher-ng

echo "Configure your core to use apt-cacher-ng as apt proxy."
echo 'Acquire::http { Proxy "http://dcerouter:3142"; };' > /etc/apt/apt.conf.d/02proxy

echo "Configuring your MDs to use apt-cacher-ng proxy on dcerouter"
DIRLIST="$(ls -d /usr/pluto/diskless/*)"
for i in $DIRLIST; do
  FILE=$i/etc/apt/apt.conf.d/02proxy
  if [ -e $FILE ]; then
    echo "Proxy config already exist in $FILE. Doing nothing!"
  else
    echo "Copying 02proxy to MD located in $i."
    cp /etc/apt/apt.conf.d/02proxy $i/etc/apt/apt.conf.d/02proxy
  fi
done

Name it to whatever.sh and run it with "bash whatever.sh" or "./whatever.sh"

/niz23