systemctl stop firewalld
setenforce 0
yum install dhcp-server -y
vi /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 192.168.80.0 netmask 255.255.255.0 {
option routers 192.168.80.188;
option subnet-mask 255.255.255.0;
option time-offset -18000;
range dynamic-bootp 192.168.80.60 192.168.80.100;
next-server 192.168.80.188;
filename "pxelinux.0";
}
systemctl start dhcpd
systemctl enable dhcpd
yum install -y vsftpd
mount /dev/cdrom /var/ftp/pub
vi /etc/vsftpd/vsftpd.conf
anonymous_enable=yes
systemctl start vsftpd
systemctl enable vsftpd
yum install -y tftp-server tftp syslinux-tftpboot
yum -y install xinetd
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 = IPv4
}
systemctl start tftp
systemctl status tftp
yum -y install syslinux
cp -rf /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
cp /var/ftp/pub/isolinux/{boot.cat,boot.msg,grub.conf,isolinux.bin,splash.png,TRANS.TBL,vesamenu.c32,ldlinux.c32} /var/lib/tftpboot
cp /var/ftp/pub/images/pxeboot/initrd.img /var/lib/tftpboot/
cp /var/ftp/pub/images/pxeboot/vmlinuz /var/lib/tftpboot/
mkdir /var/lib/tftpboot/pxelinux.cfg
cp /var/ftp/pub/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
vi /var/lib/tftpboot/pxelinux.cfg/default
default linux //修改
prompt 1
timeout 1
display boot.msg
……
……
label linux
kernel vmlinuz
append initrd=initrd.img text ks=ftp://192.168.80.188/ks.cfg //后面去掉
……
……
## ---以下是生成应答文件的方式---
cp ~/anaconda-ks.cfg /var/ftp/ks.cfg
vi /var/ftp/ks.cfg
Use CDROM installation media
install
url --url="ftp://192.168.80.188/pub"
repo --name="AppStream" --baseurl=ftp://192.168.80.188/pub/AppStream
ks.cfg权限更改为777
---注意:需要把IP主机名相关参数修改成自动获得不能和服务器冲突-硬盘空间不能比配置文件中定义的小--
## ---使用图形界面手动生成应答文件---服务器要安装图形界面---
yum groupinstall "带 GUI 的服务器"
init 5
yum -y install system-config-kickstart
应用程序-系统工具-kickstart
chmod +r /var/ftp/ks.cfg
systemctl status dhcpd
systemctl status vsftpd
systemctl status tftp
## ---以下是参考应答文件---
#platform=x86, AMD64, 或 Intel EM64T
##version=RHEL8:
Install OS instead of upgrade
install
Keyboard layouts
keyboard 'us'
Root password
rootpw --iscrypted $1$SrhrYNt7$by7EVIhjeAielouE4Vm8s/
Use network installation
url --url="ftp://192.168.80.110/pub"
System language
lang zh_CN
Firewall configuration
firewall --disabled
System authorization information
auth --useshadow --passalgo=sha512
Use graphical install
graphical
SELinux configuration
selinux --disabled
Do not configure the X Window System
skipx
Reboot after installation
reboot
System timezone
timezone Asia/Shanghai
System bootloader configuration
bootloader --location=mbr
Clear the Master Boot Record
zerombr
Partition clearing information
clearpart --all --initlabel
Disk partitioning information
part / --fstype="xfs" --size=10000
part swap --fstype="swap" --size=5120
part /boot --fstype="xfs" --size=5120
part /opt --fstype="xfs" --grow --size=1
%packages
@^minimal-environment
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end