Comme nous avons déjà vu récemment, on peut facilement avoir un serveur de mirroir CentOS local [ http://www.itsg33k.ca/2011/07/08/configuration-dun-serveur-mirroir-yum-centos-local/]. Maintenant, on va voir comment utiliser ce serveur pour effectuer un démarrage PXE.

Dépendances

yum install tftp-server syslinux

Configuration TFTP
/etc/xinetd.d/tftp

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

Préparer le répertoire d’images

service xinetd restart
cp /usr/lib/syslinux/{pxelinux.0,menu.c32,memdisk,mboot.c32,chain.c32} /tftpboot
mkdir /tftpboot/pxelinux.cfg
mkdir /tftpboot/images
mkdir -p /tftpboot/images/centos/5.6/x86_64
cd /tftpboot/images/centos/5.6/x86_64
wget http://centos.mirror.iweb.ca/5.6/os/x86_64/images/pxeboot/initrd.img
wget http://centos.mirror.iweb.ca/5.6/os/x86_64/images/pxeboot/vmlinuz

Configurer le menu PXE

default menu.c32
prompt 0
timeout 300
ONTIMEOUT local
 
MENU TITLE PXE Menu
 
LABEL local
	MENU LABEL Boot local hard drive
        LOCALBOOT 0
 
LABEL CentOS 5.6 x86_64 KickStart
        MENU LABEL CentOS 5.6 x86_64 KickStart
        KERNEL images/centos/5.6/x86_64/vmlinuz
        APPEND ks=http://<server>/ks/newhost.cfg initrd=images/centos/5.6/x86_64/initrd.img text
 
LABEL CentOS 6.0 x86_64 KickStart
        MENU LABEL CentOS 6.0 x86_64 KickStart
        KERNEL images/centos/6.0/x86_64/vmlinuz
        APPEND ks=http://<server>/ks/newhost.cfg initrd=images/centos/6.0/x86_64/initrd.img text

Vous pouvez enlever le ks= si vous ne voulez pas utiliser un fichier Kickstart

DHCP
Maintenant vous devez configurer votre serveur DHCP pour servir les options 066 (Boot Server Host Name) et 067 (Bootfile Name)

066 = 
067 = /pxelinux.0