#####################################################
##如有转载,请务必保留本文链接及版权信息
##欢迎广大运维同仁一起交流linux/unix网站运维技术!
##QQ:335623998
##E-mail:[email protected]
##博客: http://dreamway.blog.51cto.com/
##weibo:http://weibo.com/zhaixiangpan
#####################################################
《Cobbler部署指南》系列
1、《Cobbler部署指南之安装篇》http://dreamway.blog.51cto.com/blog/1281816/1166589
2、《Cobbler部署指南之配置管理篇[上文]》http://dreamway.blog.51cto.com/blog/1281816/1166921
3、《Cobbler部署指南之配置管理篇[下文]》http://dreamway.blog.51cto.com/blog/1281816/1166932
4、《Cobbler部署指南之yum仓库配置管理篇》http://dreamway.blog.51cto.com/blog/1281816/1166936
5、《Cobbler部署指南之Cobbler安装操作系统篇》http://dreamway.blog.51cto.com/blog/1281816/1166947
6、《Cobbler部署指南之安装虚拟化Xen系统篇》http://dreamway.blog.51cto.com/blog/1281816/1166950
7、《Cobbler部署指南之电源管理篇》http://dreamway.blog.51cto.com/blog/1281816/1166957
8、《Cobbler部署指南之FAQ处理篇》http://dreamway.blog.51cto.com/blog/1281816/1167078
4.8 自定义ks
更改kickstart文件,可为http等,具体cobbler --help查看,这里采用我们自定制ks文件
ks
目录位置
/var/lib/cobbler/kickstarts/
默认的ks位置
/var/lib/cobbler/kickstarts/sample.ks
更改指定系统版本对应的ks配置文件
cobbler profile edit --name=centos5.8-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos5u8-x64.cfg
cobbler profile edit --name=centos6.3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6u3-x64.cfg
cobbler profile edit --name=centos6.4-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6u4-x64.cfg
4.9 配置信息查看
cobbler report
distros:
==========
Name : centos5.8-xen-x86_64
Architecture : x86_64
TFTP Boot Files : {}
Breed : redhat
Comment : rhel5.8
Fetchable Files : {}
Initrd : /var/www/cobbler/ks_mirror/centos5.8-x86_64/images/xen/initrd.img
Kernel : /var/www/cobbler/ks_mirror/centos5.8-x86_64/images/xen/vmlinuz
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/centos5.8-xen-x86_64'}
Management Classes : []
OS Version : rhel5
Owners : ['admin']
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Template Files : {}
Name : centos6.4-x86_64
Architecture : x86_64
TFTP Boot Files : {}
Breed : redhat
Comment : rhel6.4
Fetchable Files : {}
Initrd : /var/www/cobbler/ks_mirror/centos6.4-x86_64/images/pxeboot/initrd.img
Kernel : /var/www/cobbler/ks_mirror/centos6.4-x86_64/images/pxeboot/vmlinuz
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/centos6.4-x86_64'}
Management Classes : []
OS Version : rhel6
Owners : ['admin']
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Template Files : {}
……略……
systems:
==========
repos:
==========
images:
==========
mgmtclasses:
==========
packages:
==========
files:
==========
4.10 系统版本列表
cobbler distro list
centos5.8-x86_64
centos5.8-xen-x86_64
centos6.3-x86_64
centos6.4-x86_64
4.11 同步Cobbler配置
建议先执行cobbler check进行配置检查再执行cobbler sync,修改cobbler配置后都需要执行此步骤
cobbler check
No configuration problems found. All systems go.
cobbler sync
task started: 2013-03-12_171702_sync
task started (id=Sync, time=Tue Mar 12 17:17:02 2013)
running pre-sync triggers
cleaning trees
……略……
rendering Rsync files
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout:
received on stderr:
running: service dhcpd restart
received on stdout: Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
received on stderr:
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
4.12 创建PXE菜单密码
增加装机安全设置菜单密码
生成hash密码
支持两种不同类型的密码:
或
openssl passwd -1 -salt sXiKzkus mypassword
我这里选择后者
# openssl passwd -1 -salt sXiKzkus hexun
$1$sXiKzkus$2DoZ6pfTe8rrc0Si60ecB/
编辑配置文件
pxedefault
,添加如下蓝色部分
vim /etc/cobbler/pxe/pxedefault.template
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://fedorahosted.org/cobbler
MENU MASTER PASSWD $1$sXiKzkus$2DoZ6pfTe8rrc0Si60ecB/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT $pxe_timeout_profile
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
$pxe_menu_items
MENU end
配置
pxeprofile
,增加蓝色部分
vim /etc/cobbler/pxe/pxeprofile.template
LABEL $profile_name
MENU PASSWD
kernel $kernel_path
$menu_label
$append_line
ipappend 2
修改完毕注意检查、同步配置使其生效
cobbler check
No configuration problems found. All systems go.
cobbler sync
PXE
装机时选择装机系统版本,输入装机密码,效果图
4.13 定制PXE菜单TITLE
编辑pxedefault文件,
vim /etc/cobbler/pxe/pxedefault.template
MENU TITLE Cobbler | http://fedorahosted.org/cobbler
将原文上面的内容根据自定义进行修改
MENU TITLE Hexun Automation Install System
修改后的文件
DEFAULT menu
PROMPT 0
MENU TITLE Hexun Automation Install System
MENU MASTER PASSWD $1$sXiKzkus$2DoZ6pfTe8rrc0Si60ecB/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT $pxe_timeout_profile
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
$pxe_menu_items
MENU end
修改完毕执行如下两条命令
cobbler check
cobbler sync
4.14 添加指定客户机系统配置到Cobbler
4.14.1 指定一个网段使用特定的装机配置
cobbler system add --name=network --ip=172.17.188.0/16 --profile=centos5.8-x86_64
4.14.2 添加一个指定服务器的装机配置
指定服务器就是绑定它的mac地址,并设置好ip、dns、hostname
定义系统
cobbler system add --name=host-188116 --hostname=host-188116 --mac=00:19:B9:E5:34:FE --interface=eth0 --ip-address=172.17.188.116 --subnet=255.255.0.0 --gateway=172.17.188.1 --static=1 --profile=centos5.8-x86_64
查看定义的系统列表
cobbler system list
host-188116
更多参数见cobbler system add --help
五、Cobbler Web管理
Cobbler web界面是一个很好的前端,非常容易管理Cobbler
可以添加和删除 system distro profile
可以查看、编辑distros, profiles, subprofiles, systems, repos 、 kickstart文件
5.1 安装cobbler_web
yum -y install cobbler-web
5.2 设置用户名密码
为已存在的用户cobbler重置密码
htdigest /etc/cobbler/users.digest "Cobbler" cobbler
添加新用户
htdigest /etc/cobbler/users.digest "Cobbler" your_newname
5.3 配置cobbler web可以登录
sed -i 's/authn_denyall/authn_configfile/g' /etc/cobbler/modules.conf
5.4 重启Cobbler与http
/etc/init.d/cobblerd restart
/etc/init.d/httpd restart
5.5 访问Cobbler Web页面
浏览器访问登录页面https://172.17.10.14/cobbler_web
输入用户名密码
登录后的页面
web管理相对易于使用管理这里这就不再赘述。
请看《Cobbler部署指南》系列续文
《Cobbler部署指南》系列文档下载:http://down.51cto.com/data/745895