Using Kickstart

I started working with kickstart files to install CentOS today. I used a combination of two KS files that were automatically created for me during previous installs. I liked the partitioning scheme from one and the rest of the options from another. One thing that took me a bit to figure out was how to actually boot to the KS file. I needed some sort of CentOS boot media to start, then could point the installer at the KS file. I already had a minimal boot CD that I had used for the previous FTP based install so I booted from that and then at the boot prompt specified the location of my KS file. Since I was doing this between VM’s, I put the KS file in a directory accessible via http and started apache server. I also ensured that my FTP server was still running (on the same VM) before kicking off the install.

On my new VM I set the boot parameters to boot to the minimal boot CD. Once at the boot prompt I entered this command:

boot: linux ks=http://10.11.10.51/ks.cfg

From there it used the KS file to find the install media at the same FTP location as previously and flew through the first few screens. What I didn’t realize is that the partitioning will not work without input on a brand new drive with the default options that were in the KS file. I had to click OK one time to allow it to initialize my drive. I later found that there is another command that can be added to “clearpart” line to initialize a new drive. The new line should look like this:

clearpart –all –drives=hda –initlabel

Here is the kickstart file that I ended up with for a simple and basic install.

install
url –url ftp://10.11.10.51//pub/inst
lang en_US.UTF-8
keyboard us
skipx
network –device eth0 –bootproto dhcp –hostname rhel-practice02
rootpw –iscrypted ***************
firewall –enabled –port=22:tcp
authconfig –enableshadow –enablemd5
selinux –enforcing
timezone America/Los_Angeles
bootloader –location=mbr –driveorder=hda –append=”rhgb quiet”
# 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 –initlabel
part /boot –fstype ext3 –size=100 –ondisk=hda
part pv.2 –size=0 –grow –ondisk=hda
volgroup VolGroup00 –pesize=32768 pv.2
logvol / –fstype ext3 –name=LogVol00 –vgname=VolGroup00 –size=1024 –grow –maxsize=3996
logvol swap –fstype swap –name=LogVol01 –vgname=VolGroup00 –size=512 –grow –maxsize=1024
reboot

%packages
@mysql
@editors
@text-internet
@dialup
@core
@base
@base-x
@smb-server
@printing
@server-cfg
device-mapper-multipath
-sysreport

In addition to the RHCE book that I’m studying from, these websites were very helpful in getting the KS working: centos.org and redhat.com

Leave a Reply