PXE-Centos-Server-With-CloneZilla

PXE Server
==========


Server's Static IP = 10.10.10.10 (eth1)

Install vsftpd,xinetd,nfs-utils*,dhcp*,tftp-server,syslinux  Packages


# yum install vsftpd,xinetd,nfs-utils*,dhcp*,tftp-server,syslinux,ftp
1.Configure /etc/dhcp/dhcpd.conf as follows
-------------------------------------------------------------------------

# vi /etc/dhcp/dhcpd.conf
ddns-update-style interim;
not authoritative;
option domain-name "pxe-server.svk";
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 10.10.10.0 netmask 255.255.255.0 {
  authoritative;
  range 10.10.10.100 10.10.10.150;
  option domain-name-servers 10.10.10.10;
  option routers 10.10.10.10;
  allow unknown-clients;
  default-lease-time 600;
  allow booting;
  allow bootp;
  next-server 10.10.10.10;
  filename "pxelinux.0";
}
#


Set eth1 interface to serve DHCP service(Only if two N/w device exist)


# vi /etc/sysconfig/dhcpd
DHCPDARGS=eth1
#

-------------------------------------------------
2.Configure /etc/vsftpd/vsftpd.conf as follows

# vi /etc/vsftpd/vsftpd.conf
anonymous_enable=yes
anon_root=/PXE/os
local_enable=YES
write_enable=YES
local_umask=022
#anon_upload_enable=YES
#anon_mkdir_write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
#dual_log_enable=yes
#

#chmod 755 /PXE/os
#chmod 755 /PXE/tftpboot

-----------------------------------------------------
3.Configure /etc/exports  as follows

# vi /etc/exports
/PXE/os        *(rw,sync)
#

-----------------------------------------------------
4.Configure /etc/xinetd.d/tftp  as follows

# vi /etc/xinetd.d/tftp

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


Create a Directories for PXE-Server


#mkdir  /PXE
#mkdir  /PXE/os
#mkdir  /PXE/tftpboot
#mkdir  /PXE/tftpboot/images
#mkdir  /PXE/tftpboot/pxelinux.cfg

Now mount os cd/dvd and copy all files to /PXE/os/ directory

#mkdir /PXE/os/ubuntu-12.04
#mkdir /PXE/os/ubuntu-10.04
#mkdir /PXE/os/centos-6.5

#cp -R /media/ubuntu12/*   /PXE/os/ubuntu-12.04/
#cp -R /media/ubuntu10/*   /PXE/os/ubuntu-10.04/

#cp -R /media/centos-6.5/*   /PXE/os/centos-6.5/

*****(Copy ".disk" files in live CD to each os directories if not exist)*****
Copy pxelinux.0 and menu.c32 to /PXE/tftpboot/ directory

# cp /usr/share/syslinux/pxelinux.0 /PXE/tftpboot/
# cp /usr/share/syslinux/menu.c32 /PXE/tftpboot/
# cp /usr/share/syslinux/memdisk /PXE/tftpboot/
# cp /usr/share/syslinux/mboot.c32 /PXE/tftpboot/
# cp /usr/share/syslinux/chain.c32 /PXE/tftpboot/


Copy vmlinuz,initrd files from CD or os directory to /PXE/tftpboot/images//

# cp /PXE/os/ubuntu-12.04/casper/initrd.lz       /PXE/tftpboot/images/ubuntu-12.04/
# cp /PXE/os/ubuntu-12.04/casper/vmlinuz         /PXE/tftpboot/images/ubuntu-12.04/
# cp /PXE/os/ubuntu-10.04/casper/initrd.lz      /PXE/tftpboot/images/ubuntu-10.04/
# cp /PXE/os/ubuntu-10.04/casper/vmlinuz        /PXE/tftpboot/images/ubuntu-10.04/

Download the vimlinuz,initrd.img files for centos-6.5 from
( http://mirror.ovh.net/ftp.centos.org/6.5/os/i386/images/pxeboot/)
and copy it to  /PXE/tftpboot/images/centos-6.5/


# cp ~/Downloads/initrd.img /PXE/tftpboot/images/centos-6.5/
# cp ~/Downloads/vmlinuz /PXE/tftpboot/images/centos-6.5/



Copy the vmlinuz,initrd.img,filesystem.squashfs files from clonezilla ISO/CD
to /4pxe/tftpboot/images/clonezilla/ directory and give execute permission.


# cp /media/clonezilla/live/vmlinuz    /PXE/tftpboot/images/clonezilla/
# cp /media/clonezilla/live/inird.img    /PXE/tftpboot/images/clonezilla/
# cp /media/clonezilla/live/filesystem.squashfs    /PXE/tftpboot/images/clonezilla/


------------------------------------------------------------------------

Now create or edit /PXE/tftpboot/pxelinux.cfg/default file as follows

# vi /PXE/tftpboot/pxelinux.cfg/default

default menu.c32
prompt 0
timeout 300
MENU TITLE OS-4-Install

LABEL CentOS 6.5
KERNEL images/centos-6.5/vmlinuz
APPEND vga=normal initrd=images/centos-6.5/initrd.img ramdisk_size=32768
METHOD=ftp://10.10.10.10/centos-6.5/



LABEL Ubuntu 12.04
MENU LABEL Ubuntu 12.04
    kernel images/ubuntu-12.04/vmlinuz
    append boot=casper netboot=nfs  nfsroot=10.10.10.10:/PXE/os/ubuntu-12.04  initrd=images/ubuntu-12.04/initrd.lz -- splash quiet


LABEL Ubuntu 10.04
MENU LABEL Ubuntu 10.04
    kernel images/ubuntu-10.04/vmlinuz
    append boot=casper netboot=nfs  nfsroot=10.10.10.10:/PXE/os/ubuntu-10.04  initrd=images/ubuntu-10.04/initrd.lz -- splash quiet


LABEL Clonezilla
MENU LABEL CloneZilla 2.1
KERNEL images/clonezilla/vmlinuz
APPEND initrd=images/clonezilla/initrd.img boot=live config noswap nolocales edd=on nomodeset ocs_live_run="ocs-live-general" ocs_live_extra_param="" keyboard-layouts="" ocs_live_batch="no" locales="" vga=788 nosplash noprompt fetch=tftp://10.10.10.10/images/clonezilla/filesystem.squashfs

------------------------------------------------------------------------

Now start services and check pxe booting on client


# chkconfig dhcpd on
# chkconfig vsftpd on
# chkconfig xinetd on
# chkconfig rpcbind on
# chkconfig nfs on


# service rpcbind restart
# service nfs restart
# service dhcpd restart
# service vsftpd restart
# service xinetd restart


Installation Tips on Client
==============================


For Centos-6.5 installation
---------------------------------------------


Boot client to boot from network option
Select centos OS
Select URL installation method
provide ftp url as ftp://10.10.10.10/centos-6.5
and start installation


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