Installing the boot- and installserver

Abstract

This chapter provides step by step descriptions on how to install the central system that can be used to install a development workstation using Kickstart and PXE.

Setting up the hardware

Important

In the final situation the specifications of hardware suitable for a boot- and installserver may be part of the information stored in the DSL. The DSL will also contain documentation on how to set up such a server. The pages you are now reading are preliminary versions and limit themselves to the prototype situation.

I set up a Compaq Evo (type D510 SFF) as my server and connected a monitor, keyboard and mouse to it. You may want to do the same.

Now, boot the server and press the F10 key. This will bring you into the setup menu. Choose 'English' as your language. Then select FileSystem->Information and check the product name to be sure you have the proper hardware type (Compaq Evo D510 SFF). If you need it (for example to give it to your DHCP administrator) you can also find the MAC address of the internal NIC here under the label "Integrated MAC". Set up the following:

  • Storage->Boot Order

             Compaq Ethernet controller: First;
             IDE-CD-ROM Drive: Second;
             Hard Drive (C:): Third;
             Diskette Drive (A:): Fourth;
             USB Device: Fifth
             

  • Security->Network Service Boot->enable

  • Power->Energy Saver->disable

  • Advanced->Power-On Options->POST Mode->QuickBoot

You may want to save this configuration on a floppy disk for future use[8].

Installing the operating system

We decided to use Red Hat 9 for our installation server. For now I assume that this is the first boot- and installserver installed in your network - otherwise you could use another boot- and installserver to install this one. You need to obtain the first three CDROMS of the Red Hat version 9 distribution, either from the Internet or from other sources. Insert the first CDROM in the CDROM drive of the server and reboot the server. We assume you have installed Linux before and will only provide the important details:

Type of Installation: choose the Custom Installation.

Partitioning information: all partitions will have the ext3 filesystem. The suggested partioning table:

mountpoint    size (Mb)  type
------------  ---------  --------------------
none          suggested  swap
/boot         100        ext3 - primary
/usr          4000       ext3
/             350        ext3
/var          4000       ext3
/opt          2000       ext3
/tmp          350        ext3
/export/data  the rest   ext3 
------------  ---------  --------------------

Tip

Red Hat's Disk Druid is not the most practical partitioning tool, since it only allows you to specify start- and end cylinders. If you would prefer to use fdisk - which allows specifying sizes instead of offset in cylinders - use the following workaround: if the installer prompts you with the choice whether to use Disk Druid or to use the automatic setup, you can use Ctrl+Alt+F2 to switch to a console withu a bash prompt. You can issue the fdisk there to set up the partition table. After writing the table, switch back to the graphical installer using Ctrl+Alt+F7 and choose to use Disk Druid. The partitioning table you just created will be properly read by Disk Druid. You do not have te recreate it, just assign filesystem type and mount point.

Firewall settings: disable the firewall

Timezone: Europe/Amsterdam

Bootloader: MBR. If given a choice, select GRUB as your bootloader.

Network: if you just want to set up a proof of concept, feel free to choose any method you want, but make sure your infrastructure supports it. For production environments I suggest a fixed IP address and proper entries in the DNS system.

Password : set a root password and a user password.

Packages: the following groups can be selected[9]:

     Administration Tools
     Authoring and Publishing
     Development Tools
     Dialup Networking Support
     Editors
     XEmacs
     Engineering and Scientific
     GNOME Desktop Environment
     GNOME Software Development
     Graphical Internet
     Graphics
     KDE Desktop Environment
     KDE Software Development
     Kernel Development
     Office/Productivity
     Printing Support
     SQL Database Server
     Server Configuration Tools
     Sound and Video
     System Tools
     Text-based Internet
     Web Server
     X Software Development
     X Window System
     

