Thursday, 28 February 2013

Setup a Redhat Kickstart Server

Setup a Redhat Kickstart Server

During the Data Centre project, I had to install and configure quite few Linux servers and to make my file easier I configured a Redhat kickstart server.
What this server does is. it allows you to automate the install of multiple servers and replicate the same configuration multiple times. This will make your life much easier.

If you get your kiscksart server right in the end you will need to make very few changes to  all servers, thus reducing your support time and manual errors.

The first things is to install a Linux server. It can be Centos or Redhat. I'll use Centos so I don't need to buy a Redhat license.

I am going to describe first how to setup a kickstart using Apache to install servers using HTTP.

Once the server is fully up and running..

Necessary Software:
  • Apache (httpd package)
  • nfs-utils-lib
  • nfs-utils
  • nfs-utils-lib-devel
Step by Step
1. Create an Apache Virtual Host
# vi /etc/httpd/conf.d/kickstart.conf
NameVirtualHost 172.16.180.222 (replace with your server's IP)
<VirtualHost 172.16.180.222> (replace with your server's IP)
        ServerName 172.16.180.222 (replace with your server's IP)
        DocumentRoot /var/www/data/
</VirtualHost>
<Directory /var/www/data/install>
   Options +Indexes
   AllowOverride AuthConfig
   order allow,deny
   allow from all
</Directory>


2. Restart Apache
# service httpd restart

3. Create kickstart folder structure
# mkdir -p /var/www/data/install/RPM
# mkdir -p /var/www/data/source
# mkdir -p /var/www/data/ISO
4. Download Centos iso image
# cd /var/www/data/ISO
# wget http://mirrors.coreix.net/centos/6.3/isos/x86_64/CentOS-6.3-x86_64-bin-DVD1.iso

5. Mount the Centos ISO image
# mount -o loop /var/www/data/ISO/CentOS-6.3-x86_64-bin-DVD1.iso /var/www/data/source

Note: to make this change permanent. You need to edt /etc/fstab
# vi /etc/fstab
add the line below
 /var/www/data/install/ISO/CentOS-6.0-x86_64-bin-DVD1.iso /var/www/data/install/source/ iso9660 loop 0 0
6. Create the Kickstart script:
# vi /var/www/data/install/ks.cfg
add the lines below

# Kickstart generated by Renato de Oliveira
install
url --http://172.16.180.222/install/
lang en_US.UTF-8
keyboard uk
network --device eth0 --bootproto dhcp
rootpw --iscrypted u09u0ojhu0uujoh9y
firewall --disabled
authconfig --enableshadow --enablemd5
selinux --disabled
timezone --utc Europe/London
bootloader --location=mbr --driveorder=sda
clearpart --all --drives=sda

part /boot --fstype ext3 --size=150
part swap --size=10000


part pv.01 --size=15000
volgroup vg_root pv.01
logvol  /  --vgname=vg_root  --size=12000  --name=lv0_root

part pv.02 --size=120000
volgroup vg_local pv.02
logvol /local --vgname=vg_local --size=110000 --name=lv0_local

part pv.03 --size=5000
volgroup vg_afscache pv.03
logvol /local/afs.cache --vgname=vg_afscache --size=4000 --name=lv0_afscache

part pv.04 --size=5000
volgroup vg_log pv.04
logvol /var/log --vgname=vg_log --size=4000 --name=lv0_log

part pv.05 --size=5000
volgroup vg_lvvartmp pv.05
logvol /var/tmp --vgname=vg_lvvartmp --size=4000 --name=lv0_vartmp

part pv.06 --size=5000
volgroup vg_lvtmp pv.06
logvol /tmp --vgname=vg_lvtmp --size=4000 --name=lv0_tmp


%packages
@core

@ X Window System
@ Desktop
@ Sound and Video

bzip2
bash
wget
 
%post
# Turn services off
chkconfig  --level 2345 atd off
chkconfig  --level 2345 bluetooth off
chkconfig  --level 2345 cups off
chkconfig  --level 2345 gpm off
chkconfig  --level 2345 ip6tables off
chkconfig  --level 2345 postfix off
chkconfig --level 2345 NetworkManager off
chkconfig --level 2345 iptables off
chkconfig --level 2345 avahi-daemon off
chkconfig --level 2345 mcelogd off

# Turn necessary services on
chkconfig --level 2345 smb on
chkconfig --level 2345 nslcd on
chkconfig --level 2345 ntpd on
chkconfig --level 2345 postfix on


Note: Save the file and you are almost ready.

Assuming we will use a physical server to install Redhat on.

7. Write the ISO DVD to a DVD media

8. Boot the the server to be installedwith the DVD image you just created.
At boot time type:
linux ks=http://172.16.180.222/install/ks.cfg

 That should give you a fully installed server.

If you want to customise the Kisckstart server, there are many options you can use to automate the install.
 


by Renato de Oliveira

No comments:

Post a Comment