Cobbler自动部署CentOS系统:
说明:Cobbler相当于kickstart的2次封装,主要解决kickstart不能多系统部署的问题
建议在Ubuntu 14.04系统上搭建,Ubuntu 16.04上会有apache2的python和mod_wsgi模块版本冲突
安装apache2、tftpd-hpa、kickstart略
apt-get install cobbler
netstat -ntplu (查看服务端口,包括tcp和udp)
curl -I http://127.0.0.1/cobbler (验证网页是否能打开)
cobbler check
apt-get install debmirror
cp -rv /usr/share/doc/debmirror/examples/debmirror.conf /etc/
vi /etc/debmirror.conf (注释掉下面2行)
#@dists="precise";
#@arches="i386"; :wq
service cobbler restart
cobbler sync
echo "xxxx" | openssl passwd -1 -stdin (此次xxxx为客户端的root初始密码)
vi /etc/cobbler/settings (将上补生成的乱码贴进去)
default_password_crypted: "$1$cobbler$nBCRhq3fBRuMs35Rp4EUX/" :wq
cobbler sync
导入iso镜像
mount -t iso9660 -r -o ro,loop CentOS-6.5-x86_64-bin-DVD1.iso /root/iso/
cobbler import --name=CentOS65 --arch=x86_64 --path=/root/iso
cobbler list
cobbler distro list
cobbler profile list
cobbler profile report --name=CentOS65-x86_64 #查看profile设置
cobbler distro report --name=CentOS65-x86_64 #查看安装镜像文件信息
cobbler profile remove --name=CentOS65-x86_64 #移除profile
cobbler profile add --name=CentOS65-x86_64 --distro=CentOS65-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS65-x86_64.ks #添加
cobbler profile edit --name=CentOS65-x86_64 --distro=CentOS65-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS65-x86_64.ks #编辑
将kickstart生成的ks.cfg拷至cobbler的kickstarts目录下
cp -rv /var/www/html/ks/ks.cfg /var/lib/cobbler/kickstarts/centos65.ks
vi /var/lib/cobbler/kickstarts/centos65.ks
url --url http://10.0.0.2/cobbler/ks_mirror/CentOS65-x86_64 :wq
cobbler profile add --name=CentOS65-x86_64 --kickstart="/var/lib/cobbler/kickstarts/centos65.ks"
cobbler profile getks --name CentOS65-x86_64 查看centos65.ks内容(等同于cat centos65.ks)
cobbler profile report
service cobbler restart
cobbler sync
centos65.ks内容:
#Generated by Kickstart Configurator #platform=x86
#System language lang en_US #Language modules to install langsupport en_US #System keyboard keyboard us #System mouse mouse #System timezone timezone America/New_York #Root password rootpw --disabled #Initial user user super --fullname "super" --iscrypted --password $1$.ljIjOMi$vFieciSvR.iGv3uyiVV9D1 #Reboot after installation reboot #Use text mode install text #Install OS instead of upgrade install #Use Web installation url --url http://10.0.0.2/ks #System bootloader configuration bootloader --location=mbr #Clear the Master Boot Record zerombr yes #Partition clearing information clearpart --all --initlabel #Disk partitioning information part / --fstype ext4 --size 50000 --asprimary part swap --size 20000 --asprimary part /boot/efi --fstype vfat --size 1000 --asprimary #System authorization infomation auth --useshadow --enablemd5 #Network information network --bootproto=dhcp --device=em1 #Firewall configuration firewall --disabled #Do not configure the X Window System skipx