Linux – RHEL unattended installation step by step with PXE boot

***Prerequisite***
########################################

  • DHCPD install & running
  • TFTP install & running
  • HTTPD install & running ( Though NFS & FTP will also work but I prefer HTTPD over these)

NoteI am not covering how to install DHCPD/TFTP(xinet.d) & HTTPD installation.

#######################################

***Configuration***

The following is DHCPD.CONF file based on the requirement.

  • I will use 192.168.10.0/24 subnet assigned to auto-kickstart deployment on multiple server.
  • DHCPD/TFTPD/HTTPD are placed on same system in order to better sync
  • next-server is TFTP IP address while in ourcase this is same as DHCP/HTTPD
  • Though you can also configure one by one by mapping hw address of machine where you want to deploy like

#host esxi5first {
#        hardware ethernet 00:0C:29:90:B1:B2;
#        fixed-address 192.168.10.221;
#        option host-name “esxifirst”;
#        filename “pxelinux.0”;
#        next-server 192.168.10.200;
#}

but in this case you need to remove the following lines for subnet section ( i. e subnet 192.168.10.0 netmask 255.255.255.0 {)

filename “pxelinux.0”;
next-server 192.168.10.200;
#########################################################
DHCPD.CONF
#########################################################
[root@rhel1 pxelinux.cfg]# cat /etc/dhcp/dhcpd.conf
ddns-update-style ad-hoc;
allow booting;
allow bootp;
#gPXE options
option space gpxe;
option gpxe-encap-opts code 175 = encapsulate gpxe;
option gpxe.bus-id code 177 = string;
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.220 192.168.10.254;
default-lease-time 3600;
max-lease-time 4800;
option routers 192.168.10.200;
option domain-name-servers 192.168.10.200;
option subnet-mask 255.255.255.0;
option ntp-servers 192.168.10.200;
filename “pxelinux.0”;
next-server 192.168.10.200;

}
[root@rhel1 pxelinux.cfg]#
##############################################################
TFTPD SETUP

  •  Create /tftpboot directory & create folder images/rhel6
  •  Copy menu.c32 & pxelinux.0 from /usr/local/syslinux to /tftpboot
  • Copy initrd.img & vmlinuz from mounted RHEL DVD images directory to /tftp/images/rhel6
  • Create a directory named ‘pxelinux.cfg’

##############################################################
[root@rhel1 pxelinux.cfg]# tree -AF /tftpboot/

/tftpboot/

├── images/

│   └── rhel6/

│       ├── initrd.img

│       └── vmlinuz

├── menu.c32

├── pxelinux.0

└── pxelinux.cfg/

└── default
#################################################
Default file content under /tftpboot/pxelinux.cfg/default

  • Create a file named ‘default’ with the following content ks=http://192.168.10.200/rh.cfg is web server ( httpd address) where kickstart file (rh.cfg) is kept.
  • This kickstart file also read the content (RPM) of RHEL DVD in order to install the same. Syntax is configured on rh.cfg file as url –url http://192.168.10.200/rhel

######################################################
[root@rhel1 html]# cat /tftpboot/pxelinux.cfg/default
default menu.c322
prompt 0
timeout 300
MENU TITLE ******* PXE BOOT MENU ********
LABEL RHEL6.0 x64
MENU LABEL RHEL6.0 x64
KERNEL images/rhel6/vmlinuz
append vga=normal initrd=images/rhel6/initrd.img ramdisk_size=1024 ksdevice=eth1 ks=http://192.168.10.200/rh.cfg
#####################################################
Kickstart file rh.cfg
You can modified as per your requirement, you can add %post section, modified %package as well.This is unattended installation
####################################################
# This is an installation not an upgrade
install
url –url http://192.168.10.200/rhel
lang en_US
autostep –autoscreenshot
text
keyboard us
#xconfig –defaultdesktop kde –resolution 640×480 –depth 8
network –device eth0 –bootproto dhcp –onboot=on
rootpw –iscrypted $1$tihTg7ne$hohhkj87hGGddg9B4WkXV1
authconfig –useshadow –enablemd5
selinux –disabled
timezone America/New_York
firewall –disabled
firstboot –disable
# Reboot after installation
reboot
bootloader
reboot
clearpart –all –initlabel
# define partitions
part /boot –fstype ext3 –size=512
part /opt –fstype ext3 –size=5000 –grow
part /usr –fstype ext3 –size=5000
part /tmp –fstype ext3 –size=7500
part /var –fstype ext3 –size=7500
part /home –fstype ext3 –size=2500
part swap –size=2048
part / –fstype ext3 –size=2048
part /usr/local –fstype ext3 –size=1000
########################################################

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: