CentOS6原始应答文件anaconda-ks.cfg内容

Posted 白-胖-子

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS6原始应答文件anaconda-ks.cfg内容相关的知识,希望对你有一定的参考价值。

CentOS6的应答文件

  • 记录了安装系统时的操作
  • 可以用此为基础创建自定义应答文件

kickstart文件主要包括三个部分:

命令段,程序包段,脚本段

命令段:

指明各种安装前配置,如键盘类型等

命令段中的常见命令:

  • keyboard: 设定键盘类型
  • lang: 语言类型
  • zerombr:清除mbr
  • clearpart:清除分区
  • part: 创建分区
  • rootpw: 指明root的密码
  • timezone: 时区
  • text: 文本安装界面
  • network:指定网络设置
  • firewall:设置防火墙设置
  • selinux:设置selinux设置
  • reboot:安装完自动重启
  • user:安装完成后为系统创建新用户
  • url: 指明安装源

程序包段:

指明要安装的程序包组或程序包,不安装的程序包等

%packages
@^environment group: 指定环境包组,如:@^minimal-environment
@group_name
 package
package
%end

脚本段:

%pre: 安装前脚本
%post: 安装后脚本

anaconda-ks.cfg原生内容

[root@C6-56 ~]# cat anaconda-ks.cfg
# Kickstart file automatically generated by anaconda.

#version=DEVEL
install
cdrom
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp
rootpw  --iscrypted $1$Ngd5nkD3$9aiytDQYX.Rajc29jnGJ11
# Reboot after installation
reboot
firewall --service=ssh
authconfig --useshadow --enablemd5
selinux --enforcing
timezone --utc America/Los_Angeles
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# Clear the Master Boot Record
#zerombr
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --all --initlabel

#part /boot --fstype=ext4 --size=300
#part / --fstype=ext4 --grow --size=3000
#part swap --grow --maxsize=1984 --size=1984



repo --name="CentOS"  --baseurl=cdrom:sr1 --cost=100

%packages
@Base
@Core
@Desktop
@Fonts
@General Purpose Desktop
@Internet Browser
@Printing client
@X Window System
binutils
gcc
kernel-devel
make
patch
python

%end

%post
if [ -f /boot/grub/menu.lst -a ! -h /boot/grub/menu.lst ]; then cp /boot/grub/menu.lst /boot/grub/menu.lst.bak && sed -i 's/ rhgb//' /boot/grub/menu.lst; fi
if [ -f /boot/grub/grub.conf -a ! -h /boot/grub/grub.conf ]; then cp /boot/grub/grub.conf /boot/grub/grub.conf.bak && sed -i 's/ rhgb//' /boot/grub/grub.conf; fi
if [ -f /boot/grub2/grub.conf -a ! -h /boot/grub2/grub.conf ]; then cp /boot/grub2/grub.conf /boot/grub2/grub.conf.bak && sed -i 's/ rhgb//' /boot/grub2/grub.conf; fi
if [ -f /etc/rc.d/rc.local ]; then cp /etc/rc.d/rc.local /etc/rc.d/rc.local.backup; fi
cat >>/etc/rc.d/rc.local <<EOF
#!/bin/bash
echo
echo "Installing VMware Tools, please wait..."
if [ -x /usr/sbin/getenforce ]; then oldenforce=\\$(/usr/sbin/getenforce); /usr/sbin/setenforce permissive || true; fi
mkdir -p /tmp/vmware-toolsmnt0
for i in hda sr0 scd0; do mount -t iso9660 /dev/\\$i /tmp/vmware-toolsmnt0 && break; done
cp -a /tmp/vmware-toolsmnt0 /opt/vmware-tools-installer
chmod 755 /opt/vmware-tools-installer
cd /opt/vmware-tools-installer
mv upgra32 vmware-tools-upgrader-32
mv upgra64 vmware-tools-upgrader-64
mv upgrade.sh run_upgrader.sh
chmod +x /opt/vmware-tools-installer/*upgr*
umount /tmp/vmware-toolsmnt0
rmdir /tmp/vmware-toolsmnt0
if [ -x /usr/bin/rhgb-client ]; then /usr/bin/rhgb-client --quit; fi
cd /opt/vmware-tools-installer
for s in sr0 sr1; do eject -s /dev/\\$s; done
./run_upgrader.sh
if [ -f /etc/rc.d/rc.local.backup ]; then mv /etc/rc.d/rc.local.backup /etc/rc.d/rc.local; else rm -f /etc/rc.d/rc.local; fi
rm -rf /opt/vmware-tools-installer
sed -i 's/3:initdefault/5:initdefault/' /etc/inittab
if [ -f /boot/grub/menu.lst.bak ]; then mv /boot/grub/menu.lst.bak /boot/grub/menu.lst; fi
if [ -f /boot/grub/grub.conf.bak ]; then mv /boot/grub/grub.conf.bak /boot/grub/grub.conf; fi
if [ -f /boot/grub2/grub.conf.bak ]; then mv /boot/grub2/grub.conf.bak /boot/grub2/grub.conf; fi
if [ -x /usr/sbin/getenforce ]; then /usr/sbin/setenforce \\$oldenforce || true; fi
if [ -x /bin/systemd ]; then systemctl restart prefdm.service; else telinit 5; fi
EOF
chmod 755 /etc/rc.d/rc.local
if [ -x /bin/systemd ]; then systemctl enable rc-local.service; fi
/usr/sbin/adduser sun
/usr/sbin/usermod -p '$1$Ngd5nkD3$9aiytDQYX.Rajc29jnGJ11' sun
/usr/bin/chfn -f "C6" sun
/bin/echo done
%end

以上是关于CentOS6原始应答文件anaconda-ks.cfg内容的主要内容,如果未能解决你的问题,请参考以下文章

CentOS8原始应答文件anaconda-ks.cfg内容

CentOS7原始应答文件anaconda-ks.cfg内容

CentOS8手动编辑定制生成应答文件anaconda-ks.cfg

kickstart自动安装的应答文件anaconda-ks.cfg

CentOS7使用图形工具定制生成应答文件anaconda-ks.cfg

运维自动化之系统安装-应答文件制作并结合ftp和http完成半自动安装