1.cobbler 相關(guān)術(shù)語
(1)發(fā)行版:
表示一個操作系統(tǒng)版本揪漩,它承載了內(nèi)核和 initrd 的信息黄绩,以及內(nèi)核參數(shù)等其他數(shù)據(jù)
(2)配置文件:
包含一個發(fā)行版萌京、一個 kickstart 文件以及可能的存儲庫,還包含更多特定的內(nèi)核參數(shù)等其他數(shù)據(jù)
(3)系統(tǒng):
表示要配置的主機呻引,它包含一個配置文件或一個鏡像考蕾,還包含IP 和 MAC 地址祸憋、電源管理(地址、憑據(jù)肖卧、類型)以及更為專業(yè)的數(shù)據(jù)等信息
(4)存儲庫:
保存一個 yum 或 rsync 存儲庫的鏡像信息
(5)鏡像:
可替換一個包含不屬于此類別的文件的發(fā)行版對象(例如蚯窥,無法分為內(nèi)核和 initrd 的對象)
2.cobbler 各種配置目錄說明
? 配置文件目錄 /etc/cobbler
/etc/cobbler/settings : cobbler 主配置文件
/etc/cobbler/iso/: iso模板配置文件
/etc/cobbler/pxe: pxe模板文件
/etc/cobbler/power: 電源配置文件
/etc/cobbler/user.conf: web服務(wù)授權(quán)配置文件
/etc/cobbler/users.digest: web訪問的用戶名密碼配置文件
/etc/cobbler/dhcp.template : dhcp服務(wù)器的的配置模板
/etc/cobbler/dnsmasq.template : dns服務(wù)器的配置模板
/etc/cobbler/tftpd.template : tftp服務(wù)的配置模板
/etc/cobbler/modules.conf : 模塊的配置文件
3.cobbler 目錄介紹
(1)數(shù)據(jù)目錄
/var/lib/cobbler/config/: 用于存放distros,system,profiles 等信息配置文件
/var/lib/cobbler/triggers/: 用于存放用戶定義的cobbler命令
/var/lib/cobbler/kickstart/: 默認存放kickstart文件
/var/lib/cobbler/loaders/: 存放各種引導(dǎo)程序
(2)鏡像目錄
/var/www/cobbler/ks_mirror/: 導(dǎo)入的發(fā)行版系統(tǒng)的所有數(shù)據(jù)
/var/www/cobbler/images/ : 導(dǎo)入發(fā)行版的kernel和initrd鏡像用于遠程網(wǎng)絡(luò)啟動
/var/www/cobbler/repo_mirror/: yum 倉庫存儲目錄
(3)日志目錄
/var/log/cobbler/installing: 客戶端安裝日志
/var/log/cobbler/cobbler.log : cobbler日志
4.cobbler 命令介紹
cobbler check 核對當(dāng)前設(shè)置是否有問題
cobbler list 列出所有的cobbler元素
cobbler report 列出元素的詳細信息
cobbler sync 同步配置到數(shù)據(jù)目錄,更改配置最好都要執(zhí)行下
cobbler reposync 同步y(tǒng)um倉庫
cobbler distro 查看導(dǎo)入的發(fā)行版系統(tǒng)信息
cobbler system 查看添加的系統(tǒng)信息
cobbler profile 查看配置信息
5.cobbler 重要的參數(shù)
? /etc/cobbler/settings中重要的參數(shù)設(shè)置
? default_password_crypted:
"$1$gEc7ilpP$pg5iSOj/mlxTxEslhRvyp/"
? manage_dhcp:1
? manage_tftpd:1
? pxe_just_once:1
? next_server:< tftp服務(wù)器的 IP 地址>
? server:<cobbler服務(wù)器的 IP 地址>
6.cobbler 環(huán)境檢查
? 執(zhí)行Cobbler check命令會報如下異常
? 1 : The ‘server’ field in /etc/cobbler/settings must be set
to something other thanlocalhost, 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 setto something other than
127.0.0.1, and should match the IP of the boot server on
thePXE 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 handlex86/x86_64netbooting,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, andyaboot. The ‘cobbler get-loaders’ command is the easiest way to resolve theserequirements.
? 4 : change ‘disable’ to ‘no’ in /etc/xinetd.d/rsync
? 5 : comment ‘dists’ on /etc/debmirror.conf for proper debian support
? 6 : comment ‘a(chǎn)rches’ 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
cobbler 報錯解決
? 執(zhí)行Cobbler check報錯解決方式
? 修改/etc/cobbler/settings文件中的server參數(shù)的值為提
供cobbler服務(wù)的主機相應(yīng)的IP地址或主機名
? 修改/etc/cobbler/settings文件中的next_server參數(shù)的
值為提供PXE服務(wù)的主機相應(yīng)的IP地址
? 如果當(dāng)前節(jié)點可以訪問互聯(lián)網(wǎng)拦赠,執(zhí)行“cobbler getloaders”命令即可巍沙;否則,需要安裝syslinux程序包荷鼠,而后復(fù)制/usr/share/syslinux/{pxelinux.0,memu.c32}等文件
至/var/lib/cobbler/loaders/目錄中
? 執(zhí)行“chkconfig rsync on”命令即可
? 執(zhí)行“openssl passwd -1 生成密碼句携,并用其替換
/etc/cobbler/settings文件中default_password_crypted
參數(shù)的值
6.cobbler 相關(guān)管理
? 下載啟動菜單: cobbler get-loaders
? 管理distro
cobbler import --name=centos-6.9-x86_64 -- path=/media/cdrom
? 管理profile
cobbler profile add --name=centos-6.9-x86_64-basic -- distro=centos-6.9-x86_64 --kickstart=/tmp/centos- 6.9-x86_64.cfg
? 查看profiles
cobbler profile list
? 查看引導(dǎo)文件
cat /var/lib/tftpboot/pxelinux.cfg/default
? 同步cobbler配置
cobbler sync
7.多系統(tǒng)引導(dǎo)方案
? cobbler import --name=CentOS-7-x86_64 --
path=/media/cdrom
cobbler distro list
cobbler profile list
cobbler sync
cobbler 實現(xiàn)步驟
? 安裝包,并設(shè)置服務(wù)
? 檢查配置
? 根據(jù)上面提示修改配置
? 下載啟動相關(guān)文件菜單
? 配置DHCP服務(wù)
? 分別導(dǎo)入centos的安裝源,并查看
? 準備kickstart文件并導(dǎo)入cobbler
? 測試
8.cobbler的web管理實現(xiàn)
? cobbler-web
提供cobbler的基于web管理界面允乐,epel源
yum install cobbler-web
? 認證方式
? 定義認證方法:/etc/cobbler/modules.conf
? 使用authn_pam模塊認證cobbler_web用戶
[authentication] 塊中指定 module = authn_pam
?創(chuàng)建cobbler用戶:useradd cobbler
?修改文件 /etc/cobbler/users.conf
[admins]
admin = "cobbler"
? 使用authn_configfile模塊認證cobbler_web用戶
?[authentication]塊中module=authn_configfile
?創(chuàng)建其認證文件/etc/cobbler/users.digest矮嫉,并添加所
需的用戶
htdigest -c /etc/cobbler/users.digest Cobbler admin
?注意:添加第一個用戶時,使用“-c”選項,后續(xù)添加其他
用戶時不要再使用牍疏,cobbler_web的realm只能為Cobbler
? Web訪問cobbler
? 重啟cobblerd服務(wù)
? 通過http://cobblerserver/cobbler_web訪問即可