Vizible’s Blog

Caching with apt-proxy

Posted in Tips by wearetherock on May 5, 2008

When you have to install package on multiple machine, there are many solution possible, I have one elegant method to do that by using apt-proxy, apt-proxy can caches the packages you download from the internet, then you can access the packages from other computers on your network, If not found specific package in the cache, apt-proxy automatically download and cashes it.

Today, I used this method with my computers, because in the lab I have many machine that can’t connected to outside world, I have only one machine that has 2 NIC, first NIC connected to outside and another connected to switch.

A few step to do that

Server
Ubuntu Server 7.10
eth0 : 10.80.26.14 (this interface can connected to outside world)
eth1 : 192.168.1.101 (connected to switch)

Client
Ubuntu Server 7.10
eth0 : 192.168.1.102 – 192.168.1.106 (all connected to the same switch)

Server
1. Install apt-proxy on Server

sudo apt-get install apt-proxy

2. Edit apt-proxy configuration file in /etc/apt-proxy/apt-proxy-v2.conf
insert remote repositories into “backends” section, I inserted two line

[ubuntu]
backends = http://archive.ubuntu.com/ubuntu

do nothing any more

3. Initialize apt-proxy

sudo /etc/init.d/apt-proxy restart

Clients
1. Edit /etc/apt/source.list specific repository URL with references to server like this

deb http://192.168.1.101:9999/ubuntu gutsy main restricted multiverse universe

9999 : a default apt-proxy port
ubuntu : backend section that found in /etc/apt-proxy/apt-proxy-v2.conf on server

2. Update package list

sudo apt-get update

3. start installation

sudo apt-get install package_name

bye.

Advertisements
Tagged with:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: