Linux中无人职守安装脚本kickstart
##kickstart作用:
用文件来记录所有安装过程中问题的答案,并让所有需要安装的主机自动读取
##步骤:
- dnf install httpd
- systemctl enable --now httpd
systemctl disable --now firewalld - setenforce 0
- mkdir /var/www/html/lcf
- cp /root/anaconda-ks.cfg /var/www/html/lcf
- mount /isos/rhel-8.2-x86_64-dvd.iso /var/www/html/lcf/westos.cfg
- vim /var/www/html/lcf/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
text
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8 --addsupport=zh_CN.UTF-8
# Network information
network --onboot=on --bootproto=dhcp
repo --name="AppStream" --baseurl=http://172.25.254.250/rhel8.2/AppStream
# Use network installation
url --url="http://172.25.254.250/rhel8.2"
# Root password
rootpw --iscrypted $6$JdeJQBGpQu8K4AAR$LkkcxoIN.bhKg.qS/p1x19EFwsMkqpGPHBIrJQd6DQu6NkHMrGbN2PZsIHhyou3.3G9sDFvuCT3glYkfKZSjN/
# X Window System configuration information
#xconfig --startxonboot
firstboot --disable
# System services
#services --enabled="chronyd"
# System timezone
timezone Asia/Shanghai
# Disk partitioning information
part swap --fstype="swap" --size=500
part /boot --fstype="xfs" --size=500
part / --fstype="xfs" --size=1 --grow
%post
touch /mnt/westos
%end
%packages
@base
%end
- chmod 644 westos.cfg
- vim /root/Desktop/lcf1.sh
- sh /root/Desktop/lcf1.sh lcf