CentOS6、7、8kickstart应答文件

本文最后更新于:2023年12月5日 晚上

当不知道应答文件怎么写的时候,可以先手动安装一遍,然后参考其 anaconda-ks.cfg 文件

以下所有的用户密码都是 ljkk

CentOS 6

install
text
reboot
url --url=http://10.0.0.8/centos/6/os/x86_64/
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$CTxlVPMx.O7NW6To$Ahp5HPWLJgKZguGM0/48EBGmfo/6wLwiUIHkpHdM9g4TOt6onfiy1Xk1FlMMpJIsp4guQfp5OLLOdLs5rSGmX1
authconfig --enableshadow --passalgo=sha512
firewall --disabled
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
zerombr
clearpart --all --initlabel
part /boot --fstype="ext4" --ondisk=sda --size=1024
part pv.01 --size 1 --grow
volgroup volgrp pv.01
logvol swap --vgname=volgrp --name=swap --fstype="swap" --size=2048
logvol /data --vgname=volgrp --name=data --fstype="ext4" --size=51200
logvol / --vgname=volgrp --name=root --fstype="ext4" --size=1 --grow
%packages
@core
@server-policy
@workstation-policy
autofs
vim-enhanced
%end
%post
useradd lujinkai
echo 123456 | passwd --stdin lujinkai &> /dev/null
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/* /etc/yum.repos.d/bak
cat > /etc/yum.repos.d/base.repo <<EOF
[base]
name=base
baseurl=file:///misc/cd
gpgcheck=0
EOF
%end

CentOS 7

install
xconfig --startxonboot
keyboard --vckeymap=us --xlayouts='us'
rootpw --iscrypted $1$YyodG.X7$LzhHqxWONgSh0NBoC730o0
url --url="http://10.0.0.8/centos/7/os/x86_64"
lang en_US
auth --useshadow --passalgo=sha512
text
firstboot --enable
selinux --disabled
skipx
services --disabled="chronyd"
ignoredisk --only-use=sda
firewall --disabled
network --bootproto=dhcp --device=eth0
network --hostname=centos7.magedu.org
reboot
timezone Asia/Shanghai --nontp
bootloader --append="net.ifnames=0" --location=mbr --boot-drive=sda
zerombr
clearpart --all --initlabel
part /boot --fstype="ext4" --ondisk=sda --size=1024
part pv.01 --size 1 --grow
volgroup volgrp pv.01
logvol swap --vgname=volgrp --name=swap --fstype="swap" --size=2048
logvol /data --vgname=volgrp --name=data --fstype="ext4" --size=51200
logvol / --vgname=volgrp --name=root --fstype="ext4" --size=1 --grow
%post
useradd lujinkai
%end
%packages
@core
%end

CentOS 8

ignoredisk --only-use=sda
zerombr
text
reboot
clearpart --all --initlabel
selinux --disabled
firewall --disabled
url --url=http://10.0.0.8/centos/8/os/x86_64/
keyboard --vckeymap=us --xlayouts='us'
lang en_US.UTF-8
network --bootproto=dhcp --device=eth0 --ipv6=auto --activate
bootloader --append="net.ifnames=0" --location=mbr --boot-drive=sda
network --hostname=centos8.magedu.org
rootpw --iscrypted $6$CTxlVPMx.O7NW6To$Ahp5HPWLJgKZguGM0/48EBGmfo/6wLwiUIHkpHdM9g4TOt6onfiy1Xk1FlMMpJIsp4guQfp5OLLOdLs5rSGmX1
firstboot --enable
skipx
services --disabled="chronyd"
timezone Asia/Shanghai --isUtc --nontp
user --name=lujinkai --password=$6$CTxlVPMx.O7NW6To$Ahp5HPWLJgKZguGM0/48EBGmfo/6wLwiUIHkpHdM9g4TOt6onfiy1Xk1FlMMpJIsp4guQfp5OLLOdLs5rSGmX1 --iscrypted --gecos="lujinkai"
part /boot --fstype="ext4" --ondisk=sda --size=1024
part pv.01 --size 1 --grow
volgroup volgrp pv.01
logvol swap --vgname=volgrp --name=swap --fstype="swap" --size=2048
logvol /data --vgname=volgrp --name=data --fstype="ext4" --size=51200
logvol / --vgname=volgrp --name=root --fstype="ext4" --size=1 --grow
%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

kvm 自动应答文件(centos7)

系统安装完后,在家目录会有两个 cfg 文件,original-ks.cfg 是自己编辑的自动应答文件,anaconda-ks.cfg 是系统根据 original-ks.cfg 自动生成的应答文件

  • original-ks.cfg
install
xconfig --startxonboot
keyboard --vckeymap=us --xlayouts='us'
lang en_US.UTF-8
rootpw --iscrypted $1$YyodG.X7$LzhHqxWONgSh0NBoC730o0
url --url="http://10.0.0.1/centos/7/os/x86_64"
auth --useshadow --passalgo=sha512
text
firstboot --enable
selinux --disabled
skipx
services --disabled="chronyd"
ignoredisk --only-use=vda
firewall --disabled
network --bootproto=dhcp --device=eth0
network --hostname=c7
reboot
timezone Asia/Shanghai --nontp
bootloader --append="net.ifnames=0" --location=mbr --boot-drive=vda
zerombr
clearpart --all --initlabel
part /boot --fstype="ext4" --ondisk=vda --size=300
part pv.01 --size 1 --grow
volgroup volgrp pv.01
logvol swap --vgname=volgrp --name=swap --fstype="swap" --size=2048
logvol / --vgname=volgrp --name=root --fstype="ext4" --size=1 --grow
%post
useradd lujinkai
%end
%packages
@^minimal
@core
%end
  • anaconda-ks.cfg
#version=DEVEL
# System authorization information
auth --useshadow --passalgo=sha512
# Install OS instead of upgrade
install
# Use text mode install
text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=vda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

# Network information
network  --bootproto=dhcp --device=eth0 --activate
network  --bootproto=dhcp --hostname=c7
# Reboot after installation
reboot
# Use network installation
url --url="http://10.0.0.1/centos/7/os/x86_64"
# Root password
rootpw --iscrypted $1$YyodG.X7$LzhHqxWONgSh0NBoC730o0
# SELinux configuration
selinux --disabled
# System services
services --disabled="chronyd"
# Do not configure the X Window System
skipx
# System timezone
timezone Asia/Shanghai --nontp
# X Window System configuration information
xconfig  --startxonboot
# System bootloader configuration
bootloader --append="net.ifnames=0 crashkernel=auto" --location=mbr --boot-drive=vda
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --ondisk=vda --size=300
part pv.60 --fstype="lvmpv" --size=20179
volgroup volgrp --pesize=4096 pv.60
logvol /  --fstype="ext4" --grow --size=1 --name=root --vgname=volgrp
logvol swap  --fstype="swap" --size=2048 --name=swap --vgname=volgrp

%post
useradd lujinkai
%end

%packages
@^minimal
@core
kexec-tools

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

kvm 安装在逻辑卷

#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=vda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

# Network information
network  --bootproto=dhcp --device=eth0 --ipv6=auto --activate
network  --hostname=localhost.localdomain

# Root password
rootpw --iscrypted $6$FyziLpCibU/RQPqp$G56mBV90w0lM1xVCK6Bwsg4ANZd/Gj8hKsENU3mfQAPoqBevdCyw.Dw88OkOHBUxpIoq7Zi.NQ6890l5Otzev.
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
user --name=lujinkai --password=$6$oKgYyszaGm2rHnk/$cDyAFysw5bhQTT18sGCREat6ZkIfo9/BlluiPlWmAfTk/48x9KukRepXoRelKqiA9tjRYFcWEmHivHjl2TOrR0 --iscrypted --gecos="lujinkai"
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=vda
# Partition clearing information
clearpart --none --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --ondisk=vda --size=300
part pv.428 --fstype="lvmpv" --ondisk=vda --size=4819
volgroup centos --pesize=4096 pv.428
logvol /  --fstype="ext4" --size=4816 --name=root --vgname=centos

%packages
@^minimal
@core
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

CentOS6、7、8kickstart应答文件
http://blog.lujinkai.cn/运维/运维自动化/系统部署/CentOS6、7、8kickstart应答文件/
作者
像方便面一样的男子
发布于
2020年12月9日
更新于
2023年12月5日
许可协议