Configure PXE Server to automate Oracle Linux 6 unattended installation via network

I am using http method (My images are hosted on the web server)

I configured my virtual machine as below

Memory 2gb
Processors 1
Hard disk (SCSI) 30gb
Network Adapter Bridged(Automatic) (For Internet access and yum installation)
Network Adapter 2 Custom (VMnet4) ( Having IP 192.168.222.1 netmask 255.255.255.0 only for pxe server)

After installing oracle linux server 6.0 configure ip address for network adapter 2

setup public yum server using my guide as per below link.

http://sunilthetechfreak.com/2012/07/18/how-to-setup-public-yum-for-all-updates-on-oracle-linux-6/

The required packages for PXE Server (xinetd,syslinux,dhcpd,tftp-server,httpd)

# install the packages

yum install -y syslinux xinetd tftp-server dhcp httpd

# Enable tftp server & start tftp service

vi /etc/xinetd.d/tftp
Disable=no (only change this line from the tftp file)

service xinetd restart or /etc/init.d/xinetd restart
chkconfig xinetd on (To auto start the service when the system boot)

# Configure DHCP server & start the dhcp service
vi /etc/dhcp/dhcpd.conf

#Global options (also important for pxe booting)

lease-file-name “/var/lib/dhcpd/dhcpd.leases”;
allow booting;
allow bootp;
authoritative;

#subnet of our local network

subnet 192.168.222.0 netmask 255.255.255.0

{

# Parameters for local subnet
option subnet-mask 255.255.255.0;
option domain-name “localdomain”
option domain-name-servers 192.168.222.1; #(This is optional, but i am pointing it to this same server)
default-lease-time 21600;
max-lease-time 43200;

# Client ip range (the range defined here will be given to the client which request the ip for auto installation)

range dynamic-bootp 192.168.222.20 192.168.222.50;

#very important for pxe booting

filename “pxelinux.0”;
next-server 192.168.222.1; (I am point to this same pxe server)

}

#save & close

service dhcpd restart or /etc/init.d/dhcpd restart
chkconfig dhcpd on

# create required directory to copy oracle linux 6 media

[root@oel6-server1 sunil]# mkdir -p /var/pxe/ol6
[root@oel6-server1 sunil]# mkdir -p /var/lib/tftpboot/ol6

#mount the oracle linux 6 dvd or iso file which ever is available

[root@oel6-server1 sunil]# cd /media
[root@oel6-server1 media]# ls
OL6.0 x86_64 Disc 1 20110203

[root@oel6-server1 media]# cd OL*

# Check the contents to see if it is properly mounted.

[root@oel6-server1 OL6.0 x86_64 Disc 1 20110203]# ls -l
total 706
drwxr-xr-x. 3 sunil sunil 2048 Feb 4 2011 EFI
-rw-r–r–. 1 sunil sunil 7041 Feb 4 2011 EULA
-rw-r–r–. 1 sunil sunil 7041 Feb 4 2011 eula.en_US
-rw-r–r–. 1 sunil sunil 3334 Feb 4 2011 eula.py
-rw-r–r–. 1 sunil sunil 18390 Feb 4 2011 GPL
drwxr-xr-x. 3 sunil sunil 2048 Feb 4 2011 HighAvailability
drwxr-xr-x. 3 sunil sunil 2048 Feb 4 2011 images
drwxr-xr-x. 2 sunil sunil 2048 Feb 4 2011 isolinux
drwxr-xr-x. 3 sunil sunil 2048 Feb 4 2011 LoadBalancer
-rw-r–r–. 1 sunil sunil 98 Feb 4 2011 media.repo
drwxr-xr-x. 2 sunil sunil 614400 Feb 4 2011 Packages
-rw-r–r–. 1 sunil sunil 2613 Feb 4 2011 README-en
-rw-r–r–. 1 sunil sunil 7046 Feb 4 2011 README-en.html
-rw-r–r–. 1 sunil sunil 16807 Feb 4 2011 RELEASE-NOTES-en
-rw-r–r–. 1 sunil sunil 19168 Feb 4 2011 RELEASE-NOTES-en.html
lrwxrwxrwx. 1 sunil sunil 15 Feb 4 2011 repodata -> Server/repodata
drwxr-xr-x. 3 sunil sunil 2048 Feb 4 2011 ResilientStorage
-rw-r–r–. 1 sunil sunil 1011 Feb 4 2011 RPM-GPG-KEY
-rw-r–r–. 1 sunil sunil 1011 Feb 4 2011 RPM-GPG-KEY-oracle
drwxr-xr-x. 3 sunil sunil 2048 Feb 4 2011 ScalableFileSystem
drwxr-xr-x. 4 sunil sunil 2048 Feb 4 2011 Server
-rw-r–r–. 1 sunil sunil 108 Feb 4 2011 supportinfo
-r–r–r–. 1 sunil sunil 5357 Feb 4 2011 TRANS.TBL

# copy all the contents to the /var/pxe/ol6 directory.

[root@oel6-server1 OL6.0 x86_64 Disc 1 20110203]# cp –ivr * /var/pxe/ol6

# now copy the kernel & image file from images folder to tftpboot/ol6 directory

[root@oel6-server1 pxeboot]# pwd
/var/pxe/ol6/images/pxeboot

[root@oel6-server1 pxeboot]# ls -l
total 33044
-rw-r–r–. 1 root root 30039242 Jul 9 21:06 initrd.img
-r–r–r–. 1 root root 441 Jul 9 21:06 TRANS.TBL
-rwxr-xr-x. 1 root root 3791744 Jul 9 21:06 vmlinuz

