文章目录
Linux云计算虚拟化-使用system-config-kickstart创建ks文件【centos7】
1. 部署system-config-kickstart服务
# 使用光盘镜像配置本地yum源,以下配置成http源。
[root@server ~]# cat /etc/yum.repos.d/local.repo
[development] # 这里必须是development,否则在后面软件包识别时会无法识别。
name=local
baseurl=http://192.168.80.141/centos7
enable=1
gpgcheck=0
[root@server ~]# df -h | grep /dev/sr0
/dev/sr0 973M 973M 0 100% /var/www/html/centos7
# 安装system-config-kickstart
[root@server ~]# yum install -y system-config-kickstart
[root@server ~]# system-config-kickstart # 打开kickstart图形化界面
2. system-config-kickstart的使用
①基本配置:
②安装方法:
③引导装载程序选项:
④分区信息:
⑤网络配置:
⑥验证:
⑦防火墙配置:
⑧显示配置:
⑨软件包选择:
⑩预安装脚本和安装后脚本:
可以预览下ks.cfg配置文件:
最后将配置保存在桌面:
centos7最小化安装的ks.cfg文件:
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted $1$9nVZnGYe$AOs85tUpGA86jaJrCpZDJ/
# Use network installation
url --url="http://192.168.80.141/centos7/"
# System language
lang zh_CN
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# SELinux configuration
selinux --disabled
# Firewall configuration
firewall --disabled
# Network information
network --bootproto=dhcp --device=eth0
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# System bootloader configuration
bootloader --location=none
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="xfs" --ondisk=vda --size=1024
part / --fstype="xfs" --ondisk=vda --size=10240
part swap --fstype="swap" --size=512
%packages
@core
-NetworkManager
-NetworkManager-team
-NetworkManager-tui
-NetworkManager-wifi
-aic94xx-firmware
-alsa-firmware
-dracut-config-rescue
-ivtv-firmware
-iwl100-firmware
-iwl1000-firmware
-iwl105-firmware
-iwl135-firmware
-iwl2000-firmware
-iwl2030-firmware
-iwl3160-firmware
-iwl3945-firmware
-iwl4965-firmware
-iwl5000-firmware
-iwl5150-firmware
-iwl6000-firmware
-iwl6000g2a-firmware
-iwl6000g2b-firmware
-iwl6050-firmware
-iwl7260-firmware
-kernel-tools
-libsysfs
-linux-firmware
-microcode_ctl
-postfix
%end
有了该文件,就可以拿去自动化部署centos7系统了。
下图是自动安装kvm虚拟机后的结果: