Thursday, 18 October 2012

Install and Configure PXE Server


PXE (Pre-boot eXecution Environment)

Install Required Packages :

# yum -y install dhcp tftp-server syslinux httpd vsftpd system-config-kickstart

Configure DHCP Server :

# vim /etc/dhcp/dhcpd.conf

===============================================================
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;

default-lease-time 600;
max-lease-time 7200;

ddns-update-style none;


log-facility local7;


subnet 10.0.0.0 netmask 255.255.255.0 {
range dynamic-bootp 10.0.0.220 10.0.0.250;

allow booting;
allow bootp;

default-lease-time 600;
max-lease-time 7200;
next-server 10.0.0.202;
filename "/pxelinux.0";
}
===============================================================

Configure TFTP Server :

# vim /etc/xinetd.d/tftp
=====================================================

service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = Ipv4
}

===============================================================

# mount -t iso9660 -o loop CentOS-6.0-x86_64-bin-DVD1.iso /mnt/iso
# cp -a /mnt/iso/* /tftpboot
# mkdir /tftpboot/pxelinux.cfg

Create Kickstart file :

# system-config-kickstart

Save ks.cfg in /var/ftp/pub


# vim /var/ftp/pub/ks.cfg


#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --enabled --ssh
# Install OS instead of upgrade
install
# Use network installation
url --url="ftp://10.0.0.202/pub/iso"
# Root password
rootpw --iscrypted $1$A1SYVVrG$4vMq7X4bUrzQW4OKydPAf/
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --enforcing
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone Asia/Kolkata
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all

%packages
@basic-desktop
@desktop-platform
@fonts
@general-desktop
@graphical-admin-tools

====================================================

Create pxemenu :

# vim /tftpboot/pxelinux.cfg/default

===============================================================

timeout 100
default menu.c32

menu title ########## PXE Boot Menu ##########
label 1
menu label ^1) Install CentOS 6
kernel vmlinuz
append initrd=initrd.img linux ks=ftp://10.0.0.202/pub/ks1.cfg method=ftp://10.0.0.202/pub/iso devfs=nomount


#label 2
# menu label ^2) Install CentOS 6.2
# kernel vmlinuz
# append initrd=initrd.img linux ks=ftp://10.0.0.202/pub/ks1.cfg method=ftp://10.0.0.202/pub/6.2 devfs=nomount
label 2
menu label ^2) Boot from local drive
localboot
===============================================================
# cp /usr/share/syslinux/pxelinux.0 /tftpboot

# cp -vr /mnt/* /var/ftp/pub/

# vim /etc/vsftpd/vsftpd.conf

# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#


Restart & On all the services to persist on reboot..

# service dhcpd restart

# service xinetd restart

# service vsftpd restart

# chkconfig vsftpd on

# chkconfig dhcpd on

# chkconfig xinetd on
# setenforce 0

No comments:

Post a Comment