Kikstart Installation without PXE boot and DHCP server configuration

Automating OS installation using KikStart Server -----

Note :-  This document is created on base of CentOS 6.5 base OS installation.

prerequisites-----

> HTTP or FTP or NFS server on network.
> CentOS 6 DVD or .iso file.

Note :- I have configured and used HTTP server in the following scenario for KikStart server.

Installation Process -----

 > Install / configure HTTP server and copy all the Operating system dvd files to the new "centos65"directory.
Command :- #yum install httpd*    ----- Install http server with yum installer
                     #service httpd restart  ----- Restart http service
                     #chkconfig httpd on    -----On http service permanently 
                     #cd /var/www/html     -----Go to html directory
                     #mkdir centos65          -----Create "centos65"directory in "html"directory
                     #cp -rv /media/centos6.5/* /var/www/html/centos65 ----- Copy all Os dvd contain to "centos66"directory.


> Create kikstart directory
Command :- #mkdir /var/www/html/centos65/ks  -----Create "ks"directory in html directory

>Create and edit ks.cfg file in "ks"directory and put the following lines.
Command :- #vi ks.cfg     ----- Create "ks.cfg"file with vi editor. and add the following lines.

#platform=x86, AMD64, or Intel EM64T
# Firewall configuration
firewall --enabled --port=22:rcp
# Install OS instead of upgrade
install
# Use network installation
url --url="http://192.168.0.25/centos65"

text
# Root password
rootpw  --iscrypted $6$CN3rgs.pqQoNPKMF$7fXhIBuKP8kb8wMa7wRHKOaZlTkzak77lnOuT6Gbh4RjrouNIf41an1S0Ji6wGW8RogGLw8uN3Iws6MFkuDtJ/
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# System timezone
timezone  --utc America/Denver
# Network information
network --onboot yes --device eth0 --bootproto=static --hostname=vlab01-vm
# System bootloader configuration
bootloader --location=mbr
# Clear the master boot record on the hard drive
zerombr yes
# Partition clearing information
clearpart --all --initlabel 
#Disk partitioning information
part /boot --fstype ext4 --size=150
part swap --size=1024
part pv.01 --size=1 --grow
volgroup vg_root pv.01
logvol  /  --vgname=vg_root  --size=1 --grow --name=lv_root

repo --name=cloudstack --baseurl=http://192.168.0.25/centos65/Packages
%packages
@Base
@system-admin-tools
kvm
virt-manager
libvirt
libvirt-python
python-virtinst
virt-top
libguestfs-tools
cloudstack-agent
openvswitch
%end
%post

cat << EOF > /etc/sysconfig/iptables
# Generated by iptables-save v1.4.7 on Thu Dec 18 01:18:02 2014
*nat
:PREROUTING ACCEPT [819:76897]
:POSTROUTING ACCEPT [78:4939]
:OUTPUT ACCEPT [78:4939]
-A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -p tcp -j MASQUERADE --to-ports 1024-65535
-A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -p udp -j MASQUERADE --to-ports 1024-65535
-A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -j MASQUERADE
COMMIT
# Completed on Thu Dec 18 01:18:02 2014
# Generated by iptables-save v1.4.7 on Thu Dec 18 01:18:02 2014
*mangle
:PREROUTING ACCEPT [223535:201016265]
:INPUT ACCEPT [223268:200979935]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [116443:5502657]
:POSTROUTING ACCEPT [116443:5502657]
-A POSTROUTING -o virbr0 -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill
COMMIT
# Completed on Thu Dec 18 01:18:02 2014
# Generated by iptables-save v1.4.7 on Thu Dec 18 01:18:02 2014
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p tcp -m tcp --dport 49152:49216 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 5900:6100 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 16509 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1798 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p gre -j ACCEPT
-A INPUT -i virbr0 -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -i virbr0 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i virbr0 -p udp -m udp --dport 67 -j ACCEPT
-A INPUT -i virbr0 -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -d 192.168.122.0/24 -o virbr0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s 192.168.122.0/24 -i virbr0 -j ACCEPT
-A FORWARD -i virbr0 -o virbr0 -j ACCEPT
-A FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
EOF

%end

# Reboot after installation
reboot


:wq ------ Save and exit the file.

Client side configuration ----- 

> Insert CentOS 6.5 DVD in DVD Rom or in Virtual ensnarement mount CentOs .iso file to virtual DVD Rom. and boot client machine from DVD Rom ( Select default 1st boot option is CD Rom in Bios settings. ). Once the clinet machine is boot from DVD you will get the following screen.



> Select the first boot option "Install or upgrade an existing system" and Press Tab button on the keyboard.
Type the following command as per the following screen.
ks=http://<http server IP>/centos65/ks/ks.cfg ip=<any free network IP from http server series ip> netmask=<network subnet mask> gateway=<router ip>

Press Enter key to continue.



>  In the next screen, Select option "Enable IPv4 support" and "Manual configuration".
Disable IPv6 support.
Press OK to continue.
 

>  Configure manual IPv4 IP address to the client machine.
Note :- This is the actual IP address ,Gateway, Subnet mask and DNS configuration of the client machine.
Press OK to continue.


> Once the installation is start you will find the following screen.


> Once the installation is finished. Client machine will reboot.
Note :- Select Hard disk boot option as a first boot option to boot the client machine from hard drive.

EOF

Comments

Popular posts from this blog

KVM Live Migration without Shared Storage

Create CentOS 6 Local package and Group package Repository

Create Linux ( LUCI ) Cluster