A Bit of Sense

Here I talk about my expericne with computers, software and computer programming. Let me warn you that some of this stuff will be technical. I'll aim to give you fair notice for technical posts.

My Photo
Name:
Location: Massachusetts, United States

Friday, January 30, 2009

apt-cacher - fast upgrades on a network of computers

I am writing up a short 'executive' summary about how to setup apt-cacher-ng to accelerate upgrades by caching packages locally. The title of this post links to the full story where I got all of this information. This should work on any apt/deb based system. This post has been updated to use apt-cacher-ng. Some of the steps may be a bit different.

I am publishing this mostly for my own use. But feel free to make use of this information as well. My settings are a bit different from the example.

To install:

sudo apt-get install apt-cacher-ng

Edit /etc/apt-cacher/apt-cacher.conf and add:

allowed_hosts=192.168.1.0/24
allowed_hosts_6=
expire_hours=12

Edit /etc/default/apt-cacher
AUTOSTART=1

Finally import your debs:

sudo /usr/share/apt-cacher/apt-cacher-import.pl /var/cache/apt/archives
sudo /etc/init.d/apt-cacher restart

sudo cp /etc/apt/sources.list /etc/apt/sources.list.XXX
sudo nano /etc/apt/sources.list

deb http://[servername]:3142/archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse

Check that it is installed correctly: http://localhost:3142/
(assuming localhost is setup correctly in /etc/hosts)

EDIT: There is a new version apt-cacher-ng. It works the same way as apt-cacher, but is more resource efficient and has fewer bugs.

Sunday, January 25, 2009

HOWTO: Update to static IP Address in Ubuntu 8.10 (Intrepid Ibex)

A bug in network manager causes static IP'ed systems to revert to DHCP upon reboot. In fact I haven't gotten network manager to setup static IPs at all.

Here is a work around I found here at
http://www.ubuntugeek.com/how-to-set-a-static-ip-address-in-ubuntu-810-intrepid-ibex.html

I've condensed the solution to the minimum. I the 'x' character is when you should use a number that is correct for your network. If you are using a typical broadband connection w/a router then your numbers may be something like this:

address 192.168.1.40
netmask 255.255.255.0
gateway 192.168.1.1
nameserver 192.168.1.1

Check the numbers before you begin any of the instructions using ifconfig in order to get the IP and netmask. Use route -n to get the gateway and cat /etc/resolv.conf to get the name server(s).

Solution:

Disable network manager at start up:
sudo update-rc.d -f NetworkManager remove

Make a backup of interfaces file:
sudo cp /etc/network/interfaces /etc/network/interfaces.XXX

sudo nano /etc/network/interfaces

You interfaces should look something like this. Comment out the bit of

auto lo eth0
iface lo inet loopback
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx

This second part will probably already be ok, but double check to be sure.

sudo nano /etc/resolv.conf

# Generated by NetworkManager
nameserver xxx.xxx.xxx.xxx(enter your dns server ip)
nameserver xxx.xxx.xxx.xxx(enter your alt dns server ip)