Cobbler 的使用
一個簡短的關於 cobbler 的介紹,點擊這裡。
母機環境為 CentOS-5.6-x86_64。google 看 cobbler,誇讚他的人很多,大致就是將網路環境安裝的難度降低到 」cobbler「 的水平了,雖說誇張了些,但是跟 pxe 等一系列工具組合使用對比來看 ,在配置難度上略微降低。
使用 epel 源安裝 cobbler:
# rpm -ivh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# yum install cobbler httpd tftp-server dhcp xinetd
修改 tftp:
# sed '/disable/s/no/yes/g' /etc/xinetd.d/tftp
# sed '/disable/s/no/yes/g' /etc/xinetd.d/rsync
# /etc/init.d/xinetd restart
修改 cobbler 的配置:
# vi /etc/cobbler/settings
將 server 段即本機的地址;next_server 段表示的是 dhcp 的地址,將二者都設置成本機的 ip;將 manage_dhcp 置為 1。
default_kickstart 欄位默認是 /var/lib/cobbler/kickstarts/default.ks。而該文件默認為空,需要自己配置。
在做了任何有關 cobbler 的修改後,需要執行:
# cobbler sync
修改 cobbler 中的 dhcp 模版,通過該模版會生成 /etc/dhcpd.conf 文件:
# vi /etc/cobbler/dhcp.template
ddns-update-style interim;
allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
subnet 10.18.101.0 netmask 255.255.255.0 {
option routers 10.18.101.254;
option domain-name-servers 8.8.4.4;
option subnet-mask 255.255.255.0;
range dynamic-bootp 10.18.101.240 10.18.101.250;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
檢查 cobbler 的配置,根據出現的提示進行接下來的步驟:
# cobbler check
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 : since iptables may be running, ensure 69, 80, and 25151 are unblocked
6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
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.
掛載 iso 鏡像,製作 cobbler 源:
# mount -o loop CentOS-5.6-x86_64.iso /mnt
# cobbler import –path=/mnt –name=CentOS-5-x86_64
注意:cobbler 默認是在 /var/www/cobbler 下建立源,所以 /var 需要足夠大。
kickstart 文件默認在 /var/liv/cobbler/kickstarts/ 目錄中,該步驟可以參考前面的 kickstart 配置。可以在下面的鏈接中看到寫的 kickstart 文件:
http://10.18.101.252/cblr/svc/op/ks/system/xen-215
注意:將原來的 nfs 方式換成 http:
url –url=http://10.18.101.252/cobbler/ks_mirror/CentOS-5-x86_64
重啟 cobbler,生效:
# /etc/init.d/cobblerd restart
建立相應的 profiles,systems:
# cobbler profile add –name=xen-215 –distro=CentOS-5-x86_64 –kickstart=/var/lib/cobbler/kickstarts/xen-215.ks
# cobbler system add –name=xen-215 –mac=00:00:22:22:33:33 –profile=xen-215
列出 cobbler 的所有元素:
# cobbler list
distros:
CentOS-5-x86_64
CentOS-5-xen-x86_64
profiles:
CentOS-5-x86_64
CentOS-5-xen-x86_64
webserver
xen-215
systems:
webserver1
xen-215
repos:
centos-5.6-x86_64
images:
在原系統上安裝安裝 koan 這個客戶來完成一些諸如重裝系統等的事情:
# yum install koan
列出伺服器上的 profiles:
# koan –server=10.18.101.252 –list=profiles
重新安裝系統:
# koan –replace-self –server=10.18.101.252 –profile=xen-215
可以安裝 cobbler-web,功能很強大,」數形結合「有助理解:
# yum install cobbler-web
添加新用戶以及登陸密碼:
# htdigest /etc/cobbler/users.digest "Cobbler" jaseywang
修改認證方式:
# vi /etc/cobbler/modules.conf
module = authn_configfile
module = authz_allowall
這裡是一篇如何使用 cobbler 安裝 CentOS 6 的教程。
參考:
http://mdehaan.fedorapeople.org/screencasts/cobbler.htm
http://jaseywang.me/2011/08/16/cobbler-%E7%9A%84%E4%BD%BF%E7%94%A8/
《解決方案》
樓主辛苦了,謝謝分享