Step 0. Download CentOS-6.4-x86_64-bin-DVD1.iso from CentOS website
Step 1. Install OS (minimal install is OK)
Step 2. After booting successfully, use yum to install necessary packages:
#yum install dhcp.x86_64 tftp-server.x86_64 syslinux httpd.x86_64(If using http as installation method)
Step 3. Set up networking before initial DHCP service
#service network stop
#service NetworkManager stop (If not minimal installation)
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
#ip6tables -F
#service NetworkManager stop (If not minimal installation)
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
#ip6tables -F
DEVICE=eth0
TYPE=Ethernet
IPADDR=192.168.10.1
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=static
NM_CONTROLLED=no
DELAY=0
IPV6INIT=yes
IPV6ADDR=2001::1/112
IPV6_DEFAULTGW=2001::1
TYPE=Ethernet
IPADDR=192.168.10.1
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=static
NM_CONTROLLED=no
DELAY=0
IPV6INIT=yes
IPV6ADDR=2001::1/112
IPV6_DEFAULTGW=2001::1
#vi /etc/sysconfig/dhcpd
DHCPDARGS=eth0
#vi /etc/sysconfig/dhcpd6
DHCPDARGS=eth0
#vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
NETWORKING_IPV6=yes
#service network start
Step 4. Modify DHCP service configuration
#vi /etc/dhcp/dhcpd.conf
default-lease-time 14400;
max-lease-time 86400;
ddns-update-style none;
subnet 192.168.10.0 netmask 255.255.255.0 {
option broadcast-address 192.168.10.255;
option routers 192.168.10.1;
range 192.168.10.2 192.168.10.253;
next-server 192.168.10.1;
if substring (option vendor-class-identifier, 15, 5) = "00007" {
filename "/BOOTX64.efi";
}
else {
filename "/pxelinux.0";
}
}
max-lease-time 86400;
ddns-update-style none;
subnet 192.168.10.0 netmask 255.255.255.0 {
option broadcast-address 192.168.10.255;
option routers 192.168.10.1;
range 192.168.10.2 192.168.10.253;
next-server 192.168.10.1;
if substring (option vendor-class-identifier, 15, 5) = "00007" {
filename "/BOOTX64.efi";
}
else {
filename "/pxelinux.0";
}
}
#vi /etc/dhcp/dhcpd6.conf
allow booting;
allow bootp;
ddns-update-style none;
default-lease-time 2592000;
preferred-lifetime 604800;
option dhcp-renewal-time 3600;
option dhcp-rebinding-time 7200;
option dhcp6.bootfile-url code 59 = string;
allow leasequery;
option dhcp6.info-refresh-time 21600;
subnet6 2001::/112 {
range6 2001::1001 2001::fffe;
option dhcp6.bootfile-url "tftp://[2001::1]/bootx64.efi";
}
allow bootp;
ddns-update-style none;
default-lease-time 2592000;
preferred-lifetime 604800;
option dhcp-renewal-time 3600;
option dhcp-rebinding-time 7200;
option dhcp6.bootfile-url code 59 = string;
allow leasequery;
option dhcp6.info-refresh-time 21600;
subnet6 2001::/112 {
range6 2001::1001 2001::fffe;
option dhcp6.bootfile-url "tftp://[2001::1]/bootx64.efi";
}
#service dhcpd start
#service dhcpd6 start
#service dhcpd6 start
Step 5. Put the installation media to the proper directory
Copy CentOS-6.4-x86_64-bin-DVD1.iso into server and
Copy CentOS-6.4-x86_64-bin-DVD1.iso into server and
#mount -oloop CentOS-6.4-x86_64-bin-DVD1.iso /mnt
#mkdir /var/lib/tftpboot/CentOS6.4x64
#cp -r /mnt/images/pxeboot /var/lib/tftpboot/CentOS6.4x64
#mkdir /var/www/html/CentOS6.4x64
#cp -r /mnt/* /var/www/html/CentOS6.4x64
#service httpd start
#mkdir /var/lib/tftpboot/CentOS6.4x64
#cp -r /mnt/images/pxeboot /var/lib/tftpboot/CentOS6.4x64
#mkdir /var/www/html/CentOS6.4x64
#cp -r /mnt/* /var/www/html/CentOS6.4x64
#service httpd start
Step 6. Set up syslinux (for legacy BIOS PXE) configuration:
#cp /usr/share/syslinux/{menu.c32,pxelinux.0} /var/lib/tftpboot
#mkdir /var/lib/tftpboot/pxelinux.cfg
#vi /var/lib/tftpboot/pxelinux.cfg/default
#mkdir /var/lib/tftpboot/pxelinux.cfg
#vi /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu.c32
label CentOS 6.4 x64
MENU LABEL CentOS 6.4 x64
kernel CentOS6.4x64/pxeboot/vmlinuz
append initrd=CentOS6.4x64/pxeboot/initrd.img \ method=http://192.168.10.1/CentOS6.4x64 ip=dhcp
label CentOS 6.4 x64
MENU LABEL CentOS 6.4 x64
kernel CentOS6.4x64/pxeboot/vmlinuz
append initrd=CentOS6.4x64/pxeboot/initrd.img \ method=http://192.168.10.1/CentOS6.4x64 ip=dhcp
Step 7. Set up UEFI PXE configuration:
#mkdir ~/efi
#mount -oloop /mnt/images/efiboot.img ~/efi
#cp ~/efi/EFI/BOOT/{BOOTX64.efi,splash.xpm.gz} /var/lib/tftpboot
#vi /var/lib/tftpboot/efidefault
#mount -oloop /mnt/images/efiboot.img ~/efi
#cp ~/efi/EFI/BOOT/{BOOTX64.efi,splash.xpm.gz} /var/lib/tftpboot
#vi /var/lib/tftpboot/efidefault
default=0
splashimage=(nd)/splash.xpm.gz
timeout=8
title CentOS6.4 x64
root (nd)
kernel /CentOS6.4x64/pxeboot/vmlinuz \ method=http://192.168.10.1/CentOS6.4x64 ip=dhcp
initrd /CentOS6.4x64/pxeboot/initrd.img
(for ipv6, change kernel parameter as
kernel /CentOS6.4x64/pxeboot/vmlinuz \ repo=http://[2001::1]/CentOS6.4x64 ipv6=dhcp)
Step 8. Set up tftp server
#vi /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv6
}
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv6
}
#service xinetd start
Done!
If you want to make sure the PXE server works properly after reboot, please add the commands below.
#chkconfig network on
#chkconfig NetworkManager off (if need)
#chkconfig dhcpd on
#chkconfig dhcpd6 on
#chkconfig xinetd on
#chkconfig httpd on
#vi /etc/rc.local
#chkconfig NetworkManager off (if need)
#chkconfig dhcpd on
#chkconfig dhcpd6 on
#chkconfig xinetd on
#chkconfig httpd on
#vi /etc/rc.local
ip6tables -F
Now we use an UEFI supported Noteboot to see how it works under different PXE function.
1. We choose Legacy Network as boot option
2. After getting IP from DHCP server, the system will go to tftp server (which we set next-server option in /etc/dhcp/dhcpd.conf) and loading pxelinux.0 in /var/lib/tftpboot directory.
3.This menu shows the selections wrote in /var/lib/tftpboot/pxelinux.cfg/default
4. This time we choose UEFI IPv4 as boot option.
5. After pressing Enter, the screen shows "Checking Media Presence" in the upper-left corner, it may take couple seconds to load /var/lib/tftpboot/{BOOTX64.efi, splash.xpm.gz}
6. And then it shows the menu which wrote in /var/lib/tftpboot/efidefault
7. After pressing one of the OS, system start to load the vmlinuz and initrd.img
8. After loading the kernel and initrd, this screen will confirm the installation method again. In our case, we use httpd.
9. If you choose UEFI IPv6, it's totally the same as UEFI IPv4.
Thanks for my colleagues Mars and Jasper, they spend a lot of time to help me searching useful info and official guide. And Jack donates his new Notebook (the only 2 has UEFI function in Lab) to test. Help it won't kill the NIC port function.