ks.cfg
- #version=DEVEL
- install #表示是安装系统
- # System authorization information
- auth --enableshadow --passalgo=sha512 #启用加密
- text #文本安装
- #graphical #图形化安装,注释掉
- # Use graphical install
- url --url=http://192.168.1.1/CentOS-7.5/ #用于读取系统的url
- # Firewall configuration
- firewall --disabled #关闭防火墙
- # SELinux configuration
- selinux --disabled #关闭selinux
- # Run the Setup Agent on first boot
- firstboot --disable #关闭第一次启动后的安装配置
- ignoredisk --only-use=sda #默认第一块启动盘
- # Keyboard layouts
- keyboard --vckeymap=us --xlayouts='us' #键盘
- # System language
- lang en_US.UTF-8 #语言和编码
- # Network information
- network --bootproto=dhcp --device=ens33 --onboot=off --ipv6=auto --no-activate #安装时配置网卡地址
- network --hostname=localhost.localdomain #安装时配置主机名
- # System timezone
- timezone Asia/Shanghai #时区
- # System bootloader configuration
- bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda #指定引导装载程序怎样被安装
- # Root password
- rootpw --iscrypted $1$vIP9ZiKA$ryz7cg0/2NwoOYVnHhHCF1 #root密码
- # System services
- #services --enabled="chronyd"
- # Do not configure the X Window System
- skipx #不使用图形界面
- # Accept license
- eula --agreed #同意最终用户许可协议
- # Reboot after installation
- reboot #安装后重启
- # Disk partitioning information
- %include /tmp/partition.ks
-
- %pre #系统安装前所执行的脚本
- #!/bin/sh
- # 创建分区,如果分区比较简单,可以放在上面,分区比较多的,可以像这样写脚本放在%pre块内
- act_mem=$(cat /proc/meminfo | grep MemTotal | awk '{printf("%d",$2/1024)}')
- echo "" > /tmp/partition.ks
- echo "clearpart --all --initlabel" >> /tmp/partition.ks
- echo 'part pv.767 --fstype="lvmpv" --ondisk=sda --size=1 --grow' >> /tmp/partition.ks..ec01]oho 'part biosboot --fstype="biosboot" --ondisk=sda --size=2' >> /tmp/partition.ks
- echo 'part /boot --fstype="ext4" --ondisk=sda --size=512' >> /tmp/partition.ks
- echo 'volgroup rhel --pesize=4096 pv.767' >> /tmp/partition.ks
- echo 'logvol /data --fstype="ext4" --size=1 --grow --name=data --vgname=rhel' >> /tmp/partition.ks
- echo 'logvol / --fstype="ext4" --size=102400 --name=root --vgname=rhel' >> /tmp/partition.ks
- if [ ${act_mem} -ge 65536 ]
- then
- echo "logvol swap --fstype=swap --name=swap --vgname=rhel --size=65536" >> /tmp/partition.ks
- elif [ ${act_mem} -le 8192 ]
- then
- echo "logvol swap --fstype=swap --name=swap --vgname=rhel --size=${act_mem}" >> /tmp/partition.ks
- else
- echo "logvol swap --fstype=swap --name=swap --vgname=rhel --size=$(expr ${act_mem} / 2)" >> /tmp/partition.ks
- fi
- %end
-
- %post #系统安装后所执行的脚本
-
- #Sshd config
- sed -i 's/#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
- ......
- wget -O /tmp/ip.txt http://192.168.1.1/ks_cfg/ip.txt
- wget -O /tmp/ip.sh http://192.168.1.1/ks_cfg/ip.sh
- /bin/sh /tmp/ip.sh
- wget -O /tmp/zabbix_agent.sh http://http://192.168.1.1/ks_cfg/zabbix_agent.sh
- /bin/sh /tmp/zabbix_agent.sh
- ......
- %end
-
- %packages #安装包,%packages块指定以下都是需要进行安装的包。
- @base #最小化安装需要@base和@core。@后写的是包组
- @console-internet
- @core
- autoconf #没有任何前缀的表示需要安装的包
- chrony
- expect
- gcc
- gcc-c++
- ......
- %end #最后需要用%end结尾
-
- %addon com_redhat_kdump --enable --reserve-mb='auto'
-
- %end
(编辑:晋中站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|