Thursday, August 18, 2011

how to configure pxe server?

Pxe server with various OSes:-
how to do pxe server(network boot)


DHCP
[root@fcld ]# yum install dhcp
[root@fcld ]# nano /etc/dhcpd.conf

ddns-update-style interim;
not authoritative;
option domain-name "codigolibre.org";
option domain-name-servers 196.3.81.132, 200.88.127.22;
option subnet-mask 255.255.255.0;
subnet 10.0.200.0 netmask 255.255.255.0
{
authoritative;
range 10.0.200.50 10.0.200.100;
allow unknown-clients;
allow booting ;
allow bootp ;
next-server 10.0.200.1;
filename "pxelinux.0";
}

Note: The 10.0.200.1 direction belongs to the same PXE server.

VSFTP
[root@fcld ]# yum install vsftp

TFTP
[root@fcld ]# yum install tftp-server
[root@fcld ]# nano /etc/xinetd.d/tftp
disable=no

Make the following directories
[root@fcld ]# mkdir /tftpboot/
[root@fcld ]# mkdir /tftpboot/images
[root@fcld ]# mkdir /tftpboot/pxelinux.cfg
[root@fcld ]# chmod -R 777 /tftpboot/

Copy those files to /tftpboot/
[root@fcld ]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
[root@fcld ]# cp /usr/lib/syslinux/menu.c32 /tftpboot/

Create and edit the PXE menu config file.
[root@fcld]# nano /tftpboot/pxelinux.cfg/default
DEFAULT menu.c32
PROMPT 0
TIMEOUT 600
MENU TITLE Servidor de Instalacion de la FCLD

Config each one of the distros.
a) CentOS 5

[root@fcld ]# mkdir /tftpboot/images/centos/5/i386
[root@fcld ]# mkdir /var/ftp/centos/5/i386
[root@fcld ]# mount -o loop -t iso9660 ~/Centos5.iso /mnt
[root@fcld ]# cp -R /mnt/* /var/ftp/centos/5/i386/
[root@fcld ]# cp /var/ftp/centos/5/i386/images/pxeboot/vmlinuz /tftpboot/images/centos/5/i386/
[root@fcld ]# cp /var/ftp/centos/5/i386/images/pxeboot/initrd.img /tftpboot/images/centos/5/i386/

Add Centos entry on PXE menu:
LABEL Centos 5 (DVD-i386)
KERNEL images/centos/5/i386/vmlinuz
APPEND vga=normal initrd=images/centos/5/i386/initrd.img ramdisk_size=32768
METHOD=ftp://10.0.200.1/centos/5/i386/

b) Fedora 11
[root@fcld ]# mkdir /tftpboot/images/fedora/11/i386
[root@fcld ]# mkdir /var/ftp/fedora/11/i386
[root@fcld ]# mount -o loop -t iso9660 ~/Fedora-11.iso /mnt
[root@fcld ]# cp -R /mnt/* /var/ftp/fedora/11/i386/
[root@fcld ]# cp /var/ftp/fedora/11/i386/vmlinuz /tftpboot/images/fedora/11/i386/
[root@fcld ]# cp /var/ftp/fedora/11/i386/initrd.img /tftpboot/images/fedora/11/i386/

Add fedora entry on PXE menu:
[root@fcld]# nano /tftpboot/pxelinux.cfg/default
LABEL Fedora Core 11
KERNEL images/fedora/11/i386/vmlinuz
APPEND vga=normal initrd=images/fedora/11/i386/initrd.img ramdisk_size=32768
METHOD=ftp://10.0.200.1/fedora/11/i386/

c) Ubuntu 9.10
[root@fcld ]# mkdir /tftpboot/images/ubuntu-desktop
[root@fcld ]# mkdir /var/ftp/ubuntu-desktop
[root@fcld ]# mount -o loop -t iso9660 ~/Ubuntu-9.10.iso /mnt
[root@fcld ]# cp -R /mnt/* /tftpboot/images/ubuntu-desktop/
[root@fcld ]# cp -R /mnt/* /var/ftp/ubuntu-desktop/

Add the ubuntu entry to PXE menu:
[root@fcld]# nano /tftpboot/pxelinux.cfg/default
LABEL Ubuntu 9.10 Karmic Koala
KERNEL images/ubuntu-desktop/casper/vmlinuz
APPEND vga=normal boot=casper netboot=nfs nfsroot=10.0.200.1:/var/ftp/ubuntu-desktop/
initrd=images/ubuntudesktop/casper/initrd.gz ramdisk_size=32768

Edit the file /etc/exports and add:
[root@fcld ]# nano /etc/exports
/var/ftp/ubuntu-desktop 10.0.200.0/255.255.255.0(rw)

c) Clonezilla 1.2.2
[root@fcld ]# mkdir /tftpboot/images/clonezilla
[root@fcld ]# mkdir /var/ftp/clonezilla
[root@fcld ]# mount -o loop -t iso9660 ~/clonezilla-1.2.iso /mnt
[root@fcld ]# cp -R /mnt/* /tftpboot/images/clonezilla/
[root@fcld ]# cp -R /mnt/* /var/ftp/clonezilla/

Add entry for clonezilla on PXE menu:
[root@fcld]# nano /tftpboot/pxelinux.cfg/default

LABEL Clonezilla 1.2.2
KERNEL images/clonezilla/live/vmlinuz1
APPEND vga=normal initrd=images/clonezilla/live/initrd1.img boot=live union=aufs
netboot=nfs nfsroot=10.0.200.1:/var/ftp/clonezilla/ ramdisk_size=32768

Edit the file /etc/exports que le pertenece and add:
[root@fcld ]# nano /etc/exports
/var/ftp/clonezilla 10.0.200.0/255.255.255.0(rw)

Start or restart the daemons
[root@fcld ]# service vsftpd restart
[root@fcld ]# service xinetd restart
[root@fcld ]# service nfs restart
[root@fcld ]# service dhcpd restart

Make the daemons start on boot
[root@fcld ]# chkconfig vsftpd --level 345 on
[root@fcld ]# chkconfig xinetd --level 345 on
[root@fcld ]# chkconfig nfs --level 345 on
[root@fcld ]# chkconfig dhcpd --level 345 on

NOTE: After completion of all relevant daemons start, remember to initialize the DHCPD requires a network card configured on the same subnet that the server work.


content from nixcraft

No comments:

Post a Comment