Thursday, 2 July 2015

HTTP Kickstart server

HTTP Kickstart server in 10 Steps


This is a quick tutorial on how to setup an Apache based Kickstart install server for provisioning Red Hat or CentOS hosts in your environment. By Kickstarting a host/s you can save time and standardize your environment by defining a configuration file that all hosts will use to perform automated installs.

1. Head over to centos.org and download the iso of the CentOS release you are interested in. I will be using CentOS 5.4 for the purposes of this tutorial.
2. Install Apache.
Check your system for Apache being installed using:
[root@kickstart kickstart]# rpm -qa |grep -i httpd
If nothing returns issue:
yum -y install httpd
This should download and install the dependencies for Apache.
3. Create a install root where we will be installing the contents of the cdrom to. I’ll be using the default document root in /var/www/html.
mkdir /var/www/html/centos5
4. Mount the iso you downloaded to a mount point.
[root@kickstart iso]# mount -o loop CentOS-5.4-i386-bin-DVD.iso /mnt
5. Copy the contents of the iso into the directory you created.
cp -ar /mnt/* /var/www/html/centos5/
6. Create a directory to house your kickstart configurations. Once again I’ll be using Apache’s default document root of /var/www/html. I will be creating a directory called ks to store my configurations.
mkdir /var/www/html/ks
7. Create the kickstart configuration file. I named my configuration ks.cfg and dropped it in the ks directory we created in step 6. Here is what I use for my kickstart profile. Very minimal config.
text
install
url --url http://192.168.3.128/centos5
lang en_US.UTF-8
keyboard us
langsupport --default=en_US.UTF-8 en_US.UTF-8
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$/KEoeArl$f5TokNUdzGIqlvRCLFWW9/
firewall --disabled
selinux --disabled
authconfig --enableshadow --enablemd5
timezone America/New_York
bootloader --location=mbr --append="console=xvc0"
#
zerombr yes
clearpart --all
part /boot --asprimary --fstype="ext3" --size=100 --bytes-per-inode=4096
part swap --asprimary --fstype="swap" --recommended --bytes-per-inode=4096
part / --asprimary --fstype="ext3" --grow --size=1 --bytes-per-inode=4096
reboot
#
%packages --nobase
authconfig
crontabs
kbd
kudzu
man
ntp
openssh-clients
openssh-server
passwd
pciutils
rootfiles
rpm
system-config-securitylevel-tui
traceroute
yum
yum-updatesd
vim-minimal
vixie-cron
which
wget
unzip
kudzu
man
ntp
openssh-clients
openssh-server
passwd
pciutils
rootfiles
rpm
system-config-securitylevel-tui
traceroute
yum
yum-updatesd
vim-minimal
vixie-cron
which
wget
unzip
sudo
%post
(
chkconfig --level 3 ip6tables off
chkconfig --level 3 kudzu off
chkconfig --level 3 netfs off
chkconfig --level 3 yum-updatesd off
#
useradd -p 'myreallycomplexpass' someuser
)  2>&1 | tee /root/post-install.log
8. Use the dvd you downloaded or grab a copy of the boot.iso from the install root. You can either use the install DVD iso you or use the 10MB boot.iso located in centos5/images/boot.iso I choose to use the boot.iso since its 10MB and is easily distributable.
9. Start up the Apache process
[root@kickstart images]# service httpd start
Starting httpd:                                            [  OK  ]
10. Now for the Moment of truth. Boot the system with boot.iso or install DVD. At the boot prompt enter:
linux ks=http://your_kickstart_ip/ks/ks.cfg
If all went well the system should boot and fetch the kickstart config. Then the installation will begin hands off.