- 服务器列表:
角色 ip地址 dhcp+ftp服务器 192.168.8.81 客户端 -
- 安装配置dhcp:
a. 安装:yum -y install dhcp
b. 配置:vim /etc/dhcp/dhcpd.confdefault-lease-time 21600; max-lease-time 43200; log-facility local7; subnet 192.168.8.0 netmask 255.255.255.0 { range 192.168.8.10 192.168.8.100; option routers 192.168.8.1; next-server 192.168.8.81; filename "/pxelinux.0"; }
- 安装配置vsftp:
a. 安装:yum -y install vsftp
b. 配置:vim /etc/vsftpd/vsftpd.confanonymous_enable=YES local_enable=YES write_enable=YES local_umask=022 anon_upload_enable=YES anon_mkdir_write_enable=YES dirmessage_enable=YES xferlog_enable=YES connect_from_port_20=YES xferlog_std_format=YES listen=YES pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES
- 安装配置tftp、xinetd:
a. 安装:yum -y install tftp-server xinetd
b. 配置:vim /etc/xinetd.d/tftpservice 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 = IPv4 }
- 复制系统文件:
a. 复制安装程序所必须的 initrd.img 和 vmlinuz:cp /home/lee/isolinux/{initrd.img,vmlinuz} /var/lib/tftpboot/
b. 安装syslinux:yum -y install syslinux
c. 复制 pxelinux.0:cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
d. 创建 pxelinux.cfg 文件夹:mkdir -p /var/lib/tftpboot/pxelinux.cfg/
e. 复制defaul:cp /home/lee/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default - 配置default:vim /var/lib/tftpboot/pxelinux.cfg/default
default 1 prompt 1 timeout 60 display boot.msg menu background splash.jpg menu title Welcome to CentOS 7 menu color border 0 #ffffffff #00000000 menu color sel 7 #ffffffff #ff000000 menu color title 0 #ffffffff #00000000 menu color tabmsg 0 #ffffffff #00000000 menu color unsel 0 #ffffffff #00000000 menu color hotsel 0 #ff000000 #ffffffff menu color hotkey 7 #ffffffff #ff000000 menu color scrollbar 0 #ffffffff #00000000 label 1 kernel /vmlinuz append initrd=initrd.img ramdisk_size=9216 ks=ftp://192.168.8.81/pub/centos/ks.cfg
- 拷贝iso 文件
a. 创建 centos 目录:mkdir -p /var/ftp/pub/centos/
b. 拷贝系统文件到 centos 目录:cp -ar /home/lee/centos/. /var/ftp/pub/centos/ - 配置ks.cfg
a. 复制ks.cfg:cp /root/anaconda-ks.cfg /var/ftp/pub/centos/ks.cfg
b. 配置ks.cfg:vim /var/ftp/pub/centos/ks.cfg,加上:url --url=ftp://192.168.8.81/pub/centos/
- 启动服务:
a. 启动dhcp:
systemctl start dhcpd
b. 启动tftp:
systemctl start tftp
systemctl start xinetd
c. 启动vsftp:
systemctl start vsftpd - 配置客户端为网络启动:
- 注意事项:
a. 服务端必须关闭防火墙:
systemctl stop firewalld
b. 服务商必须关闭selinux:
vim /etc/sysconfig/selinuxSELINUX=disabled SELINUXTYPE=targeted 本文转自 Lee_吉 博客,原文链接: http://blog.51cto.com/12173069/2051454 如需转载请自行联系原作者