Saturday, January 26, 2013

RHEL6 - Kickstart using pxe boot

Kickstart using pxe boot


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

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
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;
subnet  netmask {
 option routers;
 option subnet-mask;
 option domain-name     "expanor.local";
 option domain-name-servers;
 default-lease-time 21600;
 max-lease-time  43200;
 range dynamic-bootp;
 filename   "pxelinux.0";
# 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= 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