一、配置DHCP服务器
安装软件包
[root@LiuZhen ~]# rpm -qa dhcp
[root@LiuZhen ~]# yum install dhcp
[root@LiuZhen ~]# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
option domain-name "LiuZhen.com"; //hostname
option domain-name-servers 192.168.220.222; //server IP
default-lease-time 600; //租用时间
max-lease-time 7200;
log-facility local7;
allow booting; //pexlinux 使用
allow bootp; //pexlinux 使用
subnet 192.168.220.0 netmask 255.255.255.0 {
range 192.168.220.100 192.168.220.200; //动态获得IP范围
option routers 192.168.221.1; //网关
next-server 192.168.220.222; //pexlinux 使用
filename "pxelinux.0"; //pexlinux 使用
}
重启DHCP服务
[root@LiuZhen ~]# service dhcpd restart
Redirecting to /bin/systemctl restart dhcpd.service
设置开机自动启动DHCP服务
[root@LiuZhen ~]# chkconfig dhcpd on
Note: Forwarding request to 'systemctl enable dhcpd.service'.
ln -s '/usr/lib/systemd/system/dhcpd.service' '/etc/systemd/system/multi-user.target.wants/dhcpd.service'
设置防火墙停止限制DHCP服务
[root@LiuZhen ~]# firewall-cmd --permanent --add-service=dhcp
success
重新启动防火墙
[root@LiuZhen ~]# service firewalld restart
Redirecting to /bin/systemctl restart firewalld.service
二、配置TFTP服务
检查tftp包是否存在
[root@LiuZhen ~]# rpm -qa tftp
yum安装tftp
[root@LiuZhen ~]# yum install tftp
安装超级守护进程
[root@LiuZhen xinetd.d]# rpm -qa xinetd
[root@LiuZhen xinetd.d]#
[root@LiuZhen xinetd.d]# yum install xinetd
[root@LiuZhen xinetd.d]# rpm -qa tftp-server
[root@LiuZhen xinetd.d]# yum install tftp-server
[root@LiuZhen xinetd.d]#
查看配置文件
[root@LiuZhen xinetd.d]# cat /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 /var/lib/tftpboot
disable = yes
per_source = 11
cps = 100 2
flags = IPv4
}
修改yes 为no
[root@LiuZhen xinetd.d]# service xinetd restart
Redirecting to /bin/systemctl restart xinetd.service
设置防火墙
三、配置syslinux
检查包是否安装
安装包
拷贝以下文件到目录下
修改配置文件
/var/lib/tftpboot/pxelinux.cfg/default
将所有 =hd:LABEL=RHEL-7.0 都改成=ftp://192.168.220.222
可使用命令替换
sed -i "/inst.stage2/s/=hd:LABEL=RHEL-7.0\\\x20Server.x86_64/=ftp:\/\/192.168.220.222/" /var/lib/tftpboot/pxelinux.cfg/default
四、配置VSFTP服务
安装软件包
配置服务和防火墙
将操作系统介质拷贝到FTP目录下
[root@LiuZhen tftpboot]# cp -r /mnt/* /var/ftp
配置完成,可以测试是否可以进入安装
新建空虚拟机,使用hostonly网段,启动测试
测试可以出现引导安装界面,继续配置kickstart,实现无人值守安装
五、配置KICKSTART
拷贝系统默认配置文件,并给与权限
安装软件包
[root@LiuZhen vsftpd]# rpm -q system-config-kickstart
package system-config-kickstart is not installed
[root@LiuZhen vsftpd]#
[root@LiuZhen vsftpd]# yum -y install system-config-kickstart
修改配置文件/var/ftp/pub/ks.cfg
none改成all
修改配置文件/var/lib/tftpboot/pxelinux.cfg/default
将quiet改为
配置完成,测试效果,启动两个虚拟机一起自动安装测试
安装过程有点慢,配置完成