# copy the vmlinuz and initrd.img files to the tftpboot directory.

[root@oel6-server1 pxeboot]# cp vmlinuz /var/lib/tftpboot/ol6
[root@oel6-server1 pxeboot]# cp initrd.img /var/lib/tftpboot/ol6

[root@oel6-server1 pxeboot]# cd /usr/share/syslinux

# copy the menu file.

[root@oel6-server1 syslinux]# cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot

#create folder

[root@oel6-server1 sunil]# mkdir -p /var/lib/tftpboot/pxelinux.cfg

# create default menu file

[root@oel6-server1 sunil]# vi /var/lib/tftpboot/pxelinux.cfg/default
timeout 100
default menu.c32

menu title =======Network Boot Menu=======
label 1
menu label ^ 1) Oracle Linux 6
kernel ol6/vmlinuz
append initrd=ol6/initrd.img ks=http://192.168.0.70/ks/ks.cfg ksdevice=eth0

# save and close

# now configure the webserver (Apache server to get the installation files)

[root@oel6-server1 sunil]# vi /etc/httpd/conf.d/pxeboot.conf

Alias /ol6 /var/pxe/ol6

Options Indexes FollowSymLinks
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 192.168.222.0/24 192.168.1.0/24

#save & close restart the webserver

service httpd restart or /etc/init.d/httpd restart
chkconfig httpd on

#now create kickstart file as per the required configuration

yum install -y system-config-kickstart

system-config-kickstart # you can configure the system as per your requirement

[root@oel6-server1 sunil]# mkdir /var/www/html/ks

# As i already have anaconda-ks.cfg from my earlier installation i will use the same

[root@oel6-server1 sunil]# cp /root/anaconda-ks.cfg /var/www/html/ks/ks.cfg

# Change the permission as below

chmod 644 /var/www/html/ks/ks.cfg

# check if you are able to browse both the installation media & kickstart file from the webserver

Oracle Linux 6 Http image
http://192.168.222.1/ol6

ks file
http://192.168.222.1/ks/ks.cfg

# Stop the Linux firewall

[root@oel6-server1 sunil]# service iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
[root@oel6-server1 sunil]# chkconfig iptables off

# restart all the service httpd,dhcp, xinetd

#configure a new virtual machine using the same network adapter setting Custom (VMnet4) and test your installation. if you have any queries do write to me so i would be able to help.

Error while starting dhcp Server (dhcpd service) in Oracle Linux 6

can’t open /var/lib/dhcpd/dhcpd.leases

[root@oel6-server1 dhcpd]# service dhcpd restart
Starting dhcpd: [FAILED]

[root@oel6-server1 dhcpd]# tail -20 /var/log/messages
Jul 9 16:50:06 oel6-server1 dhcpd: Configuration file errors encountered — exiting
Jul 9 16:50:06 oel6-server1 dhcpd:
Jul 9 16:50:06 oel6-server1 dhcpd: This version of ISC DHCP is based on the release available
Jul 9 16:50:06 oel6-server1 dhcpd: on ftp.isc.org. Features have been added and other changes
Jul 9 16:50:06 oel6-server1 dhcpd: have been made to the base software release in order to make
Jul 9 16:50:06 oel6-server1 dhcpd: it work better with this distribution.
Jul 9 16:50:06 oel6-server1 dhcpd:
Jul 9 16:50:06 oel6-server1 dhcpd: Please report for this software via the Oracle Bugzilla site:
Jul 9 16:50:06 oel6-server1 dhcpd: http://bugzilla.oracle.com
Jul 9 16:50:06 oel6-server1 dhcpd:
Jul 9 16:50:06 oel6-server1 dhcpd: exiting.
Jul 9 16:50:57 oel6-server1 dhcpd: Internet Systems Consortium DHCP Server 4.1.1-P1
Jul 9 16:50:57 oel6-server1 dhcpd: Copyright 2004-2010 Internet Systems Consortium.
Jul 9 16:50:57 oel6-server1 dhcpd: All rights reserved.
Jul 9 16:50:57 oel6-server1 dhcpd: For info, please visit https://www.isc.org/software/dhcp/
Jul 9 16:50:57 oel6-server1 dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
Jul 9 16:50:57 oel6-server1 dhcpd: Can’t open lease database /var/lib/dhcpd/dhcp.leases: No such file or directory —

SOLUTION
When I checked the file as below the owner of dhcpd.lease file was dhcpd

[root@oel6-server1 dhcpd]# ls -ltr
total 0
-rw-r–r–. 1 dhcpd dhcpd 0 Dec 20 2012 dhcpd.leases
-rw-r–r–. 1 dhcpd dhcpd 0 Dec 20 2012 dhcpd6.leases

So I changed the permission to root and restarted the service

[root@oel6-server1 dhcpd]# chown root dhcpd.leases
[root@oel6-server1 dhcpd]# ls -ltr
total 0
-rw-r–r–. 1 root dhcpd 0 Dec 20 2012 dhcpd.leases
-rw-r–r–. 1 dhcpd dhcpd 0 Dec 20 2012 dhcpd6.leases
[root@oel6-server1 dhcpd]# service dhcpd restart
Starting dhcpd: [ OK ]

How to manually configure IP Address in Red Hat Linux 6

Here I am attaching setup by setup guide to manually configure IP address with screenshot’s and command.

How to manually configure IP Address in Red Hat Linux 6