RHEL 8.2 批量部署 RHEL 8.2系统
[root@rhel8-study ~]# mkdir -p /data/mirrors
[root@rhel8-study ~]# cd /data/mirrors/
[root@rhel8-study mirrors]# wget http://git.ponfey.com:8001/Mirrors/RedHat/rhel-8.2-x86_64-dvd.iso
[root@rhel8-study mirrors]# dnf install -y httpd
[root@rhel8-study mirrors]# systemctl start httpd

挂载镜像

[root@rhel8-study mirrors]# mkdir -p /var/www/html/RHEL8
[root@rhel8-study mirrors]# mount -o loop -t iso9660 rhel-8.2-x86_64-dvd.iso /var/www/html/RHEL8
[root@rhel8-study mirrors]# dnf install dhcp-server tftp-server  syslinux -y

配置DHCP服务器

[root@rhel8-study mirrors]# vim /etc/dhcp/dhcpd.conf 
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp-server/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#
subnet 203.0.113.0 netmask 255.255.255.0 {
        option routers          203.0.113.11;
        range                   203.0.113.201    203.0.113.210;
        next-server             203.0.113.11;
        filename                "pxelinux.0";
}
[root@rhel8-study mirrors]# cp  /var/www/html/RHEL8/isolinux/{vmlinuz,ldlinux.c32,initrd.img}       /var/lib/tftpboot/  
[root@rhel8-study mirrors]# mkdir /var/lib/tftpboot/pxelinux.cfg

[root@rhel8-study mirrors]# vim /var/lib/tftpboot/pxelinux.cfg/default #生成default文件
default linux
timeout 3
label linux
  kernel vmlinuz
  append initrd=initrd.img ip=dhcp method=http://203.0.113.11/RHEL8/ ks=http://203.0.113.11/Config/ks.cfg

生成ks.cfg文件

[root@rhel8-study Config]# vim  /var/www/html/Config/ks.cfg
#version=RHEL8
clearpart --all --initlabel  #清空分区
part /boot --fstype xfs --size 2048   #/boot分区
part swap --size 32768                    #swap分区
part biosboot --size 2
part / --fstype xfs --size 1 --grow   #/分区
firstboot --disable       #负责协助配置redhat一些重要的信息
selinux --disabled        #关闭selinux
firewall --disabled       #关闭防火墙
logging --level=info      #设置日志级别
# Partition clearing information
clearpart --all         #删除所有分区
# Use graphical install
graphical
url     --url="http://203.0.113.11/RHEL8/"          #指定安装URL
# Keyboard layouts
keyboard --vckeymap=cn --xlayouts='cn'
# System language
lang zh_CN.UTF-8
# Network information
network --device ens160 --bootproto static --ip 203.0.113.253 --netmask 255.255.255.0 --gateway 203.0.113.254 --nameserver 223.5.5.5 --hostname localhost  # network  --bootproto=dhcp --device=ens160 --ipv6=auto --activate
network  --hostname=localhost.localdomain
# Root password “`111111”           #root用户的密码"`111111"
rootpw --iscrypted $1$password$YrhYH5gKPR1l/5B62e.gb/
# X Window System configuration information
xconfig  --startxonboot
# Run the Setup Agent on first boot
#firstboot disable      #初次启动设置
firstboot --disable
# System services
services --enabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc
#Reboot after installation  #安装完成后自动重启
reboot
# License agreement     #同意授权协议
eula --agreed
#Add a new user named tyschool password “`111111” group whell           #普通用户名字为xiaoshuai.zhu 密码"`111111"
user --groups=wheel --name=xiaoshuai.zhu --password=$1$password$YrhYH5gKPR1l/5B62e.gb/ --iscrypted --gecos="xiaoshuai.zhu"
%packages
@^graphical-server-environment
%end

%addon com_redhat_kdump --disable --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
上一篇
下一篇