Economy Size Geek - Installation Toolkit

Having the right tools for the job.
Caching Is Good

This brings me to another recommendation—if you are going to be doing a lot of installing or if you have a large collection of Ubuntu boxes, make sure you install an apt cache. There are several solutions for this. One is just to mirror an Ubuntu server to a central server on your network. That seems like a lot of disk space and bandwidth, but it could be worthwhile if you are going to be installing a lot of machines that all use a lot of packages.

In my case, I went with a slightly less resource-intensive solution—an apt caching system. There are a number from which to choose. I originally was leaning toward approx (, because it is supposed to be stable and very easy to use. The problem is that it will allow only one client to update at a time. That's not the end of the world, but I would prefer not to have the limitation.

As a result, I switched to apt-cacher-ng. It has an added benefit of a Web page that shows you the status and how much you have cached, which is very useful for troubleshooting. I had to download the deb from its site ( I installed it on keg since it handles these kind of network services:

cd /tmp
sudo dpkg -i apt-cacher-ng_0.4.2-1_i386.deb 

Unfortunately, keg is running jaunty (I still have more Linux to update). So I actually had to install apt-cacher-ng 0.4 because of a libc conflict.

In the past, when I have installed this kind of software, I always ended up updating the /etc/apt/sources.list file to point to this server. As a result, I often forgot to point new sources at the cache. It turns out that apt provides an easy way to override the location from which you are downloading your debs:

sudo echo 'Acquire::http { Proxy ""; };' >

In this case, I put keg's IP in the configuration, mostly so it would be easy to copy that to other computers on my network. apt-cacher-ng also provides a Web interface to see statistics and do other management. It is available on my file server at You will need to replace the IP in the above configurations with the IP of your apt-cacher-ng server.

Lots and Lots of Vanilla Installs

Now that I have all of this set up, I can install Linux to my heart's content. There is only one problem. Every time I install it, I know I am going to have to spend some time configuring the box to my liking. It's not impossible to get everything set up by hand, but it is incredibly annoying. So the next thing I wanted was a way to customize my install.

I have three different use cases: a standard package I would like installed automatically (MySQL), a nonstandard package I would like installed automatically (Skype) and a piece of software that is not a package that I would like installed automatically (Rubymine).

Two different tools can handle automating the install process—preseeding and kickstart. Preseeding is a technology that comes to Ubuntu from Debian, and it allows you to automate the process of answering questions the installer will ask. Kickstart is a technology from Red Hat, developed to automate installing a Linux system. I have used preseeding for small tasks in the past, and I have used kickstart to automate the installation of a large number of servers. I never really thought about mixing the two technologies together, but it turns out, you can.

You can install a graphical client for generating kickstart configurations by installing the following tool:

sudo apt-get install system-config-kickstart 

Then, you can run the application by going to Applications→System Tools→Kickstart. This allows you to use kickstart's features, but they have added support for calling preseed—meaning you get the best of both worlds.

Figure 3. Kickstart Configurator

This allowed me to go through and preselect things (like defaulting to America/Chicago time zone). An important option is selecting the right source for the location from which to download the packages. If you provide the name of your apt-cacher-ng (in my case and tell it the URL is /, the installation will use your cache automatically, which is the reason you set it up, right?

The screenshot of the Apt-Cache NG reports (Figure 4) shows the cache results after two installs. What the picture does not show is that during the first install, I left to do something else (because of the download speed), but all installs after that went fast enough that I could watch the install process.

Figure 4. Apt-Cache NG Reports

There appears to be a long-standing bug in the tool when it comes to package selection. It does not actually show you a list of packages from which to choose, and you cannot type in packages. (A list of valid groups can be retrieved by executing tasksel --list-tasks). In the end, I used the GUI to generate a basic ks.cfg file. Then, I edited the rest by hand. This allowed me better control over the process.

I used the preseed command to supply my own password to the MySQL server being installed. You can get a list of options available for preseeding by installing a package (debconf-utils), and then use the following command to see what is set:

sudo debconf-get-selections|grep -i mysql 

Each one of these settings can be provided in the preseed section of the ks.cfg.

For the other two cases, I just handled it in the post section, which allowed me to download the files from the network and move them to the right place. Also note, I am getting them directly from the provider. In an actual production environment, I would keep a local copy.

Here is the relevant section of my ks.cfg:

#Package install information 

preseed --owner mysql-server-5.1 
 ↪mysql-server/root_password password qwerty
preseed --owner mysql-server-5.1 
 ↪mysql-server/root_password_again password qwerty

@ ubuntu-desktop 
#Skype dependencies

%post --nochroot
mv /target/etc/rc.local /target/etc/rc.local.orig
echo '#!/bin/bash
cd /root;/root/first_boot
exit 0' > /target/etc/rc.local
cat > /target/root/first_boot << EOF
cd /root
#Fetching skype 
dpkg -i skype-ubuntu-intrepid_2.1.0.47-1_i386.deb
#Fetching Rubymine
mkdir /opt/rubymine 
tar -xz  --strip 1  -C /opt/rubymine/ -f rubymine-2.0.tar.gz
rm /etc/rc.local
mv /etc/rc.local.orig /etc/rc.local
chmod a+x /target/etc/rc.local
chmod a+x /target/root/first_boot



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Uh... Koala???

Dr1fter's picture

How about Lucid Lynx? When was this written again?