Cobbler 的配置結構基於一組註冊的對象。每一個對象表示一個與另外一個實體相關聯的實體(該對象指向另外一個對象,或者另外一個對象指向該對象)。當一個對象指向另外一個對象時,它就繼承了被指向對象的數據,並可覆蓋或添加更多特定信息。如下對象類型的定義爲:html
基於註冊的對象以及各個對象之間的關聯,Cobbler 知道如何更改文件系統以反映具體配置。由於系統配置的內部是抽象的,因此您能夠僅關注想要執行的操做。linux
所需相關服務 tftp rsync dhcp dns 可由cobbler 管理,也可由服務本身管理web
環境 centos6.4 x86_64 最小化安裝 vim
安裝開發包,vim, ntp, man 工具 centos
1 安裝EPEL源架構
[root@cobbler ~]# rpm -ivh epel-release-6-8.noarch.rpm
2 安裝cobblerapp
[root@cobbler ~]# yum install cobbler httpd cobbler-web debmirror pykickstart
3 啓動cobbler httpddom
[root@cobbler ~]# service cobblerd start [root@cobbler ~]# service httpd start
4 檢查cobbleride
[root@cobbler ~]# cobbler check The following are potential configuration items that you may want to fix: 1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it. 2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network. 3 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements. 4 : change 'disable' to 'no' in /etc/xinetd.d/rsync 5 : comment out 'dists' on /etc/debmirror.conf for proper debian support 6 : comment out 'arches' on /etc/debmirror.conf for proper debian support 7 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one 8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them Restart cobblerd and then run 'cobbler sync' to apply changes.
5 更改設置工具
[root@cobbler cobbler]# vim settings next_server: 192.168.200.138 server: 192.168.200.138 [root@cobbler cobbler]# cobbler get-loaders [root@cobbler cobbler]# vim /etc/xinetd.d/rsync disable = no [root@cobbler cobbler]# vim /etc/debmirror.conf #@dists="sid"; #@arches="i386"; [root@cobbler cobbler]# openssl passwd -1 -salt `openssl rand -hex 4` Password: $1$cbf5f59c$vn.js51UZEZDsUYh//AYC1 [root@cobbler cobbler]# vim settings default_password_crypted: "$1$cbf5f59c$vn.js51UZEZDsUYh//AYC1" [root@cobbler cobbler]# yum install cman fence-agents
6 從新檢測cobbler
[root@cobbler cobbler]# service cobblerd restart [root@cobbler cobbler]# cobbler check No configuration problems found. All systems go. [root@cobbler cobbler]# cobbler sync
7 安裝DHCP
[root@cobbler cobbler]# yum install dhcp
8 配置DHCP
[root@cobbler dhcp]# cd /etc/dhcp/ [root@cobbler dhcp]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample dhcpd.conf [root@cobbler dhcp]# vim dhcpd.conf option domain-name "daphne.com."; option domain-name-servers 192.168.200.2; subnet 192.168.200.0 netmask 255.255.255.0{ range 192.168.200.10 192.168.200.20; option routers 192.168.200.2; } next-server 192.168.200.138; filename="pxelinux.0"; [root@cobbler dhcp]# service dhcpd restart Starting dhcpd: [ OK ]
9 配置tftp
[root@cobbler dhcp]# chkconfig tftp on
10 配置distro
[root@cobbler ~]# mkdir /media/cdrom
[root@cobbler ~]# mount /dev/cdrom /media/cdrom/
[root@cobbler ~]# cobbler import --name=centos6.4-x86_64 --path=/media/cdrom/
[root@cobbler ~]# cobbler distro list
centos6.4-x86_64
11 配置profile
事先作好ks.cfg ,ks.cfg 是在pxe篇作的 須要修改
[root@cobbler ~]# vim ks.cfg url --usl=http://192.168.200.138/cobbler/ks_mirror/centos6.4-x86_64
當定義distro 會自動生成一個 centos6.4-86_64 profile 文件
一個profile 對應一個lable
[root@cobbler ~]# cobbler profile add --name=centos6.4-x86_64 --distro=centos6.4-x86_64 kickstart=/root/ks.cfg exception on server: "it seems unwise to overwrite this object, try 'edit'" [root@cobbler ~]# cobbler profile edit --name=centos6.4-x86_64 --distro=centos6.4-x86_64 kickstart=/root/ks.cfg
12
[root@cobbler ~]# cobbler sync
13 測試