When you install Red Hat Linux, the configuration that you selected is saved in anaconda-ks.cfg , in the /root directory. In this section, we ll break down an example of this file from my desktop computer. The start of this file is shown in Figure 5.1.
Each Kickstart file can be divided into several categories of commands. We ll look at my anaconda-ks .cfg file in the following sections. The order of commands in your Kickstart file may not match what you see here.
Once you ve finished editing this file, save it as ks.cfg . You ll learn how to set it up on a floppy disk toward the end of this chapter.
You can set up parameters for your installation. For example, you might note the date and time the installation started. The /etc/motd file is shown each time you log into Linux:
#pre echo "My Kickstart Installation started on `/bin/date`" >/etc/motd
Preinstallation commands should be placed near the end of your Kickstart file, just before any %post installation commands you might have.
More extensive scripts are of course possible, but they are limited by the commands available through the disk with the Kickstart file. As you ll see toward the end of this chapter, the Kickstart file is normally copied to the Red Hat installation boot disk, which includes a basic kernel with a limited number of bash shell commands.
Only a few basic commands are required to start the Red Hat Linux installation process. The following commands are taken from my anaconda-ks.cfg file:
install lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 keyboard us mouse genericwheelps/2 --device psaux timezone America/New_York bootloader --location=mbr --append hdc=ide-scsi
If you re planning to install Linux on a series of other computers, it s best if you re using the same language, keyboard type, and mouse. If that s your situation, you probably won t make any changes. But just in case, let s examine these commands, one at a time.
The first command looks simple; in fact, it s too simple to support an automated installation. In other words, this command doesn t specify the source of the Red Hat installation files:
install
You could set up Kickstart to look for installation files on your CD or from a hard drive with one of the following commands:
cdrom harddrive --partition=hdb1 --dir=/install
For the purpose of this section, let s assume that the /RedHat installation directory is part of the /install directory and that the server has an IP address of 192.168.0.1.
The harddrive command looks for the /RedHat directory on the second IDE hard disk on your computer, on the first primary partition ( hdb1 ), in the /install directory. Or you could install from an NFS shared directory from the remote computer with the following command:
nfs --server=192.168.0.1 --dir=/install
Alternatively, you can install from Red Hat installation files on a remote FTP or web server, using one of the following commands:
url --url ftp://username:password@192.168.0.1/install url --url http://192.168.0.1/install
If you re installing from an anonymous FTP server, the username and password are not required.
Tip | If you re installing Red Hat Linux with a static IP address configuration, some computers may have trouble finding installation files from the network. You can set up DHCP access, using the commands described in the Network Settings section later in this chapter. |
The next commands specify the language to use during the installation process, as well as the language files to install with Red Hat Linux. For example, the following command installs Red Hat Linux using standard U.S. English:
lang en_US.UTF-8
A number of other language codes are available; you can find a list in the locale.alias file in the /usr/X11R6/lib/X11/locale directory. If you re running an automated installation, you probably won t see any of the installation screens, anyway. However, to install U.S. English as the language you see when you start Red Hat Linux, use the following command:
langsupport --default en_US.UTF-8 en_US.UTF-8
Other available languages include French ( fr_FR ), German ( de_DE ), and Korean ( ko_KR.eucKR ). The language you installed on your computer should be shown in your anaconda-ks.cfg file. You can choose from several other languages; check the Red Hat Linux customization guide, which is available on the Red Hat documents CD or online from www.redhat.com .
Note | To get to the online Red Hat Linux 9 manuals, navigate to www.redhat.com/docs/manuals/linux/RHL-9-Manual/ . |
The keyboard command in your Kickstart file is straightforward. The standard U.S. keyboard requires the following command:
keyboard us
The keyboard command in your anaconda-ks.cfg file should match your installation. But just in case, several dozen types are available, such as French ( fr ) and Spanish ( es ). A complete list is available in the Red Hat customization guide.
The mouse command in your Kickstart file represents your pointing device. It could be a touchpad or a tablet. For example, the following command represents a generic PS/2 mouse, connected to the standard PS/2 port ( psaux ):
mouse genericwheelps/2 --device psaux
If you want to configure a two-button mouse to emulate a third middle button, add the --emulthree switch to the end of this command. As described in Chapter 03 , pressing the two mouse buttons together functions as a third button.
There are other mouse types, such as a standard USB mouse ( genericusb ), a Microsoft mouse ( microsoft ), or a Logitech mouse ( logitech ). A complete list is available in the Red Hat customization guide.
The timezone command is straightforward; it specifies the time zone associated with your computer. If Linux is the only operating system that you re installing, you should set the hardware clock to Greenwich Mean Time ( --utc ), which allows Linux to handle changes for daylight saving time. A typical timezone command looks like this:
timezone --utc America/New_York
Note | UTC stands for Universal Coordinated Time, which satisfies those who don t want to refer to the city of Greenwich in the United Kingdom. |
You need a bootloader such as GRUB or LILO to start Red Hat Linux. The bootloader command specifies the location, along with other kernel parameters that may be required:
bootloader --location=mbr --append hdc=ide-scsi
This command tells Kickstart to install your bootloader on the Master Boot Record ( mbr ). It also sends a configuration message to the kernel, for a CD-Writer. It allows Linux to make the secondary master IDE drive ( hdc ) look like a SCSI drive ( ide-scsi ).
Note | For more commands that you can --append to the kernel, run the man bootparam command. |
The graphics command in a Kickstart file, xconfig , can appear complex. It s easier than it looks. Since you don t have to configure an X Window system in Red Hat Linux, the xconfig command isn t required.
Let s analyze the xconfig command from my Kickstart file:
xconfig --card "Intel 810" --videoram 16384 ? --hsync 30-85 --vsync 50-160 --resolution 800x600 ? --depth 24 --startxonboot --defaultdesktop gnome
This specifies a specific video card, the Intel 810. If your other computers also have the same card and monitor, you should be able to keep these settings for your Kickstart file. However, in case you need to make changes, we ve listed some xconfig settings in Table 5.4.
Setting | Description |
---|---|
--card " name " | Specifies the make and model of the video card |
--videoram amount | Notes the amount of video RAM |
--hsync range | Lists the range for horizontal frequency, in KHz |
--vsync range | Lists the range for vertical synchronization, in MHz |
--resolution hor x vert | Specifies the resolution on the monitor |
--depth num | Notes the number of colors per pixel |
--defaultdesktop gnome | Sets up GNOME as the default GUI desktop |
--startxonboot | Starts the X Window when installation is complete |
--noprobe | Specifies that the installation process should not probe the monitor |
Tip | If you don t want to configure the X Window with this Kickstart file, add the skipx command. Otherwise, Anaconda stops the installation process to let you configure the X Window. |
In this section, we assume that you have a network card in your computers. But in most cases, the Kickstart process uses Red Hat installation files from a remote computer on a network. Therefore, you ll need a command similar to the following to configure a network card on your computer:
network --device eth0 --bootproto dhcp
This command assumes that you have an Ethernet network card, and a DHCP server on your network. If the DHCP server is on a remote network, you ll need to use the BOOTP protocol; just replace dhcp with bootp in the previous command. For more information on Ethernet, see Chapter 20 ; for more information on DHCP servers and BOOTP, see Chapter 24 .
Alternatively, you could specify static IP address information. As you ll recall from Chapter 03 , that includes an IP address ( --ip ), network mask ( -- netmask ), gateway address ( --gateway ), and the IP address of a DNS server ( --nameserver ). You can also specify the hostname ( --hostname ) for this computer with the following command:
network --device eth0 --bootproto static --ip 192.168.12.20 --netmask ? 255.255.255.0 --gateway 192.168.12.11 --nameserver 207.217.126.81 ? --hostname RH9test
Note | The network command in a Kickstart file must be on one line. |
Every Red Hat Linux installation requires you to set a root password. This is a simple command, which can be configured in one of two ways:
rootpw Big747Ap rootpw --iscrypted $ZIvDlQpJ$ptS2UJkTRngOTacYN22vR1
The first method includes the password in clear text, which is acceptable if you re using a local Kickstart file. However, it s possible to use a remote Kickstart file; in that case, it s best to encrypt the password, as we ve done in the second example.
You can configure a firewall in the Kickstart file. As you ve seen during the installation process, there are three basic firewalls:
firewall --high firewall --medium firewall --disabled
Assuming you want a standard high-security firewall, you can customize it. For example, if you have two network cards, eth0 and eth1 , you may want to disable the firewall on one of the cards with the following command:
firewall --high --trust=eth1
There are several standard services that you can let through your firewall, including DHCP configuration messages ( --dhcp ), Secure Shell connections ( --ssh ), Telnet connections ( --telnet ), incoming e-mail ( --smtp ), incoming requests for web pages ( --http ), and incoming connections to an FTP server ( --ftp ).
You can let other services through the firewall, as long as you know the port number and associated protocol. For example, the following command sets up a high-security firewall that allows outside requests for regular and secure web pages:
firewall --high --http --port 443:tcp
The numbers are TCP/IP ports that are defined in /etc/services , as described in Chapter 20 .
Authentication involves checking the credentials of a user . Normally, this means just the username and password. However, you can configure this process in a number of ways. The default Kickstart command sets up shadow passwords with MD5 encryption:
authconfig --enableshadow --enablemd5
Several authentication options are available. For example, you can set up NIS support ( --enablenis ), specify the NIS domain name ( --nisdomain= name ), allow Kerberos passwords ( --enablekrb5 ), and check passwords on a Samba or Microsoft Windows server ( --enablesmbauth ). More options are shown in the Red Hat Linux customization guide.
When Anaconda writes your configuration to anaconda-ks.cfg , the hard drive settings are disabled by default. If you re satisfied with the following commands, delete the hash marks ( # ) to activate them:
#clearpart --linux --drives=sda #part /boot --fstype ext3 --size=100 --ondisk=sda #part / --fstype ext3 --size=700 --grow --ondisk=sda #part swap --size=192 --grow --maxsize=384 --ondisk=sda
The first command ( clearpart ) deletes all data from any existing Linux-formatted partitions ( --linux ) on the first SCSI hard drive ( sda ). A standard server installation deletes all data from all formatted partitions ( --all ).
The next command sets up a partition ( part ) for the /boot directory. It s to be formatted ( --fstype ) to the ext3 filesystem, with a size of 100MB, on the first SCSI hard drive ( --ondisk=sda ).
The next command configures the root ( / ) directory with a size of at least 700MB on the first SCSI hard drive. However, the growable flag ( --grow ) is set, which allows the partition to fill available space on the first SCSI hard drive.
The final command in this set configures the swap partition, with a size of at least 192MB and a maximum size ( --maxsize ) of 384MB on the first SCSI hard drive.
More extensive hard drive configurations are possible. For example, the following commands configure separate partitions for the /boot , /usr , /home , root ( / ), and /var directories, as well as a swap partition:
#clearpart --linux #part /boot --fstype ext3 --noformat --onpart hda2 #part /usr --fstype ext3 --size=2500 #part /home --fstype ext3 --size=1000 #part / --fstype ext3 --size=1000 #part /var --fstype ext3 --size=500 #part swap --size=256
Furthermore, the following commands configure a RAID array of four different partitions and two physical volumes suitable for Logical Volume Management (LVM):
#part raid.44 --size=100 #part raid.42 --size=100 #part raid.40 --size=100 #part raid.38 --size=100 #part pv.36 --size=100 #part pv.34 --size=100
Finally, the following raid command sets up the /home/mj directory on a RAID5 array of three partitions (with one spare). The volgroup and logvol commands configure an LVM group for the /home/ez directory:
#raid /home/mj --fstype ext3 --level=RAID5 --spares=1 raid.44 raid.42 raid.40 raid.38 #volgroup Volume00 pv.36 pv.34 #logvol /home/ez --fstype ext3 --name=LogVol00 --vgname=Volume00 --size=192
When you see the % packages command, the items that follow specify the packages and groups that will be installed. The first lines in this section should look similar to the following, which specifies five package groups.
%packages --resolvdeps @ Administration Tools @ Authoring and Publishing @ DNS Name Server @ Graphical Internet @ Text-based Internet
The first line, with the --resolvdeps switch, ensures that Red Hat Linux installs all dependent packages with your selections. Otherwise, Anaconda stops the installation process to ask if you want to resolve dependencies.
These commands search through the comps .xml file described in the first part of this chapter for groups with the given names , per the < name > variable in the comps.xml file. Some of the packages in each group ”as indicated by < packagereq type="mandatory" > ”must be installed. Other packages may be "default" or "optional" . You may have selected or deselected some of these packages during the Red Hat Linux installation process. Your choices lead to a list of RPM package names in the following format:
printman libtool-libs -gnomemeeting gdbm gnome-audio tk bzip2-libs -ncftp
From this list, the printman , libtool-libs , gdbm , gnome-audio , tk , and bzip2-libs RPMs are installed. The gnomemeeting and ncftp RPMs are normally part of one of the installed package groups (Graphical Internet and Text-Based Internet); the minus sign ( - ) in front of each name means they are not installed through this Kickstart file.
Once Linux is installed, Kickstart proceeds to the postinstallation script at the end of the file. You can run the full range of available scripts; the default language is based on the bash shell. To specify a different scripting language, use a command like the following:
%post --interpreter /usr/bin/python
You can copy more configuration files from a remote computer; for example, the following script copies the XF86Config file from the computer with the noted IP address:
mkdir /mnt/source mount 192.168.0.1:/etc /mnt/source cp /mnt/source/etc/X11/XF86Config /root
This assumes that you ve shared the /etc directory via NFS on the computer with the noted IP address.
One other simple command ensures that the system reboots after the Kickstart installation process is complete:
reboot
A substantial number of commands are available for Kickstart files. Table 5.5 lists the basic Kickstart commands.
Command | Description |
---|---|
auth | Lets you specify authentication options; same as authconfig . |
bootloader | Specifies the bootloader location; --useLilo installs LILO instead of GRUB. |
clearpart | Removes current partitions; you can specify --linux or --all . |
device | Allows you to set hardware parameters for a specific device. |
driverdisk | If you need a separate driver disk, you can load it onto an existing partition; e.g.,: driverdisk hda2 --type=vfat . |
firewall | Lets you set up a basic firewall configuration. |
install | Allows you to specify basic installation parameters, including the source of Red Hat installation files. |
interactive | Runs through the Kickstart file interactively; same as autostep . |
keyboard | Specifies the keyboard type. |
lang | Notes the language of the installation. |
langsupport | Specifies the language(s) you want to install. |
logvol | Adds a logical volume partition. |
mouse | Adds a pointing device. |
network | Configures the local network card. |
part | Creates a specified partition; same as partition . |
raid | Configures a software RAID device. |
reboot | Reboots the system after the installation is complete. |
rootpw | Specifies the root password for this system. |
skipx | Skips the X Window configuration process. |
text | Runs the installation in text mode. |
timezone | Specifies the time zone for this computer. |
upgrade | Upgrades an existing Linux system. |
volgroup | Sets up an LVM group. |
xconfig | Notes X Window and graphics card configuration details. |
zerombr | Overwrites any existing partition tables, including all bootloaders. |
Note | Many of these commands have a wide variety of switches. We ve covered the ones we consider to be important in this chapter. If you need more information, refer to the Red Hat Linux 9 configuration guide. |