The groups are listed by the installer and can be (de-)selected by ticking the box in front of them. For each group you will also be presented with a link marked detailed selection. By clicking these you are given a chance to refine your selection. You need to install the following additional packages:

     Editors
       vim-X11
     SQL Database Server
       php-mysql
       mysql-server
       mod_auth_pgsql
       php-pgsql
       mod_auth_mysql
       php-odbc
     Text-based Internet
       lynx
     Server Configuration Tools
       dhcp
     

Configuration of the system

Now, your system should have rebooted and you are presented with a login screen. Log in as root and start up the Red Hat network configuration. Fill in the IP addres you obtained.

Next, change the default runlevel from '5' into '3'. Find the line in /etc/inittab that starts with the keyword id and change it into:

id:3:initdefault:

Edit the runlevel directory /etc/rc3.d/. As usual you need to create symbolic links to the startupfiles /etc/init.d. For example, S20nfs and K20nfs should be symlinks to /etc/init.d/nfs. You should check and if neccessary create these links[10]:

K05saslauthd   K35dhcpd      K70aep1000    S14nfslock   S55sshd
K12mysqld      K35smb        K70bcm5820    S17keytable  S56rawdevices
K15httpd       K35winbind    K74ntpd       S20nfs       S56xinetd
K15postgresql  K36lisa       K95firstboot  S20random    S90crond
K20nfs         K45named      S015httpd     S21dhcpd     S95anacron
K24irda        K50snmpd      S10network    S25netfs     S95atd
K25squid       K50snmptrapd  S12syslog     S26apmd      S99local
K34dhcrelay    K50tux        S13portmap    S28autofs                         

If you systems do not have access to a DNS server - if you have created a stand-alone setup, for example - you need to edit the /etc/hosts file. Mine looked like this:

192.168.10.10   klinker.xyz.test klinker
192.168.10.11   kiezel.xyz.test  kiezel

Creating and accessing the KS Tree

The packages we will need to install our client must be made available over NFS. Create/edit the file /etc/exports and add this line:

/export/data    (ro,insecure,all_squash,sync)

Now start up nfs:

/etc/init.d/nfs start

Log in some other system to test it. Mount the filesystem. Check if it is mounted (mount). You should not be able to write to the filesystem. To test it use i.e.,:

# mount -t nfs klinker.xyz.test:/export/data /mnt/klinker/
# cd /mnt/klinker
# echo "test" > test
bash: test: Read-only file system
# _

Next, back on the bootserver, create the directory /export/data/Kickstart and put a Kickstart configuration file in there. That file describes the installation parameters for our client. To learn more about Kickstart files, you should read the Red Hat Installation Guide.

Red Hat offers the Kickstart configurator which is a graphical front end that will allow you to set parameters and create a Kickstart configuration file. I used another method: I created a base installation file by installing a client by hand. The installation prodecure will create a Kickstart configuration file (/root/anaconda.ks.cfg) which I copied over to the server. You may want to fine-tune that file by hand. In my case, since I did the installation from CDROM, the generated file did not contain the line that refers to the proper nfs installation server. I had to change the section on partitioning to force partitioning of the drives instead of adapting the existing partitioning. I also added a reboot statement to ensure the client would automatically reboot after installation. This is the file I used:

