Wednesday, January 15, 2014

Install PXE install server Centos 6.5

I found that the CentOS wiki was pretty outdated so I wrote this quick guide to setup a PXE install server on Centos 6.5 i386. Change i386 to x86_64 for 64bit installations

#Pseudo-scritp to install Centos 6.5 PXE server

sudo su -l
yum -y install syslinux tftp-server

vi /etc/xinetd/tftp

# Change disable to yes

service xinetd restart

chkconfig xinetd on

# Change according to your ARCH/Version
mkdir -p /tftpboot/images/centos/i386/6.5

#Download iso file for livecd
cd ~/Downloads
wget http://mirror.ovh.net/ftp.centos.org/6.5/os/i386/images/pxeboot/vmlinuz
wget http://mirror.ovh.net/ftp.centos.org/6.5/os/i386/images/pxeboot/initrd.img

# Copy images to directory
cp vmlinuz /var/lib/tftpboot/images/centos/i386/6.5/vmlinuz
cp initrd.img  /var/lib/tftpboot/images/centos/i386/6.5/initrd.img

#Edit dhcpd server

vi /etc/dhcpd/dhcpd.conf

#Add this to your dhcpd.conf file
#Change the below for your server ip

allow booting;
allow bootp;
option option-128 code 128 = string;
option option-129 code 129 = text;
next-server xxx.xxx.xxx.xxx;
filename "/pxelinux.0";

service dhcpd restart

#Copy files into tftpboot
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot
cp /usr/share/syslinux/memdisk /var/lib/tftpboot
cp /usr/share/syslinux/mboot.c32 /var/lib/tftpboot
cp /usr/share/syslinux/chain.c32 /var/lib/tftpboot


mkdir /var/lib/tftpboot/pxelinux.cfg

#Create menu
vi /var/lib/tftpboot/pxelinux.cfg/default

#Add the following
DEFAULT linux
PROMPT 100

LABEL linux
  KERNEL images/centos/i386/6.5/vmlinuz
  APPEND initrd=images/centos/i386/6.5/initrd.img

-----------------------
# Install nfs server

yum -y install nfs-utils
vi /etc/idmapd.conf
# line 5: uncomment and change to your domain name
Domain = server.world
vi /etc/exports
# write like below *note
/var/lib/tftpboot 172.16.0.0/16(rw,sync,no_root_squash,no_all_squash)
/etc/rc.d/init.d/rpcbind start 
/etc/rc.d/init.d/nfslock start 
/etc/rc.d/init.d/nfs start 
chkconfig rpcbind on 
chkconfig nfslock on 
chkconfig nfs on 


No comments:

Post a Comment