5. Cobbler 配置文件
最后更新于:2022-04-02 07:42:46
#### Cobbler(配置文件)
### 天坑啊,这我都能踩,也没谁了。
在%packages模块,考虑到有可能装图形界面(Oracle)做了一个注释
```
%packages
...
#@gnome-desktop
```
然后就会在安装过程卡住,在#后面增加与一个空格就好了
```
# @gnome-desktop
```
%per %post作用域都会有问题
#### Centos 7.3 x86_64 下的配置文件模板
Centos-7.3-x86_64.cfg
```shell
#Kickstart Configurator by BrandynX
#platform=x86, AMD64, or Intel EM64T
#System language
lang en_US
#System keyboard
keyboard us
#Install OS instead of upgrade
install
#Use text mode install
text
#Sytem timezone
timezone Asia/Shanghai
#Use NFS installation Media
url --url=$tree
#Root password
rootpw --iscrypted $default_password_crypted
#Network information
$SNIPPET('network_config')
#network --bootproto=dhcp --device=eth0 --onboot=on
#System authorization infomation
auth --useshadow --enablemd5
#Firewall configuration
firewall --disabled
#SELinux configuration
selinux --disabled
# Reboot after installation
reboot
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part /boot --fstype xfs --size 1024 --ondisk sda
#Oracle:part swap --size 16384 --ondisk sda
part swap --size 2048 --ondisk sda
part / --fstype xfs --size 1 --grow --ondisk sda
#Do not configure XWindows
skipx
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end
#Package install information
%packages
@base
@core
@fonts
@performance tools
%end
%post
$yum_config_stanza
wget -O /tmp/c7_op_script.tar.gz http://192.168.0.238/c7_op_script.tar.gz
cd /tmp && tar xzf c7_op_script.tar.gz
chmod +x -R /tmp/c7_op_script/*
cd /tmp/c7_op_script/sys_optimiz && /bin/sh -x centos7_optimiz.sh
%end
```
#### Centos 6.8 x86_64 下的配置文件模板
Centos-6.8-x86_64.cfg
```shell
#Kickstart Configurator by BrandynX
#platform=x86, AMD64, or Intel EM64T
# System language
lang en_US
# System keyboard
keyboard us
# Install OS instead of upgrade
install
# Use graphical install
text
firstboot --disable
# System timezone
timezone Asia/Shanghai
# Use network installation
url --url=$tree
#url --url="http://192.168.0.238/cobbler/ks_mirror/Centos-6.8-x86_64/"
# Root password 123qwe!@#
rootpw --iscrypted $default_password_crypted
#rootpw --iscrypted $1$DLTd6xbX$UOYR/gXuVkD2rxWtI4y/l/
# Network information
$SNIPPET('network_config')
#network --bootproto=dhcp --device=eth0 --onboot=on
# System authorization information
auth --useshadow --passalgo=sha512
# Firewall configuration
firewall --disabled
# SELinux configuration
selinux --disabled
# Reboot after installation
reboot
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype ext4 --size 1024 --ondisk sda
#part swap --size 16384 --ondisk sda
part swap --size 2048 --ondisk sda
part / --fstype ext4 --size 1 --grow --ondisk sda
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end
%packages
@base
@core
@fonts
@chinese-support
@performance tools
%post
$yum_config_stanza
mkdir -p /app/scripts
mkdir -p /data/
wget -O /app/scripts/centos6_optimiz.sh http://192.168.0.232/centos6_optimiz.sh
chmod +x /app/scripts/centos6_optimiz.sh && /bin/sh /app/scripts/centos6_optimiz.sh
%end
```
';