# Initial try at the KS file for a Linux development stations
#
# $Id:$ 
# 
#This will be a complete installation 
#
install
# The location of the RedHat 'install tree' (a integral copy of the CD's). 
nfs --server 192.168.10.10 --dir=/export/data/RedHat-9-install-tree
#
lang en_US.UTF-8
langsupport --default en_US.UTF-8 en_US.UTF-8
keyboard us
mouse generic3usb --device input/mice
xconfig --card "Intel 845" --videoram 16384 --hsync 30-82 --vsync 56-76 --resolution 1024x768 --depth 24 --startxonboot  --defaultdesktop gnome
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$iHVJ5ejF$I/RcXDoYzhnnXrKvuJAHk/
firewall --high --dhcp --port=123:tcp --port=123:tcp --port=http:tcp --port=ssh:tcp
authconfig --enableshadow --enablemd5
timezone --utc Europe/Amsterdam
bootloader --location=mbr
zerombr yes
clearpart --linux
part /boot --fstype ext3 --size=100 --asprimary
part /usr --fstype ext3 --size=4000
part / --fstype ext3 --size=350
part /var --fstype ext3 --size=4000
part /opt --fstype ext3 --size=2000
part swap --recommended
part /tmp --fstype ext3 --size=350
part /export/data --size=1 --fstype ext3 --grow
reboot
%packages
@ Administration Tools
@ Authoring and Publishing
@ Development Tools
@ Dialup Networking Support
@ Editors
@ XEmacs
@ Engineering and Scientific
@ GNOME Desktop Environment
@ GNOME Software Development
@ Graphical Internet
@ Graphics
@ KDE Desktop Environment
@ KDE Software Development
@ Kernel Development
@ Office/Productivity
@ Printing Support
@ SQL Database Server
@ Server Configuration Tools
@ Sound and Video
@ System Tools
@ Text-based Internet
@ Web Server
@ X Software Development
@ X Window System
vim-X11
php-mysql
mod_auth_pgsql
php-pgsql
lynx
mysql-server
php-odbc
mod_auth_mysql
mysql
perl-CGI
perl-DBD-MySQL

%post

I saved this file as /export/data/Kickstart/kiezel.ks.cfg.

This is the line that tells the client where to find the packages and what protocol to use to access them:

...
# The location of the RedHat 'install tree' (a integral copy of the CD's). 
nfs --server 192.168.10.10 --dir=/export/data/RedHat-9-install-tree
...

The --server option should be followed by the IP address (or DNS name) of your bootserver. The --dir option refers to the directory where Kickstart tries to find its source files. We will create and populate it next.

Copy packages into the Install Tree

You will need the 3 CD-ROM's again.

First, create the directory where the tree will start:

# mkdir /export/data/RedHat-9-install-tree/ 

For each CD-ROM, execute the following commands:

# mount /mnt/cdrom 
# cp -var /mnt/cdrom/RedHat/ /export/data/RedHat-9-install-tree/
# umount /mnt/cdrom       

The system may complain about double incarnations of TRANS.TBL and ask you whether or not to overwrite it. You can safely choose to overwrite (or even remove) the file.

Adding your own packages

The %post section in the Kickstart configuration file can be used to execute you own commands at the end of the installation. The installation tree will be be mounted as /mnt/source/ and the newly installed Red Hat system under /mnt/sysimage.

Warning

The instructions you put in the %post section are executed in a chrooted environment, unless you specify the --nochroot option.

To add your own packages I suggest you create a directory just below the main install tree (e.g., postinstall) and place your own packages there. Because the Install Tree is mounted automatically during installation, the installer will also have access to that directory. The actual installation instructions should be added in the %post segment in the Kickstart file.

For example, assuming you have installed your install tree in /export/data/RedHat-9-install-tree, you could create a postinstall directory /export/data/RedHat-9-install-tree/postinstall, which would be accessible as /mnt/source/postinstall. during installation. Let us assume you have put one personal package there, in RPM format, named foo.rpm. To actually install that package, you would have this section at the end of your kickstart file:

... other lines ...

%post --nochroot
rpm --root /mnt/sysimage -i /mnt/source/postinstall/foo.rpm  

You can use many commands in the %post section, but some restrictions apply. You may, for example, not be able to use DNS and some commands may not be available. Consult the the Red Hat Installation Guide for details.

Installing tftpd

Previously we installed all rpm's on our system in an install tree. So, to install the tftp server you simply can issue these commands:

# cd /export/data/RedHat-9-install-tree/RedHat/RPMS
# rpm -i tftp-server-0.32-4.i386.rpm

Next, create or edit the file /etc/xinetd.d/tftp:

