|< Day Day Up >|| |
Kickstart is Red Hat's solution for an automated installation of Red Hat. All of the questions asked during setup can be automatically supplied with one text file. You can easily set up nearly identical systems very quickly. Kickstart files are very useful for quick deployment and distribution of Linux systems.
Kickstart and the Red Hat Exams
For the Troubleshooting and System Maintenance exam, it's possible that the exam proctor might configure your computer using a customized Kickstart configuration file. The file might be local or it might be stored on the server. Understanding Kickstart is a very useful skill that can help you install Linux on a number of different computers simultaneously. You can start the process and walk away. The options are rich and varied. The Red Hat Exam Prep guide suggests that you need to configure 'hands-free installation using Kickstart.'
In addition, as of this writing, there is a bug with respect to Kickstart installations that relies on a DHCP server (Red Hat Bugzilla #90774). I therefore doubt that you'll see or have to configure a Kickstart DHCP server on either exam, at least until this bug is closed. You can check the bug status for yourself at bugzilla.redhat.com.
There are two methods for creating the required Kickstart configuration file:
Use the anaconda-ks.cfg file from the root user's home directory, /root.
Use the graphical Kickstart Configurator, accessible through the ksconfig command or in the GUI, click Main Menu | System Tools | Kickstart.
The first option lets you use the Kickstart template file created for your computer by Anaconda, the Red Hat Enterprise Linux installation program. The second option, the Kickstart Configurator, is discussed in detail later in this chapter.
If you're installing RHEL 3 on a number of different computers, you will find the anaconda-ks.cfg file helpful. You can install RHEL 3 the way you want on one computer. You can then use the anaconda-ks.cfg file from that computer as a template to install RHEL on the other identical computers on your network. If the computers aren't identical, you can customize each anaconda-ks.cfg file as required, for elements such as a different hard disk size, host name, and so on.
Once the Kickstart file is configured, the easiest way to use it is through the RHEL installation boot floppy. To do so, follow these basic steps:
Configure and edit the anaconda-ks.cfg file as desired. I'll describe this process in more detail shortly.
Insert and mount a 1.44MB installation floppy. If you need to create one, I describe the process in Chapter 2. You can then mount the floppy with the mount /mnt/floppy command.
|On The Job|| |
The mount /mnt/floppy command is not a complete command; however, it works in RHEL because of the settings in /etc/fstab, as described in Chapter 4.
Copy the Kickstart file to the floppy with the following command:
# cp /root/anaconda-ks.cfg /mnt/floppy/ks.cfg
Check the ks.cfg file on the floppy with the vi /mnt/floppy/ks.cfg command. If you don't see your entire ks.cfg file, you may not have enough room on your installation boot floppy. You can make room by deleting the snake.msg file from the floppy. If you don't need the description of options during the installation process, you can also delete the general.msg, options.msg, param.msg, and rescue.msg files without affecting the functionality of the installation boot floppy.
You should now be ready to try out the installation boot floppy on a different computer. You'll get to try this again shortly in an exercise.
At the time of this writing, boot disks still bring up the LILO boot: prompt. Use LILO's boot options to initiate the Kickstart file. To boot, and then perform the Kickstart installation from a floppy, type
boot: linux ks=floppy
As long as you have a DHCP server on your network, you may be able to use the same Red Hat Enterprise Linux installation boot floppy. Just boot each new Linux computer from that floppy, type in the linux ks=floppy command at the boot prompt, give the computer a moment to read the ks.cfg file, and insert the same floppy in the next new Linux computer.
|Exam Watch|| |
During the troubleshooting exam, your exam proctor may set up a computer for you using a Kickstart floppy or CD. If it's a floppy, it's quite possible that you'll also need a driver floppy, or first installation CD, which your proctor should provide.
Alternatively, you can configure a Kickstart configuration file on the DHCP/BOOTP server for your network. If you want to put the file on a DHCP/BOOTP server, open the /etc/dhcpd.conf configuration file on that server. Specify the Kickstart file. For example, if you've stored the appropriate Kickstart file in the /usr/install directory on the DHCP server, add the filename '/usr/install/' command to dhcpd.conf. That prompts Anaconda to look on the server in the /usr/install directory for a client_ip-kickstart file.
Alternatively, if the Kickstart file is stored on a different server, add the next-server servername option to the dhcpd.conf configuration file. In this case, the servername is the name of the computer with the Kickstart file.
No matter where you choose to put the Kickstart file, you can boot with a floppy or a specialized CD. You can put the Kickstart file on the Red Hat boot floppy, or with a bit more work, on a Red Hat boot ISO. Just mount the floppy and copy it as the ks.cfg file from wherever you've saved your Kickstart configuration file.
If you're booting from a Red Hat installation floppy, enter the following command at the boot: prompt:
boot: linux ks=floppy
If you're booting from the Red Hat installation CD-ROM, you can still refer to a Kickstart configuration file on a floppy disk with the following command:
boot: linux ks=hd:fd0:/ks.cfg
This assumes the Kickstart configuration file is called ks.cfg and is located on the first floppy disk on your PC. Alternatively, you can refer to the Kickstart configuration file on a hard disk with this command:
boot: linux ks=hd:hda2:/home/mj/ks.cfg
This assumes the Kickstart configuration file is called ks.cfg and is located on the second partition of the first IDE drive in the /home/mj directory. The syntax of this command certainly looks strange; it's been updated for Red Hat Linux 9 and RHEL 3.
You don't need to get a Kickstart file from a DHCP server. To boot from a specific NFS or HTTP server on the network, say with an IP address of 192.168.17.18, from the /kicks/ks.cfg file, type one of the following commands:
boot: linux ks=nfs:192.168.17.18:/kicks/ks.cfg boot: linux ks=http:192.168.17.18:/kicks/ks.cfg
However, even if you've specified a static IP address in ks.cfg, this installation looks for IP address information from a DHCP server. If not found, Anaconda continues with a standard installation, not using the Kickstart file.
I've based this section on the anaconda-ks.cfg file created when I installed my RHEL 3 Server computer. I've added a number of comments. While you're welcome to use it as a sample file, be sure to customize it for your hardware and network. This section just scratches the surface on what you can do with a Kickstart file; your version of this file may vary.
While most of the options are self-explanatory, I've interspersed my explanation of each command within the file. This file illustrates just a small portion of available commands. For more information on each command (and options) in this file, read the RHEL 3 Configuration Guide, which is available online at www.redhat.com/docs/manuals/enterprise.
Follow these ground rules and guidelines to use when setting up a Kickstart file:
Do not change the order of the options.
You do not need to use all the options.
If you leave out a required option, the user will be prompted for the answer during the installation process.
For upgrades, you must have at least the following options defined:
The upgrade keyword
Boot loader (GRUB or LILO) configuration
|On The Job|| |
If you leave out an option, you will be prompted to complete it. This is an easy way to see if your Kickstart file is properly configured. But as some Kickstart options change the partitions on your hard drive, even testing this file can delete all of the data on your computer. So make sure to have a test computer available to test your Kickstart configuration file.
Here is the code from my Kickstart file. The first line is a comment that tells me that this file was created during the installation process.
# Kickstart file automatically generated by anaconda.
The first command is simple; it starts the installation process. It defaults to the first available local media, in this case, the first RHEL installation CD or floppy.
However, if you want to specify an installation, you could add the source of your choice on the next line. It could be cdrom, or if you're installing from an NFS server, you can specify it as follows. If you have the name of the server, you can substitute it for the IP address.
nfs --server=192.168.30.4 --dir=/mnt/inst
You can also configure a connection to an FTP or HTTP server by substituting one of the commands shown here. The directories I specify are based on the FTP and HTTP installation servers created in Chapter 2:
url --url http://192.168.30.4/inst
url --url ftp://192.168.30.4/pub/inst
The lang command specifies the language to use during the installation process. It matters if the installation stops due to a missing command in this file. The langsupport command specifies the language to install with the operating system. The keyboard command is self-explanatory, as it specifies the keyboard to configure on this computer.
lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 keyboard us
The mouse command specifies the pointing device associated with this computer. This particular command specifies a generic PS/2 mouse, connected to /dev/psaux, configured to emulate a middle mouse button.
mouse genericps/2 --device psaux --emulthree
The xconfig command specifies the graphical configuration for this system. The switches are nearly self-explanatory. The --card switch specifies the graphics card driver. The --videoram switch specifies the amount of RAM on the video card. The --hsync and --vsync switches specify horizontal sync and vertical refresh rates, respectively. The --resolution switch sets the default resolution for the monitor, with a given color --depth in bits. The --defaultdesktop switch is normally gnome or kde.
Due to typesetting limitations, we're showing the following code on three lines. Please note that all options for the xconfig command must be on one line. Line wrapping, if the options exceed the space in your editor, is acceptable.
xconfig --card "VESA driver (generic)" --videoram 16384 --hsync 31.5-37.9 --vsync 40-70 --resolution 800x600 --depth 24 --defaultdesktop gnome
The network command is a lot more straightforward if you have a DHCP server for your network; it would read network --device eth0 --bootproto dhcp. This particular line configures static IP address information, with the specified network mask (--netmask), gateway address (--gateway), DNS servers (--nameserver), and computer name (--hostname).
Due to typesetting limitations, we're showing the following code on three lines. Please note that all options for the network command must be on one line. Line wrapping, if the options exceed the space in your editor, is acceptable.
network --device eth0 --bootproto static --ip 192.168.30.149 --netmask 255.255.255.0 --gateway 192.168.30.113 --nameserver 188.8.131.52,184.108.40.206 --hostname Enterprise3
You need to specify the root user password during the installation process. This line specifies the password in encrypted format. You don't have to encrypt the root password in this line. If needed, you can copy this password from /etc/shadow.
rootpw --iscrypted $1$5UrLfXTk$CsCW0nQytrUuvycuLT317/
As for security, in RHEL 3, the firewall is either --enabled or --disabled. By default, the authconfig command sets up the Shadow Password Suite (--enableshadow) and md5 encryption (--enablemd5).
firewall --enabled authconfig --enableshadow --enablemd5
The timezone command is associated with a long list of time zones. If you've installed the squirrelmail RPM, you can find a full list in /usr/share/squirrelmail/locale/timezones.cfg. If you want to set the hardware clock to Greenwich Mean Time, you can add the --utc switch.
|On The Job|| |
Linux uses the UTC acronym for Greenwich Mean Time. UTC is the French acronym for this standard, which does not refer to a city in the United Kingdom.
The default boot loader is GRUB, which is installed unless you add the --useLilo switch. Naturally, it should normally be installed on the Master Boot Record (MBR) of a hard drive. You can include an --append switch to specify commands for the kernel.
By default, the commands that partition your hard drives are commented out of the anaconda-ks.cfg file. These options are a bit more complex, so I discuss them in more detail in the next section. If the commands work for you, don't forget to delete the comment character (#) to activate these commands.
# The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work # clearpart --all --drives=hda # part /boot --fstype ext3 --size=100 --ondisk=hda # part / --fstype ext3 --size=1024 --grow --ondisk=hda # part swap --size=256 --grow --maxsize=512 --ondisk=hda
The following is a list of package groups that are installed through this Kickstart configuration file. These names correspond to the names that you can find in the comps.xml file described in Chapter 2.
%packages @ system-tools @ base-x @ web-server @ smb-server @ printing @ text-internet @ mail-server @ legacy network server @ dns-server @ server-cfg @ dialup @ sound-and-video @ admin-tools @ news-server @ gnome-desktop @ ftp-server @ network-server @ kernel-development @ graphical-internet @ compat-arch-support
After the package groups are installed, you can specify postinstallation commands (%post) in the Kickstart installation file.
The partitioning options in the Kickstart file are a bit complex. They can give you full control of the partitioning options, too. You can clear all partitions with clearpart --all, or just clear any Linux-type partitions with clearpart --linux, or just add to the end of the current partitions. You can create partitions on more than one drive, but you need to identify each device specifically.
To add Linux partitions, use the part command with the following syntax:
part mount dir --size size [--grow] [--maxsize size]
The size is in megabytes. You can use the --grow option to allow the partition to expand and fill all remaining disk space (or share it with any other partitions marked 'grow' on the same disk). This will not expand on the fly, but rather, when all fixed-size partitions are added, these 'growable' partitions will use the rest of the space.
If you specify multiple partitions with the --grow option, their space will be divided evenly. You can also specify a --maxsize, which will allow the partition to grow only to the size specified in megabytes.
Therefore, the following commands from my Kickstart configuration file (with comment characters removed) perform the following tasks:
This clearpart command removes all of the partitions on the first IDE hard drive.
clearpart --all --drives=hda
This first part command configures the /boot directory to the ext3 filesystem with 100MB of space on the first IDE hard drive.
part /boot --fstype ext3 --size=100 --ondisk=hda
This second part command configures the root directory (/) to the ext3 filesystem with at least 1024MB of space on the first IDE hard drive. If more room is available, this partition expands to take the available space.
part / --fstype ext3 --size=1024 --grow --ondisk=hda
This third part command configures a swap partition to be at least 256MB, which corresponds to the amount of RAM available on this computer. If space is available on the hard drive, it's allowed to grow up to 512MB.
part swap --size=256 --grow --maxsize=512 --ondisk=hda
Exercise 3-2: Creating a Sample Kickstart File from a Running System for a Second Similar System Installation
In this exercise, you will use the anaconda-ks.cfg file to duplicate the installation from one computer to another with identical hardware. This exercise simply installs all the exact same packages with the same partition configuration on the second computer. Assume that both computers use DHCP to set up their IP addresses. Add one /home partition of 2000MB with a 512MB swap partition. (This means you must have at least 2500MB of free space available. If you have more space, let it remain unused for now.) You want to install all the same packages as your current installation, so you do not need to make any package changes to the default Anaconda Kickstart file in the /root directory.
If you do not have multiple computers for this exercise, one alternative as discussed earlier is VMWare.
Review the /root/anaconda-ks.cfg file. Copy it to ks.cfg.
Create the boot disk and add this ks.cfg file to it:
dd if=/mnt/cdrom/images/bootdisk.img of=/dev/fd0 mount /dev/fd0 /mnt/floppy cp ks.cfg /mnt/floppy
Prepare the second computer so that it has the same disk configuration, the same C: drive size if it was present, and same amount of unused and unpartitioned space as the first computer. Reboot the second computer with the Linux boot file with the Kickstart file in the floppy drive and the first binary CD in the CD-ROM.
At the Red Hat Installation menu boot prompt, enter the following startup command:
boot: linux ks=floppy
You should now see the system installation creating the same setup as the first system. Depending on how you installed Linux on the original computer, you may need a network connection to the same installation source or the other installation CDs.
Exercise 3-3: Modify the Packages to Be Installed (Optional Exercise)
Edit the ks.cfg file on the floppy and remove all the game packages you can find. Alternatively, set up an interactive installation so that you can test and observe the result on another computer.
The Red Hat exams test your skills on Red Hat Enterprise Linux. While many Unix skills are transferable to the exam, there are also many features unique to RHEL. While you can configure anything in Linux from the command line interface, Red Hat has created a number of administrative tools that you can use only in the GUI.
Based on the nature of the published Red Hat Exam Prep guide, you'll almost certainly be installing a GUI during the installation portion of the exam. When you install the GUI, you'll also have access to the tools developed by Red Hat. You can also have access to the command line interface in the GUI. You can do so with a right-click, which starts a pop-up menu where you can start the New Terminal command. Alternatively, you can click on the Main Menu button (in the lower-left corner), click System Tools | Terminal to open the same command line interface, also known as GNOME terminal.
For Administrators from Other Unix-Style Distributions
Linux is not the only operating system developed in the style of Unix. There are a number of other Unix-style operating systems that are important in the computing world. These include, but are not limited to Solaris, HP-UX, AIX, IRIX, or even SCO UNIX. A substantial number of candidates for the RHCE learned their skills on these other operating systems.
You can then start the Red Hat tool of your choice from the command line; most of these utilities start with redhat-config-*.To see a full list, type redhat- at the command line and press the TAB key twice. Alternatively, you can start a number of these tools from the Main Menu button, under the System Settings and System Tools menus.
If you're confident in your skills editing the Linux text configuration files, don't bother with the GUI tools. It's faster to edit Linux text configuration files directly in any Unix-style operating system. If you get nervous on exams, however, or are uncertain of your skills where a GUI tool is available, learn the appropriate Red Hat GUI tools. They can be a lifesaver during the exam.
|On The Job|| |
In the KDE desktop, the default command line terminal is konsole, which is slightly different from GNOME terminal.
Now that you understand the basics of what goes into a Kickstart file, it's time to solidify your understanding through the graphical Kickstart Configurator. When you experiment with this GUI tool, you can learn more about what happens in the Kickstart configuration file.
To start the Kickstart Configurator, go into the Linux GUI. Open a command line interface shell and enter the redhat-config-kickstart command. Alternatively, click Main Menu | System Tools | Kickstart. The following sections should look familiar, as they are closely related to the RHEL installation menus.
The first screen in Figure 3-4 illustrates a number of basic installation steps. If you've installed RHEL or Red Hat Linux before, all of these steps should look familiar.
Figure 3-4: The Kickstart Configurator
As you can see, there are a number of other options in the left pane, each associated with different Kickstart commands. To learn more about Kickstart, experiment with some of these settings. Use the File | Save command to save these settings in the filename of your choice, which you can then review in a text editor. Alternatively, you can run the File | Preview command to see the effect of different settings on the Kickstart file.
The following sections provide a brief overview of each option shown in the left pane. I believe it's unlikely that you'll have to know Kickstart in this level of detail on the Red Hat exams. However, an understanding of the Kickstart Configurator can help you understand the installation process, which is important on the installation part of each exam.
In the Basic Configuration screen, you can assign settings for the following components:
Default Language for the installation; also set as the default language for the operating system
Time Zone, which supports computers where the hardware clock is set to Greenwich Mean Time (also known as UTC)
Root Password, which can be encrypted in the Kickstart file
Language Support to be installed with the operating system
Reboot; adds the reboot command to the end of the Kickstart file
Perform Installation In Text Mode supports automated installation in text mode
The Installation Method options are straightforward. You're either installing Linux for the first time or upgrading a previous installation. The installation method and your entries are based on the location of the installation files. For example, if you select an NFS installation method, the Kickstart Configurator prompts you for the name or IP address of the NFS Server, and the shared directory with the RHEL installation files.
You can set up your Kickstart file to install RHEL 3 from a CD, a local hard drive partition, or one of the standard network servers: NFS, HTTP, or FTP.
The next section lists Boot Loader Options. The two boot loaders available to Linux are GRUB and LILO. Unlike for Fedora Linux, LILO is still available as an option. With GRUB, you can set a password, which can provide an additional level of security during the boot process.
Linux boot loaders are normally installed on the MBR. If you're dual-booting with Windows NT/2000/XP with GRUB, you can set up the Windows boot loader (or an alternate boot loader such as Partition Magic or System Commander) to point to GRUB on the first sector of the Linux partition with the /boot directory. Kernel parameters allow you to pass commands to the kernel through the GRUB configuration file as described earlier in this chapter.
The Partition Information options determine how this installation configures the hard disks on the affected computers. While it supports the configuration of standard and RAID partitions, it does not yet support the configuration of LVM groups. The Clear Master Boot Record option allows you to wipe the MBR from an older hard disk that might have a problem there; it sets up the zerombr yes command in the Kickstart file.
Don't use the zerombr yes option if you want to keep an alternate on the MBR such as the NT Boot Loader.
You can remove partitions depending on whether they've been created to a Linux filesystem. If you're using a new hard drive, you'll want to initialize the disk label as well. Click the Add button to open the Partition Options menu. As you can see in Figure 3-5, this corresponds to the Anaconda Add Partition menu shown back in Chapter 2, Figure 2-13.
Figure 3-5: Using the Kickstart Configurator to set up partitions
The Network Configuration section enables you to set up IP addressing on the network cards on a target computer. You can customize static IP addressing for a specific computer, or you can configure the use of a DHCP server. You can also make Kickstart look for a BOOTP server, which is a specially configured DHCP server on a remote network.
The Authentication section lets you set up two forms of security for user passwords: Shadow Passwords, which encrypt user passwords in the /etc/shadow file, and MD5 encryption. This section also allows you to set up authentication information for various protocols:
NIS Network Information Service for one login database on a network with Unix and Linux computers on a network.
LDAP The Lightweight Directory Assistance Protocol for certain types of databases such as directories.
Kerberos 5 The MIT system for strong cryptography to authenticate users on a network.
Hesiod Associated with Kerberos 5.
SMB Samba allows configuration of your Linux computer on a Microsoft Windows-based network.
Name Switch Cache Associated with NIS for looking up passwords and groups.
The Firewall Configuration section allows you to configure a default firewall for the subject computer. Generally, you'll want a firewall only for those computers that are connected to outside networks such as the Internet.
The X Configuration section allows you to configure the Linux GUI. While there is a lot of debate on the superiority of GUI- or text-based administrative tools, text-based tools are more stable. For this reason (and more), many Linux administrators don't even install a GUI. However, if you're installing Linux on a series of computers, it's likely that most of the users won't be administrators.
In this section, there are three tabs. Under the General tab, you can set a default color depth and resolution. Under the Video Card and Monitor tabs, you can set Linux to probe your hardware or specify the hardware from a list. If you want to do something fancy such as specifying multiple resolutions, you'll need to modify the ks.cfg file directly.
The Package Selection section shown in Figure 3-6 allows you to choose the package groups that are installed through this Kickstart file. It's a good idea to check the Automatically Resolve Dependencies option; if you miss a package or a package group, Anaconda can find the critical package and install it with your list.
Figure 3-6: Configuring package groups with Kickstart
You can add preinstallation and postinstallation scripts to the Kickstart file. Postinstallation scripts are more common, and they can help you configure other parts of a Linux operating system in a common way. For example, if you wanted to install a directory with employee benefits information, you could add a postinstallation script that adds the appropriate cp commands to copy files from a network server.
|< Day Day Up >|| |