====== CentOS 6下PXE服务器配置的几点事项 ======
在[[.:pxe|PXE服务器的安装和配置]]一文中已经讲述了一个完整的PXE服务器例子,不过操作系统是基于[[http://www.slackware.com/|slackware]]的,本文讲述在[[http://www.centos.org|CentOS]] 6下的一些不同之处,相同部分将不再重复。
===== TFTP服务器 =====
==== xinetd安装 ====
tftp服务器通过xinetd启动,如果尚未安装过xinetd,则进行安装:
yum install xinetd
==== tftp安装和配置 ====
接下来安装tftp server,这里同时安装了client(可选):
yum install tftp-server
yum install tftp
编辑配置文件/etc/xinetd.d/tftp,完整的文件内容如下:
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /repo/ftp/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
修改了两个地方:一个是文件服务器根路径(第13行),一个是启用服务(第14行)。
==== 防火墙设置 ====
CentOS下的防火墙缺省是开启的,所以需要打开tftp端口。执行如下命令进行配置:
system-config-firewall
==== SELinux设置 ====
CentOS下的tftp服务缺省文件目录是/var/lib/tftpboot,由于我们将目录调整为/repo/ftp/tftpboot,所以需要修改新目录以及目录下的所有文件的SELinux context。
由于文件较多,逐一修改很麻烦,最好是在新建目录阶段就设置好:
mkdir /repo/ftp/tftpboot
chcon --reference=/var/lib/tftpboot /repo/ftp/tftpboot
之后在/repo/ftp/tftpboot目录下新建和复制文件,都会自动设好context。
===== DHCP服务器 =====
==== 安装 ====
安装dhcp服务器软件包:
yum install dhcp
==== 配置 ====
主配置文件为/etc/dhcp/dhcpd.conf,内容是一样的。
设置dhcpd服务的网络接口的地方是/etc/sysconfig/dhcpd(以eth0为例):
DHCPDARGS=eth0
==== 启动 ====
启动dhcp服务:
service dhcpd start
{{tag>PXE CentOS}}