service tftp
{
	disable			= no
	socket_type		= dgram
	protocol		= udp
	wait			= yes
	user			= root
	server			= /usr/sbin/in.tftpd
	server_args		= -s /tftpboot
	per_source		= 11
	cps			= 100 2
	flags			= IPv4
}

Restart the xinetd:

# /etc/init.d/xinetd restart

To test this, you can create some file in the directory /tftpboot, e.g. the file test and, from another system can issue the command:

$ echo "get test" |tftp name-of-your-boot-server-here
tftp> Received ... bytes in 0.1 seconds
tftp> $ _

Installing the bootloader

The default Red Hat 9 installation includes syslinux. Part of syslinux is the pxelinux.0 bootloader (it can be found in /usr/lib/syslinux). You should copy it in the /tftpboot directory, so it can be accessed by the tftp client, which is part of the PXE environment.

However, the version of pxelinux included with Red Hat 9 seems to contain a bug: when instructed to boot from local disk, the system will refuse to do so and hang. I worked around this by installing and building the source code of a newer version of the syslinux package (version 2.04).

Important

In the following paragraphs I briefly describe how to build a new bootfile. I used my laptop to build the new loader, in effect defining it "on the fly" as a proper development environment. Keep in mind that this is not the proper way to do this. The proper way would be to build the loader in a well defined environment, which was build from data in the DSL. And the resulting loader would of course become part of the proper environments defined in the DSL.

pxelinux.0 can be build in a Linux environment but it requires that nasm is installed on that system. You require version 0.98.32 or later. For more information and the source code you can visit the nasm site . The (simple) installation instructions are part of the source code, but basically you just

$ ./configure
$ make
$ make strip
.. be root ..
# make install

After you installed nasm, change into the source code directory of syslinux and type

$ make clean
$ make pxelinux.0
$ _

This should give you a working version of the bootloader. Copy it over to the directory /tftpboot on the server.

Installing the bootkernel and related image

Now we need to install the initial bootkernel and the image that contains the Linux network drivers (and more). Insert the first CDROM from the RedHat installation and issue these commands:

# mount /mnt/cdrom
# cd /mnt/cdrom
# cp images/pxeboot/vmlinuz /tftpboot/
# cp images/pxeboot/initrd.img /tftpboot/

Installing pxeboot configuration files

# mkdir /tftpboot/pxelinux.cfg

Create a file /tftpboot/pxelinux.cfg/default:

default linux
label linux
localboot 0

Create a file /tftpboot/pxelinux.cfg/netboot. Note, that in the example below the append line should not contain the line continuation marks (\) - they were added to make the line more readable. It should be one (long) line. Of course, the nfs option should contain the proper IP address of your installation server and it should include the correct name for the Kickstart file you created before:

default linux
label linux
  kernel vmlinuz
  append ksdevice=eth0 console=tty0 load_ramdisk=1 \
     initrd=initrd.img \
     ks=nfs:192.168.10.10:/export/data/Kickstart/kiezel.ks.cfg

Configure DHCP

To enable a client to boot from the bootserver, you need to configure dhcp. The default configuration file can be found in /etc/dhcpd.conf. I created a file like this to enable client kiezel.xyz.test to boot from our bootserver:

option domain-name "xyz.test";
ddns-update-style ad-hoc;
allow bootp;
allow booting;
deny unknown-clients;

subnet 192.168.0.0 netmask 255.255.0.0 { }

host kiezel.xyz.test {
         hardware ethernet 00:0B:CD:64:08:EB;
         fixed-address 192.168.10.11;
         option host-name "kiezel.xyz.test";
         filename "pxelinux.0";
}

The line hardware ethernet contains the MAC address of the client, the line filename specifies which bootfile to load.

Important

Now you have completely installed the server. You should reboot it and check that all services come up properly.



[8] and you guessed it: the image of such a floppy should be part of the DSL too.

[9] this list probably contains far too many packages and should be weeded out.

[10] this list too should be revised and weeded out