How to install Linux RedHat 5.x or 6.x using kickstart with TFTP (PXE) method


A. TFTP (PXE) Kickstart installation method

This post will not cover basic windows or Linux command that you must know before following this procedure.

1) Install Apache packages

rpm -ivh apr-util-1.2.7-11.el5_5.2.i386.rpm
rpm -ivh apr-1.2.7-11.el5_6.5.i386.rpm
rpm -ivh httpd-2.2.3-45.el5.i386.rpm

or

yum install apr-util
yum install apr
yum install httpd

2) install dnsmasq (if not alreay installed)

rpm -ivh dnsmasq-2.45-1.1.el5_3.i386.rpm

or

yum install dnsmasq

3) Add the following entry in /etc/httpd/conf/httpd.conf for Apache server

ServerName localhost:80

<Directory /var/www/html/pub>
    Options +Indexes
    AllowOverride AuthConfig
    Order allow,deny
    Allow from all
</Directory>

4) uncomment and modify the following lines in /etc/dnsmasq.conf for DHCP server

domain-needed
bogus-priv
expand-hosts
domain=mydomain.com
dhcp-range=<start_ip_address>,<endt_ip_address>,24H
dhcp-host=08:00:27:54:10:17,<ip_address>
dhcp-boot=linux-install/pxelinux.0
log-queries
log-dhcp
conf-dir=/etc/dnsmasq.d

5) run the following command to create the RHEL directory and necessary kernel/ram disk files

pxeos -a -i “PXE installation” -p HTTP -D 0 -s <ip_address> -K http://<ip_address>/pub/kickstart/ks.cfg -L /pub RHEL

verify with the command

pxeos -l

example:

pxeos -l

RHEL5
        Description:    PXE installation
        Protocol:       HTTP
        isDiskless:     False
        Server:         10.10.10.1
        Location:       /pub

ls -lrt /tftpboot/linux-install/RHEL
total 9400
-rw-r–r– 1 root root 1888084 Sep 20 14:46 vmlinuz
-rw-r–r– 1 root root      61 Sep 20 14:46 ks.cfg
-rw-r–r– 1 root root 7700914 Sep 20 14:46 initrd.img

6) run the following command to create specific boot configuration which will overide the default boot configuration files

pxeboot -a -K http://<ip_address>/pub/kickstart/ks.cfg -O RHEL <ip_address>

verify with the command

pxeboot -l

example:

pxeboot -l

pxelinux client: 10.10.10.1
default RHEL
label RHEL
    kernel RHEL/vmlinuz
    append initrd=RHEL/initrd.img  ramdisk_size=9322 method=http://10.10.10.1/pub ip=dhcp

ls -lrt /tftpboot/linux-install/pxelinux.cfg

total 24
-rw-r–r– 1 root root 276 Sep 20 14:46 pxeos.xml
-rw-r–r– 1 root root 345 Sep 20 14:46 default
-rw-r–r– 1 root root 148 Sep 23 11:14 0A0A0A01

cat /tftpboot/linux-install/pxelinux.cfg/0A0A0A01

default RHEL

label RHEL

    kernel RHEL/vmlinuz
    append initrd=RHEL/initrd.img  ramdisk_size=9322 ks=http://10.10.10.1/pub/kickstart/ks.cfg

7) turn on dnsmasq and httpd sercices

chkconfig dnsmasq on
chkconfig httpd on

8) copy the complete RedHat DVD to the public location of your Apache server (On this case, copy the content of the DVD to /var/www/html/pub)

Modify the file /var/www/html/pub/kickstart/ks.cfg as follow:

install
text
url –url http://<ip_address>/pub
key –skip
lang en_US.UTF-8
keyboard be-latin1
network –bootproto=dhcp –device=eth0 –noipv6

9) start apache server

/usr/sbin/apachectl -k start

Test your connection to HTTP server and make sure you can download files :

wget http://<ip_address>/pub/kickstart/ks.cfg

example:

wget http://10.29.1.11/pub/kickstart/ks.cfg

–2011-09-20 14:36:32–  http://10.29.1.11/pub/kickstart/ks.cfg
Connecting to 10.29.1.11:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 6211 (6.1K) [text/plain]
Saving to: `ks.cfg’
100%[==============================================================================>] 6,211       –.-K/s   in 0s
2011-09-20 14:36:32 (127 MB/s) – `ks.cfg’ saved [6211/6211]

10) start dnsmasq daemon

/etc/init.d/dnsmasq start

11) from another terminal session on your kickstart server, monitor /var/log/messages to see messages from DHCP server  and /var/log/httpd/access.log to see message from Apache server:

tail -f /var/log/messages
tail -f /var/log/httpd/access.log

12) change the boot order of the linux client

Network -> Harddisk

13) if you are using VirtualBox, Make sure both VM are in “internal network (inet)” mode

14) if you are using VirtualBox, Make sure the client use the following Network interface

PCnet-Fast III (Am 79c973)

15) Power on your virtual machine

16) At boot option, choose option 1 (PXE installation)

17) the installation will start automatically:

to see system log, do ALt+F3
to see kernel log, do ALt+F4
to access graphical view, do ALT+F1
to access shell prompt, do ALT+F2

18) At the End of the installation, power off the virtual machine (kickstart configuration will only shutdown after full installation automatically)  and change the boot order to :

HardDisk -> CD-ROM and disable network boot

19) power on your virtual machine

20) You are done!

B. TFTP method is not working with static IP address:

“Considerations when using static IP addresses:

– It is not possible to use PXE; you must use diskettes/CD/DVD
– You must designate a pool of IP addresses in advance by either assigning a permanent static IP address or reusing a deployment pool of static IP addresses
– Changing addresses requires that individual computers are modified
– A security risk exists if intruders know the available IP addresses

Mitigating risks associated with using static IPs include:

– Establish a small pool of static IP addresses that are used exclusively for deployment, using permanent IP addresses for deployed systems
– Create a set of boot diskettes for as many systems as you will deploy at one time
– Use virtual computers (import computers) to preassign tasks and computer names or permanent IP addresses before computers are powered on
– Install the BootWorks hidden or embedded partition after the system is deployed to enable easy remote management and imaging. 
  This method uses a permanent IP address.”

Comments are closed.