Saturday, January 26, 2013

RHEL6 - Kickstart using pxe boot

Kickstart using pxe boot




Notes:

1. Create a ks file one per server.
2. make available to installer such as nfs, http, ftp
ks=http://sama/ks/ks.cfg

3. reboot the host and on the install menu, press tab

vmlinuz initrd=initrd.img
linux ks=http:myip/yum/ks.cfg resolution=800x600

note: you can specify other parameters as well but we already specified on ks file so we can simply avoid.

When you press enter, system will start hand free installation ....


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kickstart with pxe boot
1. Copy your OS image content to web server.
# mkdir /var/www/html/OS_Image
# cp -a * /var/www/html/OS_Image
# cd /var/www/html/OS_Image/Packages

2. Create repo
# createrepo -v -d .
# vi /etc/yum.conf
[OSINSTALL]
name=FOR OS INSTALL
baseurl=file:///var/www/html/OS_Image/Packages
enabled=1
gpgcheck=0
Note: if you don't have web server set up, first install httpd package or use local storage to set up repo and install.
# yum install httpd
# chkconfig httpd on
# service httpd on
# yum install system-config-kickstart
Using system-config-kickstart or from your root server anaconda-ks.cfg file, copy it to nfs or web server.
# cp anaconda.cfg /var/www/html/ks/ks.cfg

3. For pxe boot install tftp server package
# yum install tftp-server
# mkdir /var/lib/tftpboot/pxelinux.cfg
# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
Restart inet services.
# service xinetd restart
Verify tftp/udp is listening on port 69
# netstat -an | grep 69
Now install dhcp package for pxe boot
# yum install dhcp
# chkconfig dhcpd on
Modify the dhcp config file
# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#   see 'man 5 dhcpd.conf'
#
Allow booting;
Allow bootp;
authoritative;
subnet 192.168.10.0  netmask 255.255.255.0 {
 option routers  192.168.10.1;
 option subnet-mask 255.255.255.0;
 option domain-name     "expanor.local";
 option domain-name-servers 192.168.10.110;
 default-lease-time 21600;
 max-lease-time  43200;
 range dynamic-bootp 192.168.10.111 192.168.10.150;
 filename   "pxelinux.0";
 next-server  192.168.10.110;
}
# service dhcpd start
4. Copy pxe config files
# cd /var/www/html/OS_Image/images/pxeboot
# mkdir /var/lib/tftpboot/OS6
# cp vmlinuz /var/lib/tftpboot/OS6
# cp initrd.img /var/lib/tftpboot/OS6
# cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot
# vi /var/lib/tftpboot/pxelinux.cfg/default
# cat /var/tmp/default-new
timeout 100
default menu.c32
menu title ==== Boot Menu ====
label 1
  menu label ^ 1) OS6 Server
  kernel OS6/vmlinuz
  append initrd=OS6/initrd.img ks=http://192.168.10.110/ks/ks.cfg ksdevice=eth0
label rescue
  menu label ^Rescue installed system
  kernel vmlinuz
  append initrd=initrd.img rescue

5. Boot your client system and installation process should start automatically.

if you get error, please review your kickstart file.

No comments:

Post a Comment