By charlie, Wed, 06/10/2009 - 00:41
The commands section is where you specify how to partition your hard disk, how to configure your network, what hostname to give the machine and various other settings.
There are many options to the commands shown in the example. For a more detailed explanation of the various commands and their options, see the Red Hat manual here

Or my guide here

We will start by defining which type of install we will be doing and which profile to use

# install options
key Workstation

These two lines specify how to install the machine. install here means we are performing a new install another possible option here is upgrade. key specifies which installation profile to use. Other options from our installation media are Client, Workstation and VT. We use the text command to tell anaconda to use text mode to install.

Now since we are going to install with http, we'll need the network interface configured, we'll use the network command to configure our interface using dhcp.

# eth0 dhcp
network --device=eth0 --bootproto=dhcp --onboot=on
Other methods of configuring the network interface are static and bootp. We'll next specify the installation media
# installation media
url --url=

This next line tells anaconda where to find installation media. Other options here are CD-Rom, NFS, FTP or a partition on the hard drive. Here are some examples of the usage of those options.

nfs --dir=/install
url --url=
harddrive --dir=install --partition=1

Next we'll configure the language, keyboard and time options

lang en_US.UTF-8
keyboard us
logging --level=info
timezone America/New_York

Now we can move on to configuring some security options on the system. We'll configure selinux, the root password, iptables rules and the authentication mechanism.

selinux --enforcing
firewall --enabled --ssh
rootpw --iscrypted $1$F/cD2/$nV0/biUdPjDgea.cN2rEe.
auth --useshadow --enablemd5

SELinux is set to enforcing and we are allowing ssh through the firewall. Anaconda knows about http, ftp, telnet, smtp and ssh. You can enable any one of these through your firewall by adding them to the firewall line. If you wish to allow another port through the firewall you can use the syntax --port=[port number]. In our example we only wish to allow ssh into our new machine.

The root password is crypted using md5, you can create this yourself using the md5 perl library but it's a bit easier to just use grub-md5-crypt. In this example I'm using the password "fedora".

[root@server0 ~]# grub-md5-crypt
Retype password: 

You can choose at this point to configure the X Window system. If your goal is to create a server then you should use the option skipx. If you wish to configure X, then use xconfig, for example:

xconfig  --defaultdesktop=GNOME --depth=32 --resolution=1280x1024
We'll skip X for our client and also tell it not to use firstboot. Firstboot is a program that is intended to help you setup a machine after installing, it allows you to configure authentication, add users and various other things you would do on an initial setup.

firstboot --disable

Next we'll need to tell anaconda how to boot the system and partition the hard drive. I prefer to use lvm to manage disks rather than multiple partitions on the disk (note that system-config-kickstart doesn't understand any of the lvm commands we'll use). We'll need to have at least 2 partitions while using lvm. The first partition is /boot which is used to load the kernel and initrd images. The next partition will be an LVM partition to hole our Physical Volume.

# disk partitioning
bootloader --location=mbr
clearpart --all --initlabel
part /boot --asprimary --bytes-per-inode=4096 --fstype="ext3" --size=150
part pv.2 --size=0 --grow
volgroup ClientVolume --pesize 32768 pv.2
logvol swap --fstype swap --name=SwapVol --vgname=ClientVolume --size=1024 --grow --maxsize=8192
logvol / --fstype ext3 --name=RootVol --vgname=ClientVolume --size=8192 --grow

We use the command bootloader to specify where to install the bootloader and then use clearpart to wipe the disk clean and relabel it. We then specify to make a primary partition of 150MB and mount it as /boot. Then we create a new physical volume to store our logical volumes (part pv.2 --size=0 --grow). We specified the size of the pv.2 partition as 0 and give the option --grow to have the partition fill the remainder of the disk. With our physical volume created, we can create a Volume Group to contain our logical volumes using volgroup. Now we create the logical volumes using logvol. Using a combination of --size, --grow and --maxsize we can fill the disk with logical volumes that fit a variety of disk sizes. In our example we specify that the swap volume must not be smaller than 1GB and that the root volume must be no smaller than 8GB. If we have a 16GB drive, then we will get an 8GB swap and an 8GB root, if our drive is larger than 16GB (plus the 150MB for /boot) then root will grow into the remaining space.