Sie sind auf Seite 1von 3

Centos 6 PXE Server

March 28, 2012


Peter
Linux Networking 2 Comments
The following instructions detail how to setup a Centos 6 server to act as a PXE
server allowing for installs over the network. In this case this server acts as a
dedicated management server for our server environment so it acts as a DHCP
server for the management network. If you are running a separate DHCP server
then when it comes to configuring DHCP do it on your DHCP server.
1. There was some weird conflict with the version of DHCP on the Centos 6
version that I installed so I had to upgrade it. You may not have to but it wont
hurt if you do anyway
1

[root@management ~]# yum update dhclient

2. Next you need to install the DHCP server, tftp server and syslinux
1

[root@management ~]# yum install dhcp tftp-server syslinux

3. Disable SELinux if you havent already


1

[root@management ~]# vim /etc/sysconfig/selinux

4. Set the line SELINUX=enforcing to


1

SELINUX=disabled

5. Disable SELinux immediately without a reboot


1

[root@management ~]# setenforce 0

6. Create a directory to store your tftp files. I chose /tftpboot


1

[root@management ~]# mkdir /tftpboot

7. Now copy the required syslinux files into your tftpboot directory. If you choose
a directory other then /tftpboot then you will have to modify the copy
destination to the directory you chose
1

[root@management ~]# cp /usr/share/syslinux/pxelinux.0 /tftpboot/

[root@management ~]# cp /usr/share/syslinux/menu.c32 /tftpboot/

[root@management ~]# cp /usr/share/syslinux/memdisk /tftpboot/

[root@management ~]# cp /usr/share/syslinux/mboot.c32 /tftpboot/

[root@management ~]# cp /usr/share/syslinux/chain.c32 /tftpboot/

8. Create a directory to store your pxe config


1

[root@management ~]# mkdir /tftpboot/pxelinux.cfg

9. Now put the required config in pxelinux.cfg


1

[root@management ~]# vim /tftpboot/pxelinux.cfg/default

10.Add the following to the default file


1

default menu.c32

prompt 0

timeout 300

ONTIMEOUT local

5
6

MENU TITLE PXE Menu

11.You now need to setup configure xinit for tftp


1

[root@management ~]# vim /etc/xinetd.d/tftp

12.You need to update the following two lines


1

server_args = -s /tftpboot

disable = no

13.Set the server_args to your directory and set disable to no. My final config is
1

service tftp

socket_type

protocol

wait

= yes

user

= root

server

server_args

disable

10

per_source

11

cps

= 100 2

12

flags

= IPv4

13

= dgram
= udp

= /usr/sbin/in.tftpd
= -s /tftpboot
= no
= 11

14.Restart xinit for your changes to take effect


1

[root@management ~]# /etc/init.d/xinetd restart

15.Now setup the dhcp server


1

[root@management ~]# vim /etc/dhcp/dhcpd.conf

16.My DHCP config is below. If you already have DHCP configured you only need
to copy the config above the subnet configuration. Change the IP of nextserver to the IP of the PXE server
1

allow booting;

allow bootp;

option option-128 code 128 = string;

option option-129 code 129 = text;

next-server 192.168.100.10;

filename "/pxelinux.0";

7
8

subnet 192.168.100.0 netmask 255.255.255.0{

range 192.168.100.100 192.168.100.200;

10

option routers

11

option subnet-mask

12

option broadcast-address

13

option domain-name-servers

14

option domain-name

15

192.168.100.1; # default gateway


255.255.255.0;
192.168.100.255;
192.168.100.10;
"management.onemetric.local";

17.Start dhcp and set it to start on boot


1

[root@management ~]# /etc/init.d/dhcpd start

[root@management ~]# chkconfig dhcpd on

You will now need to setup your install media:


How to install Centos 6 using PXE

Das könnte Ihnen auch gefallen