If you are trying to run an enterprise in Linux, one of the key components needed is a way to automatically deploy and configure Linux on the desktop. With this you can also make a memory test utility available over the network.
With LinuxPXE and Ubuntu you can easily push desktop installs out over the network to computers without CD drives, and have it preconfigure most of your common settings.
You'll need the following components on a server:
tftpd-hpa (TFTP Server) A DHCP Server An Ubuntu Jaunty Alternate CD ISO Image file
Notice I said "tftpd-hpa" - the openbsd-tftpd server will not work for this.
You'll also need an Ubuntu Jaunty desktop with:
system-config-kickstartI'm going to assume a rather high level of network design knowledge in this and not tell you silly things like "you can only have one DHCP server on the network at a time" - wait, I just told you that. Anyway, if you aren't already familiar with configuring an Enterprise grade network then this may go a bit fast for you. TFTP First, configure your TFTP server. You must edit /etc/default/tftpd-hpa to enable it:
#Defaults for tftpd-hpa RUN_DAEMON="yes" OPTIONS="-l -s /var/lib/tftpboot"
Now start it with:
sudo /etc/init.d/tftpd-hpa restartDHCP In your DHCP server for your scope you need two configuration settings:
filename "pxelinux.0"; next-server 192.168.1.100;
(The previous assumes your TFTP server is at 192.168.1.100)
If you're using a Windows DHCP server, you need options 66 and 67 for this.
There's three components to a network install image. First is the PXE boot menu system, second is the PXE install loader files, and third is the actual install image. Since the installer is separate from the PXE boot system, you can use the same boot menu to install multiple versions of Linux - for instance I have a config for a 32 bit desktop, 64 bit desktop and a 64 bit server. The Jaunty 32-bit PXE boot image loads them all.
The ISO install image
We also need to store the contents of the install CD on the Apache server - I'm going to assume this will be the same server as the tftp server.
To extract the files we need, we want to mount the ISO image file, so assuming your console is already root and in the directory where the ISO image is located do:
mkdir /media/ubuntu mount -o loop -t iso9660 ./ubuntu-9.04-alternate-amd64.iso /media/ubuntu mkdir /var/www/ubuntu.904.amd64 cp -R /media/ubuntu/* /var/www/ubuntu.904.amd64/ cp -R /media/ubuntu/install/netboot/* /var/lib/tftpboot/ cp /media/ubuntu/install/mt86plus /var/lib/tftpboot/ umount /media/ubuntu rmdir /media/ubuntu
This copies the install media to the web server, and the boot image to the TFTP server. If you're using a different Ubuntu disc, the mt86plus file might be named something else.
Now we're halfway there. We need to create a hands-free installation configuration file. This is where the Kickstart config utility you installed on your desktop comes in.
Run Kickstart from the Applications + System Tools menu. From here you can configure many aspects of your installation. Make sure you click the "Installation Method" tab and change it to HTTP. Fill in the IP address of your Apache server and the path to the install media as such:
HTTP Server: 192.168.1.100 HTTP Directory: /ubuntu.904.amd64/
Poke through and change any other configurations you might need. In the hard drive partition setup I first create a partition for swap and tell it to use the recommended size, then I create a partition for / and tell it to use the remaining space. This allows my image to use the entire hard drive in the system regardless of size of RAM or hard drive.
Unfortunately a bug in the Kickstart Configurator keeps us from choosing packages to install, so we'll need to do those later by manually editing the cfg file after saving it in Kickstart Configurator.
After saving the file, open it up with gedit and scroll to the bottom. We need to add the packages we want installed.
To get a list of system rolls, from your desktop you can run:
tasksel --list-tasksThis lists a series of tasks that can be used when configuring an Ubuntu machine. In this instance we want to create a Gnome desktop install, so we will use "ubuntu-desktop". At the very bottom of the ks.cfg file add:
%packages ubuntu-desktop wget
The "" before ubuntu-desktop specifies a machine role - one of the roles chosen from the tasksel option above. Without the you're telling it to install a specific package. Any packages you specify here must be on the CD image because it won't go out to the standard repositories to install anything at this point.
After editing, place this file at /var/www/ on the Apache server that's serving your install image.
Configure the network boot menu
Next we configure the PXE boot menu.
Using your favorite editor (I'm partial to vi) open /var/lib/tftpboot/pxelinux.cfg/default
default ubuntu-installer/i386/boot-screens/vesamenu.c32 prompt 0 timeout 0 label Jaunty 9.04 64bit Desktop kernel ubuntu-installer/amd64/linux append vga=normal ks=http://192.168.1.100/ks.cfg initrd=ubuntu-installer/amd64/initrd.gz -- label Memtest kernel mt86plus
This gives us two options when we boot over the network - install Jaunty 64 bit, or test the memory of the local computer.
Now just activate the PXE boot option for the computer you want to install Ubuntu on and away you go!
If you want multiple install images, you can copy the ubuntu-installer directory over to the TFTP server but named differently, for instance use "hardy-installer" instead of "ubuntu-installer" if you also want a Hardy LTS image on the same TFTP server. Then, just edit the menu options appropriately to point to the kernel and initrd in the new directory.
My next post will detail how to do a bit more customization after the fact on the first boot of the machine.
Don't forget to read part 2 tomorrow: Automatic Configuration of Linux Desktops.