//检查dhcp是否正常
[root@linuxidc ~]# netstat -anulp | grep dhcp
udp 0 0 0.0.0.0:67 0.0.0.0:*
//导入CentOS7镜像
[root@linuxidc ~]# mount /dev/cdrom /mnt/
[root@linuxidc ~]# cobbler import --path=/mnt --name=Centos-7 --arch=x86_64
//查看cobbler镜像列表
[root@linuxidc ~]# cobbler list
//创建kickstarts自动安装脚本
[root@linuxidc ~]# cat > /var/lib/cobbler/kickstarts/Centos-7-x86_64.ks <<'EOF'
auth --enableshadow --passalgo=sha512
bootloader --location=mbr
clearpart --all --initlabel
part /boot --asprimary --fstype="ext4" --size=500
part swap --fstype="swap" --size=4096
part / --fstype="ext4" --grow --size=15000
text
firewall --disabled
firstboot --disable
keyboard us
lang en_US
url --url=http://192.168.209.12/cobbler/ks_mirror/Centos-7- x86_64
$yum_repo_stanza
$SNIPPET('network_config')
reboot
rootpw --iscrypted $6$DEHzuoHRCJMBjzzK$DKallGno50cVbJ27yEIP5O1M4p3/rwfilgIdpKW9IU25Q4KI8tXmSPwH1JuB2UW/pk3NlayujtEZ9ckfclRM81
selinux --disabled
skipx
timezone Asia/Shanghai --isUtc --nontp
install
zerombr
%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
EOF
//检查ks文件语法是否错误
[root@linuxidc ~]# cobbler validateks
//查看当前cobbler有哪些配置文件
[root@linuxidc ~]# cobbler profile list
Centos-7-x86_64
//修改profile将我们新建的ks文件设为默认的kickstarts安装文件
[root@linuxidc ~]# cobbler profile edit --name Centos-7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/Centos-7-x86_64.ks
//配合网卡名称为传统网卡名称eth0
[root@linuxidc ~]# cobbler profile edit --name Centos-7-x86_64 --kopts='net.ifnames=0 biosdevname=0'
//检查当前系统cobbler配置文件信息
[root@linuxidc ~]# cobbler profile report
//同步cobbler
[root@linuxidc ~]# cobbler sync
//把服务器端所有重启
[root@linuxidc ~]# systemctl restart xinetd//超级守护进程
[root@linuxidc ~]# systemctl restart cobblerd
[root@linuxidc ~]# systemctl restart httpd
[root@linuxidc ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 5 127.0.0.1:25151 *:*
LISTEN 0 5 *:873 *:*
LISTEN 0 128 :::80 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 128 :::443 :::*
LISTEN 0 5 :::873 :::*