Set up Kickstart Server – RHEL 6/OL 6/CentOS 6

I’ve often found it useful to have a kickstart server VM to do a quick install of Linux or OVM when at a customer site or working in the lab. Here’s my step by step process for an Oracle Linux 6.x system that has not been set up previously. The Kickstart and OS files will deliver an Oracle Linux 6.5 build when complete. Keep in mind that the kickstart options and syntax can change between even minor releases of Linux so YMMV. Feel free to take creative license with the mount points and directory structures, but make sure to adjust the rest of the configs accordingly.


As an aside, I’ve mainly found myself working in Oracle Linux by virtue of the fact that the company I work for is an Oracle Platinum Partner so we deal with it a lot (especially on the Oracle Engineered Appliances such as ODA, Exadata and others).  Know that Oracle Linux is a distribution based on Red Hat Linux, just like CentOS.  It offers a number of advantages and benefits over RHEL however in the UEK2 and UEK3 kernels that are specific to OL such as KSplice and DTrace for a few examples.  It maintains binary compatibility with RHEL however so anything that runs on RHEL should do so without any changes on OL.


Later, I may post an article about kickstart options and what they do so stay tuned!


** Install additional packages needed **

[root@forge ~]# yum -y install dhcp syslinux xinetd tftp-server httpd




 ** Configure web server **

NOTE: You can pick whatever folder you want to use to serve up the images but remember to change them in the files below as well.  I chose to use the standard httpd folder to minimize changes to the httpd.conf file and I wasn’t using this machine for a web server. 

[root@forge ~]# sed -i 's/^Listen .*/Listen {your IP address here}:80/' /etc/httpd/conf/httpd.conf
[root@forge ~]# rm -rf /var/www/html
[root@forge ~]# mkdir /tftpboot
[root@forge ~]# ln -s /tftpboot/ /var/www/html
[root@forge ~]# service httpd start
[root@forge ~]# chkconfig httpd on


** Configure /etc/sysconfig/dhcpd/ **

NOTE: I’m assuming you are using eth1 as the interface that will be listening for DHCP requests and responding.  If your machine or VM is multi-homed then you may need to adjust this.

[root@forge ~]# echo 'DHCPDARGS="eth1"' > /etc/sysconfig/dhcpd


** Add following entries into /etc/dhcp/dhcpd.conf **

=== SNIP ===
# Global Options
Allow booting;
Allow bootp;

# Subnet definition
subnet {your network here} netmask {your netmask here} {
# Parameters for the local subnet
option routers               {your router here};
option subnet-mask           {your netmask here};
option domain-name-servers   {your DNS server here};
default-lease-time           21600;
max-lease-time               43200;
# Client IP range
range dynamic-bootp {your starting DHCP address} {your ending DHCP address};
filename  "pxelinux.0";
next-server  {IP address of DHCP server};
=== SNIP ===


** Start DHCPD services **

[root@forge dhcp]# chkconfig dhcpd on
[root@forge dhcp]# service dhcpd start
Starting dhcpd:                                            [OK]
[root@forge dhcp]#


** Create folder and copy following contents into /tftpboot/pxelinux.cfg/default **

[root@forge ~]# mkdir /tftpboot/pxelinux.cfg

=== SNIP ===
timeout 0
default menu.c32

menu title FORGE Kickstart Server
label 1
  menu label ^ 1) OL6.5
  kernel OL6.5/vmlinuz
  append initrd=OL6.5/initrd.img  ks=http://{your IP address here}/ks/OL6.5.ks ksdevice=eth0

=== SNIP ===


** Copy following contents into /tftpboot/ks/OL6.5.ks **

[root@forge ~]# mkdir /tftpboot/ks

=== SNIP ===
# Kickstart for all OL6.5 server builds
#%include /tmp/cpuarch-include
url --url http://{your IP address here}/osimages/OL6.5_32
keyboard us
timezone --utc America/Chicago
lang en_US.UTF-8
authconfig --enableshadow --passalgo=sha512
# root password way2secure
rootpw  --iscrypted $6$XaN78wei$BaXqcriP.WlkCQT0fLVCbv.ipVBabTXC.OdR6teBbeLdX1Y2jaShrbDmx.QT1gc/OZZXLNwvWByVz7MojMSKX/
firewall --disabled
selinux --disabled
network --onboot yes --device eth0 --bootproto dhcp --noipv6

%include /tmp/clear-include
%include /tmp/grub-include
%include /tmp/part-include


%post --log /root/

%pre --interpreter /bin/sh

# Determine the disk device of the system
for file in 'xvda' 'cciss!c0d0' 'sda' 'hda'; do
    if [ -e "/sys/block/$file" ]; then

# Correcting disk device for HP servers
if [ "$disk_device" = 'cciss!c0d0' ]; then

# Determine if CPU is 32 or 64 bit and set the url based on that
if [ -z `grep lm /proc/cpuinfo` ]
    echo "url --url http://{your IP address here}/osimages/OL6.5_32" >> /tmp/cpuarch-include
    echo "url --url http://{your IP address here}/osimages/OL6.5" >> /tmp/cpuarch-include

# Clear all partitions on disk
echo "clearpart --all --drives=$disk_device" >>/tmp/clear-include

# Set BootLoader location
echo "bootloader --location=mbr --driveorder=$disk_device" >>/tmp/grub-include

# Set up partitions and LVM
echo "part /boot --fstype=ext4 --asprimary --size=500 --ondisk=${disk_device}" >>/tmp/part-include
echo "part pv.01 --size=1 --grow --ondisk=${disk_device}" >>/tmp/part-include
echo "volgroup vg_root pv.01" >>/tmp/part-include
echo "logvol / --vgname=vg_root --fstype=ext4 --size=15360 --name=lv_root" >>/tmp/part-include
echo "logvol swap --vgname=vg_root --size=3072 --name=lv_swap" >>/tmp/part-include
=== SNIP ===


** Copy files into /tftpboot **

[root@forge ~]# cp /usr/share/syslinux/pxelinux.0 /tftpboot/
[root@forge ~]# mkdir /tftpboot/OL6.5
[root@forge ~]# cp  {OL 6.5 install media}/images/pxeboot/vmlinuz {OL 6.5 install media}/images/pxeboot/initrd.img /tftpboot/OL6.5/
[root@forge ~]# cp /usr/share/syslinux/menu.c32 /tftpboot/


** Copy contents of install disk into /tftpboot/osimages/OL6.5 **

[root@forge ~]# mkdir /tftpboot/osimages/OL6.5
[root@forge ~]# mount -o loop {path to ISO of OL6.5} /mnt
[root@forge ~]# rsync -avz /mnt/ /tftpboot/osimages/OL6.5/


** Enable TFTP service in xinetd **

[root@forge ~]# sed -i 's/^.*disable.*= yes/\tdisable\t\t\t= no/' /etc/xinetd.d/tftp
[root@forge ~]# sed -i 's/^.*server_args.*= -s \/var\/lib\/tftpboot/\tserver_args\t\t= -s \/tftpboot/' /etc/xinetd.d/tftp
[root@forge ~]# chkconfig xinetd on
[root@forge ~]# service xinetd start
Starting xinetd:                                           [  OK  ]
[root@forge ~]#

All Done!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s