Kickstart

There are three ways to create a kickstart file:

  • By hand
  • Using the GUI’s system-config-kickstart tool
  • Using the standard Red Hat installation program Anaconda

Loading kickstart files over the network from the kernel line during an install only supports NFS, HTTP, and FTP.

Commands

  • Disable SElinux while installing Red Hat Enterprise Linux 6: add "selinux=0" at the end of boot prompt

Create the repo for the kickstart

pvcreate /dev/sdb

vgcreate vg_repo /dev/sdb

lvcreate -l 100%FREE -n lv_repo vg_repo

mkfs.ext4 /dev/vg_repo/lv_repo

mkdir /repo

vi /etc/fstab

/dev/mapper/vg_repo-lv_repo /repo       ext4    defaults    0 0

mount /repo

mkdir -p /repo/centos/6.9/x86_64

cd /tmp

wget http://ftp.freepark.org/pub/linux/distributions/centos/6.9/isos/x86_64/CentOS-6.9-x86_64-bin-DVD1.iso

mount -t iso9660 -o loop CentOS-6.9-x86_64-bin-DVD1.iso /mnt

cp -avr /mnt/* /repo/centos/6.9/x86_64/

umount /mnt

vi /etc/httpd/conf/httpd.conf

Alias /kickstart "/repo/kickstart"

<Directory "/repo/kickstart">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

Alias /repo "/repo"

<Directory "/repo">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

/etc/init.d/httpd restart

Publishing your kickstart file using httpd

yum install httpd
chkconfig httpd on && /etc/init.d/httpd start                  # RHEL 5-6 
systemctl enable httpd && systemctl start httpd                # RHEL 7

mkdir -p /var/www/html/kickstart
chown apache:apache /var/www/html/kickstart
chmod 750 /var/www/html/kickstart

Perform the installation

  1. Insert the CentOS installation DVD
  2. From the boot install menu, hit ESC key on the keyboard.
  3. Hit TAB and type:

linux ks=http://your_address/centos6.cfg asknetwork --hostname=<server_name>

linux ks=http://your_address/centos6.cfg ksdevice=eth0 ip=192.168.100.23 gateway=192.168.100.1 netmask=255.255.255.0 dns=192.168.100.1 --hostname=<server_name>

Notes

  • On RHEL 7 the %post commands can be seen on virtual console 5 (Ctrl+b 5 for tmux)

Links