cobbler的簡介
cobbler是Redhat支持的一個開源項目,用來部署和安裝系統。所以對Redhat系列os支持是比較好的。不過對ubuntu支持是非常差的。cobbler裡不少設置,只針對redhat有效,同時也由於不同發行版的安裝是有差異。cobbler感覺好像和ubuntu關系比較緊張.
cobbler不僅僅是一個pxe服務器,他還可以管理dns(bind),dhcp。一般數據中心裡或者生產環境,是不允許dhcp,但是pxe,必須需要dhcp,所以我們需要根據mac地址來分配IP,這樣dhcp就不會影響到網絡.
1、安裝cobbler
提前配置好epel源http://mirrors.ustc.edu.cn/fedora/epel/6/i386/
[root@60sec /]# yum -y install cobbler
[root@60sec /]# service httpd start
Starting httpd: [ OK ]
[root@60sec /]# service cobblerd start
Starting cobbler daemon: [ OK ]
2、執行cobbler check命令檢查存的問題,而後逐一按提示解決之
[root@60sec /]# vim /etc/cobbler/settings
next_server: 192.168.83.137
server: 192.168.83.137
manage_tftpd: 0
[root@60sec /]# yum -y install syslinux
[root@60sec /]# chkconfig rsync on
[root@60sec /]# yum -y install pykickstart
[root@60sec /]# openssl passwd -1 -salt 'openssl rand -hex 4'
Password:
$1$openssl $.oduSwbhLj6jqAwVsLo/H1
[root@60sec /]# vim /etc/cobbler/settings
default_password_crypted: "penssl $.oduSwbhLj6jqAwVsLo/H1"
[root@60sec /]# cd /usr/share/syslinux/
[root@60sec syslinux]# cp -r ./* /var/lib/cobbler/loaders/
3、安裝dhcp服務
[root@60sec /]# yum -y install dhcp
[root@60sec /]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
[root@60sec /]# vim /etc/dhcp/dhcpd.conf
option domain-name "60sec.com";
option domain-name-servers 192.168.83.137;
default-lease-time 43300;
max-lease-time 86500;
subnet 192.168.83.0 netmask 255.255.255.0 {
range 192.168.83.50 192.168.83.100;
option routers 192.168.83.137;
}
next-server 192.168.83.137;
filename="pxelinux.0";
[root@60sec /]# service dhcpd start
Starting dhcpd: [ OK ]
4、開啟tftp服務
[root@60sec /]# chkconfig tftp on
[root@60sec /]# service xinetd start
Starting xinetd: [ OK ]
5、定義distro,掛載光盤並導入
[root@60sec /]# mount -r /dev/cdrom /media/
[root@60sec /]# cobbler import --name=centos-6.5-x86_64 --path=/media
6、如果有kickstart文件,使用“--kickstart=/path/to/kickstart_file”進行導入,也可使用以下命令檢測,
可以使用system-config-kickstart進行制作kickstart文件。cobbler的ks 文件默認都放在/var/lib/cobbler/kickstarts/下面 可以根據不同的需求定制ks文件。
[root@60sec mnt]# ksvalidator centos6.x86_64.cfg
7、設置profile,profile可以理解為按安裝需求進行分類。
[root@60sec mnt]# cobbler profile add --name=CenTos-6.5-x86_64-basic --distro=centos-6.5-x86_64 --kickstart=/mnt/centos6.x86_64.cfg
[root@60sec mnt]# cobbler profile list
CenTos-6.5-x86_64-basic
Centos-6.5-x86_64
[root@60sec mnt]# cobbler sync
[root@60sec mnt]# service cobblerd restart
可修改相關信息
[root@60sec mnt]# vim /var/lib/tftpboot/pxelinux.cfg/default
8、重新創建虛擬機測試