Thursday, August 18, 2011

how to configure pxe server?

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

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

ddns-update-style interim;
not authoritative;
option domain-name "";
option domain-name-servers,;
option subnet-mask;
subnet netmask
allow unknown-clients;
allow booting ;
allow bootp ;
filename "pxelinux.0";

Note: The direction belongs to the same PXE server.

[root@fcld ]# yum install vsftp

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

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
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

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

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=
initrd=images/ubuntudesktop/casper/initrd.gz ramdisk_size=32768

Edit the file /etc/exports and add:
[root@fcld ]# nano /etc/exports

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= ramdisk_size=32768

Edit the file /etc/exports que le pertenece and add:
[root@fcld ]# nano /etc/exports

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