天天看點

Cobbler自動部署CentOS系統

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)

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/"

導入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

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

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

#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

本文轉自linux部落格51CTO部落格,原文連結http://blog.51cto.com/yangzhiming/2050962如需轉載請自行聯系原作者

yangzhimingg