1.kickstart自动安装脚本
在企业中安装多台操作系统时面临的问题:当安装Linux操作系统时,安装过程会需要回答很多关于设定的问题,这些问题必须手动选择,否则无法进行安装,当只安装1台Linux系统,手动选择设定工作量比较轻松,当安装多台Linux,这些设定需要重复多次,这些重复动作是效率低下的操作。
如何解决:用文件来记录所有安装过程中问题的答案,并让所有需要安装的主机自动获取
kickstart作用:以上解决方案中记录安装过程中问题的答案编写成一个文件,叫作kickstart脚本。
2.实验环境
1.主机名称 :westosa
2.ip :172.25.254.103
3.火墙,selinux关闭
4.httpd服务开启
5.配置软件仓库能正常工作
3.kickstart自动安装脚本的制作
在已经安装好的rhel8中,/root/anaconda-ks.cfg 就是安装
当前系统时回答所有问题的答案生成的kickstart,此文件为kickstart模板
kickstart
openssl passwd -6 #生成密码加密字符
ls -l /root/anaconda-ks.cfg
chmod 644 /root/anaconda-ks.cfg #为脚本文件加上权限
编辑文件:vim /root/anaconda-ks.cfg
#version=RHEL8
#ignoredisk --only-use=sda
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Reboot after installation
reboot
# Use graphical install
graphical
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8 --addsupport=zh_CN.UTF-8
# Network information
network --bootproto=dhcp --onboot=on
repo --name="AppStream" --baseurl=http://172.25.254.3/rhel8.2/AppStream
# Use network installation
url --url="http://172.25.254.3/rhel8.2"
# Root password
rootpw --iscrypted $6$7qNm0L6U.em4W7Dm$T1KhvISzmV/mWJ8AsyElnweBt9sl2/PWekhC8XYagNYd3o/STmmvNVyFgE0bei9WBgjFG.lsd7YFo.k5Jen95. ##此字符串要改为为上面密码生成的加密字符
# X Window System configuration information
xconfig --startxonboot
firstboot --disable
# System services
#services --enabled="chronyd"
# System timezone
timezone Asia/Shanghai
#Disk partitioning information
part /boot --fstype="xfs" --size=512
part swap --fstype="swap" --size=4096
part / --fstype="xfs" --size=109864
%packages
@^graphical-server-environment
ibus-libpinyin.x86_64
kexec-tools
kexec-tools
tigervnc.x86_64
%end
将此文件复制到软件仓库挂载目录中,确保能在网页上访问该文件。
cp /root/anaconda-ks.cfg /var/www/html/westos.ks