From Out There


Archive for June, 2007

Automated GNU/Linux Installation CDs by the Truckload

Saturday, June 23rd, 2007

A few days ago, HP unveiled the latest version of their LinuxCOE (Linux Common Operating Environment). In as few words as possible, LinuxCOE allows you to set up a web page where you can make customized GNU/Linux installation CDs that can install a Linux distribution without any human interaction. This is very handy if you often have a lot of PCs to set up with GNU/Linux, and it is especially useful if those PCs all have varying hardware characteristics (different hard drive sizes etc.). If you want to see LinuxCOE in action, check out Instalinux, which is powered by LinuxCOE, and generate your own CD immediately 🙂

What your finished CD will do is start an installer and retrieve, via some sort of network connection, the installation packages for the distribution of your choice. It will set up the system according to the settings you entered when you generated the CD image. That means that each CD can preconfigure a PC’s specific IP address (or DHCP of course), create user accounts with predefined passwords, partition the target hard drive according to predefined settings etc.

There are of course network setup systems and configuration management systems that have done similar things before and that fall into the same software category, usually even cutting out the CD and providing a way of network booting the machine you’re setting up. LinuxCOE is not directly competing in that arena. The killer feature here lies in the configurability of each and every CD image it generates. Profiles can be saved so the same settings can be consistently applied to several images, value-adds can be dynamically selected and added to a base CD and much more. Another killer feature is distribution support: LinuxCOE supports generating images for over 100 GNU/Linux distributions.

But let’s get to the meaty part: How to install LinuxCOE 4. At the time of writing, there were only two ways to install: straight from the CVS version or from CVS snapshots. There were no file releases at SourceForge yet. Debian packages are also not available, but perhaps someone is already working on them.

Prerequisites

You need a system with the following tools:

  • Web server with CGI support (Apache 2.0 is a good choice)
  • Perl interpreter
  • mkisofs
  • The sudo system

All of these are available as packages for Debian.

1. Retrieving the installation files via CVS

After logging in to the CVS server (see CVS area on SourceForge for instructions), make sure you check out two things: the base SystemDesigner module and at least one distribution you would like to generate CDs for. In this example, I’m getting the package that generates Ubuntu CDs.

 
cvs -z3 -d:pserver:anonymous@linuxcoe.cvs.sourceforge.net:/cvsroot/linuxcoe co -P SystemDesigner
cvs -z3 -d:pserver:anonymous@linuxcoe.cvs.sourceforge.net:/cvsroot/linuxcoe co -P SystemDesigner-Ubuntu

2. Reading the README

You should have a SystemDesigner/README file now. It’s a good idea to take a short look at that, even though I am going to walk you through the installation steps.

3. Customize configuration file

Change into the SystemDesigner directory. There, edit the file config.site to suit your needs. You can specify where to install the files for the web site, which user your web server runs as etc. The defaults that HP chose are all correct for Debian. Be aware that LinuxCOE rather aggressively installs some parts of the system into /var/www, including the directory where ISO images are generated. If your /var partition is rather small, make sure to customize that particular option. Most of the system is installed under /usr/local/systemdesigner/4, so you won’t have to worry too much about cluttering up your filesystem.

4. Make sure that your web server user can mount things

This is a bit of a critical step: your web server user (normally www-data) needs to be able to mount things. This is accomplished via sudo without a password. If you plan to install LinuxCOE on a very public web server, make sure you either run LinuxCOE’s own web server as a completely seperate user or make other arrangements for security. Giving the regular old web user mount privileges might not be such a great idea, security-wise, on a typical web server.

Use visudo to give www-data these privileges and add an entry like so:

# LinuxCOE SystemDesigner needs to mount/unmount
www-data ALL = NOPASSWD: /bin/mount, /bin/umount

5. Install base system

SystemDesigner is not installed via the usual ./configure && make && make install run that we’re all used to. Instead, this is how it’s documented in the INSTALL file. In the SystemDesigner directory:

export CONFIG_SITE="./config.site" && ./configure --help
export CONFIG_SITE="./config.site" && ./configure

If all went well (watch error output), that will generate the makefiles we can now use. Let’s go ahead and install, still in the SystemDesigner dir:

make
make install
make integrate

That last step is crucial! Also, the last two steps only work as root, since they write to various system locations (unless otherwise specified).

6. Install distribution-specific files

Now we’ll have to integrate the distribution-specific files we’ve downloaded earlier. Change into their directory, in this example, SystemDesigner-Ubuntu, and follow the instructions in the INSTALL file:

export CONFIG_SITE="/usr/local/systemdesigner/4/etc/includes/config.state" && ./configure --help
export CONFIG_SITE="/usr/local/systemdesigner/4/etc/includes/config.state" && ./configure
make
make install

If you’ve installed the base system to somewhere other than /usr/local/systemdesigner/4, you’ll just have to change the path accordingly, of course.

7. Add a geographically closer mirror

We don’t want to pound your chosen distribution’s main download servers, so let’s add a closer mirror to the config file for your distribution. Again, the example uses Ubuntu. Edit /usr/local/systemdesigner/4/osvend.d/Ubuntu and add a mirror address:

OSVEND archive.ubuntu.com Ubuntu Feisty i386 HTTP /ubuntu/
OSVEND ch.archive.ubuntu.com Ubuntu Feisty i386 HTTP /ubuntu/

The second line is the new one in this case, the main archive.ubuntu.com entry is there by default.

8. Restart web server and look at website

Now you should be ready to restart your web server and look at the fruits of your labor:

/etc/init.d/apache2 restart

Browse to http://yourwebserveraddress/systemdesigner and start making CD images!

9. burn CDs and test

All the work up until now would have been idiotic if we weren’t going to use those CDs. So find an old PC or something else where you can wipe the drive clean, stick the CD in and watch the magic. It’s quite amazing to see a machine install itself without any form of human interaction, especially if you’re used to the way this is normally done, via network distribution and configuration management. The CD route is a slick alternative that offers its own range of flexible options.

Where to go from here?

The admin guide contains a more in-depth explanation of every feature, especially how to customize the CDs that are generated. Also, you can give your LinuxCOE installation its own distinct look via editing the template HTML files.

If you end up using the system a lot on your network, don’t forget to implement some way to save bandwidth. Pulling those file packages off the distributor’s mirrors is not just a little rude, but also unneccessary. Stick a caching proxy between your LinuxCOE server and the outside world or, even better, build your own mirror of the distro’s repository. If you have enough resources, you could even make your mirror available to others in your location. Whichever method you choose, I’m sure you’ll have a lot of fun with your own little flock of custom CDs.