Ubuntu-14-PXE-Server-For-XenServer-Installation

# apt-get install apache2 isc-dhcp-server tftpd-hpa syslinux

# echo "ServerName UB14-PXE" >> /etc/apache2/apache2.conf


# vi /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 200.0.0.77
netmask 255.255.255.0
auto eth1
iface eth1 inet static
address 192.168.1.77
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8
auto eth2
iface eth2 inet static
address 150.0.0.15
netmask 255.255.255.0

#

# cat /etc/dhcp/dhcpd.conf
allow bootp;
use-host-decl-names true;
option domain-name "SVK-Net";
option domain-name-servers 192.168.1.1;
subnet 150.0.0.0 netmask 255.255.255.0 {
        range 150.0.0.100 150.0.0.150;
        filename "pxelinux.0";
}

#


Set Default interface to serve DHCP

# cat /etc/default/isc-dhcp-server
INTERFACES="eth2"
#



 Add the menu UI file handler.

# cp /usr/lib/syslinux/menu.c32 /var/lib/tftpboot/

# mkdir /var/lib/tftpboot/pxelinux.cfg

Edit /var/lib/tftpboot/pxelinux.cfg/default

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

DEFAULT local
UI menu.c32
PROMPT 1
TIMEOUT 30

LABEL local
        localboot 0

LABEL Install-XenServer-6.2
        kernel xenserver6-2/mboot.c32
        append xenserver6-2/xen.gz dom0_max_vcpus=2 dom0_mem=752M com1=115200,8n1 console=com1,vga --- xenserver6-2/vmlinuz xencons=hvc console=hvc0 console=tty0 answerfile=http://150.0.0.15/xenserver6-2/answerfile install --- xenserver6-2/install.img

LABEL Install-XenServer-6.5
        kernel xenserver6-5/mboot.c32
        append xenserver6-5/xen.gz dom0_max_vcpus=2 dom0_mem=752M com1=115200,8n1 console=com1,vga --- xenserver6-5/vmlinuz xencons=hvc console=hvc0 console=tty0 answerfile=http://150.0.0.15/xenserver6-5/answerfile install --- xenserver6-5/install.img

#

For XenServer6-2
---------------------------------------

Insert XenServer6-2 CD and Mount

# mount /dev/cdrom /mnt
# cd /mnt

# cp ./boot/pxelinux/pxelinux.0 /var/lib/tftpboot ---->Only OneTime

# mkdir -p /var/lib/tftpboot/xenserver6-2
# cp ./boot/pxelinux/mboot.c32 /var/lib/tftpboot/xenserver6-2
# cp ./boot/vmlinuz /var/lib/tftpboot/xenserver6-2
# cp ./boot/xen.gz /var/lib/tftpboot/xenserver6-2
# cp ./install.img /var/lib/tftpboot/xenserver6-2


Create The Answer File and HTTP Repository

# mkdir /var/www/html/xenserver6-2
# cd /mnt
# cp -r packages*  /var/www/html/xenserver6-2
# cp XS-REPOSITORY-LIST /var/www/html/xenserver6-2

# vi /var/www/html/xenserver6-2/answerfile


sda
us
root123                     
http://150.0.0.15/xenserver6-2/
150.0.0.15       

Asia/Kolkata

#

# umount /mnt


For XenServer6-5
----------------------------

Insert XenServer6-5 CD and Mount

# mount /dev/cdrom /mnt
# cd /mnt
# mkdir -p /var/lib/tftpboot/xenserver6-5
# cp ./boot/pxelinux/mboot.c32 /var/lib/tftpboot/xenserver6-5
# cp ./boot/vmlinuz /var/lib/tftpboot/xenserver6-5
# cp ./boot/xen.gz /var/lib/tftpboot/xenserver6-5
# cp ./install.img /var/lib/tftpboot/xenserver6-5



Create The Answer File and HTTP Repository

# mkdir /var/www/html/xenserver6-5
# cd /mnt
# cp -r packages*  /var/www/html/xenserver6-5
# cp XS-REPOSITORY-LIST /var/www/html/xenserver6-5


# vi /var/www/html/xenserver6-5/answerfile


sda
us
root123                     
http://150.0.0.15/xenserver6-5/
150.0.0.15       

Asia/Kolkata

#

# umount /mnt

# /etc/init.d/networking restart
# /etc/init.d/isc-dhcp-server restart
# /etc/init.d/tftpd-hpa restart


Now reboot the Server Start installation using PXE



# ls -ltr /var/www/html/
total 20
-rw-r--r-- 1 root root 11510 Dec 17 11:55 index.html
drwxr-xr-x 5 root root  4096 Dec 17 13:21 xenserver6-2
drwxr-xr-x 5 root root  4096 Dec 17 13:22 xenserver6-5

#


# ls -ltr /var/www/html/xenserver6-2/
total 20
dr-xr-xr-x 2 root root 4096 Dec 17 12:14 packages.main
dr-xr-xr-x 2 root root 4096 Dec 17 12:14 packages.transfer-vm
dr-xr-xr-x 2 root root 4096 Dec 17 12:14 packages.xenserver
-r--r--r-- 1 root root   40 Dec 17 12:15 XS-REPOSITORY-LIST
-rw-r--r-- 1 root root  363 Dec 17 13:21 answerfile

#

# ls -ltr /var/lib/tftpboot/

total 96
-r--r--r-- 1 root root 27323 Dec 17 12:01 pxelinux.0
-rw-r--r-- 1 root root 55012 Dec 17 12:08 menu.c32
drwxr-xr-x 2 root root  4096 Dec 17 12:52 xenserver6-5
drwxr-xr-x 2 root root  4096 Dec 17 13:15 xenserver6-2
drwxr-xr-x 2 root root  4096 Dec 17 13:18 pxelinux.cfg

#

# ls -ltr /var/lib/tftpboot/xenserver6-2
total 32592
-r-xr-xr-x 1 root root    35548 Dec 17 12:01 mboot.c32
-r--r--r-- 1 root root   752011 Dec 17 12:02 xen.gz
-r--r--r-- 1 root root 30193487 Dec 17 12:02 install.img
-r--r--r-- 1 root root  2385786 Dec 17 12:23 vmlinuz

#