#####################################################
##如有转载,请务必保留本文链接及版权信息
##欢迎广大运维同仁一起交流linux/unix网站运维技术!
##博客: 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
 

四、配置管理Cobbler
4.1 Cobbler命令说明
命令名称
命令用途
cobbler check
检查cobbler配置
cobbler list
列出所有的cobbler元素
cobbler report
列出元素的详细信息
cobbler distro
查看导入的发行版系统信息
cobbler system
查看添加的系统信息
cobbler profile
查看配置信息
cobbler sync
同步Cobbler配置,更改配置最好都要执行下
cobbler reposync
同步yum仓库
命令参考
cobbler --help
cobbler distro --help 
cobbler distro add --help
4.2 Cobbler配置文件说明
Cobbler配置文件存放在/etc/cobbler下
配置文件名称
作    用
/etc/cobbler/settings
Cobbler主配置文件
/etc/cobbler/users.digest
用于web访问的用户名密码配置文件
/etc/cobbler/modules.conf
模块配置文件
/etc/cobbler/users.conf
Cobbler WebUI/Web 服务授权配置文件
/etc/cobbler/iso/
Buildiso 模板配置文件
/etc/cobbler/power
电源配置文件
/etc/cobbler/pxe
Pxeprofile配置模板
/etc/cobbler
此目录也包含rsync、dhcp、dns、pxe、dnsmasq等服务的模板配置文件
   
4.3 系统镜像数据目录/var/www/cobbler
导入的系统发行版,repos镜像和kickstart文件都放置在/var/www/cobbler目录下。确保/var目录有足够的空间来存储这些文件。
目录名称
作    用
/var/www/cobbler/p_w_picpaths/
存储所有导入发行版的Kernel和initrd镜像用于远程网络启动
/var/www/cobbler/ks_mirror/
存储导入的发行版系统数据
/var/www/cobbler/repo_mirror/
仓库存储目录
/var/log/cobbler
Cobbler日志文件 cobbler.log install.log
4.4 Cobbler数据目录/var/lib/cobbler
此目录存储和Cobbler profiles、systems、distros相关的配置。
目录名称
作    用
/var/lib/cobbler/config/
存放distros、repos、systems和profiles等信息配置文件,一般都是json文件
/var/lib/cobbler/snippets/
存放ks文件可以导入的脚本小片段,值得研究
/var/lib/cobbler/triggers
存放用户定义的cobbler 命令
/var/lib/cobbler/kickstarts/
存放kickstart配置文件
4.5 相关日志文件
web日志存放点
/var/log/httpd/access_log
/var/log/httpd/error_log
 
/var/log/httpd/ssl_access_log
/var/log/httpd/ssl_error_log
 
Cobbler日志
/var/log/cobbler/cobbler.log
/var/log/cobbler/install.log
 
通过Cobbler日志可以获取系统的安装状态
4.6 导入系统镜像
4.6.1 上传ISO镜像至服务器
注意下载的ISO文件要核对文件的md5值,确保数据完整性
[root@hxinstall x86_64]# md5sum CentOS-5.8-x86_64-bin-DVD-1of2.iso
8a3bf0030f192022943f83fe6b2cf373 CentOS-5.8-x86_64-bin-DVD-1of2.iso
4.6.2 创建ISO目录 
mkdir -p /var/iso/Linux/Centos/x86_64/
mkdir -p /var/os/Linux/Centos/x86_64/Centos5.8/dvd
mkdir -p /var/os/Linux/Centos/x86_64/Centos6.3/dvd  
mkdir -p /var/os/Linux/Centos/x86_64/Centos6.4/dvd
4.6.3 挂载ISO镜像
mount -o loop /var/iso/Linux/Centos/x86_64/CentOS-5.8-x86_64-bin-DVD-1of2.iso   /var/os/Linux/Centos/x86_64/Centos5.8/dvd
4.6.4 从DVD中导入OS数据
系统版本命名为centos5.8 架构x86_64,这时间长,耐性等待。可查看ls /var/www/cobbler/ks_mirror/centos5.8-x86_64/目录文件生成情况。
cobbler import --path=/var/os/Linux/Centos/x86_64/Centos5.8/dvd --name=centos5.8 --arch=x86_64     
task started: 2013-03-12_132624_import
task started (id=Media import, time=Tue Mar 12 13:26:24 2013)
Found a redhat compatible signature: CentOS
adding distros
creating new distro: centos5.8-xen-x86_64
creating new profile: centos5.8-xen-x86_64
creating new distro: centos5.8-x86_64
creating new profile: centos5.8-x86_64
associating repos
traversing distro centos5.8-xen-x86_64
descent into /var/www/cobbler/ks_mirror/centos5.8-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos5.8-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/centos5.8-x86_64
looking for /var/www/cobbler/ks_mirror/centos5.8-x86_64/repodata/*comps*.xml
running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/centos5.8-x86_64/repodata/comps.xml /var/www/cobbler/ks_mirror/centos5.8-x86_64
3496/3496 - CentOS/finger-0.17-33.x86_64.rpm                                    pm6_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
 
received on stderr: This option is deprecated
 
traversing distro centos5.8-x86_64
descent into /var/www/cobbler/ks_mirror/centos5.8-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos5.8-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/centos5.8-x86_64
looking for /var/www/cobbler/ks_mirror/centos5.8-x86_64/repodata/*comps*.xml
running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/centos5.8-x86_64/repodata/comps.xml /var/www/cobbler/ks_mirror/centos5.8-x86_64
3496/3496 - CentOS/finger-0.17-33.x86_64.rpm                                    pm6_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
 
received on stderr: This option is deprecated
 
associating kickstarts
*** TASK COMPLETE ***
4.6.5 列出导入后的配置
cobbler list
 
distros:
   centos5.8-x86_64
   centos5.8-xen-x86_64
   centos6.3-x86_64
   centos6.4-x86_64
 
profiles:
   centos5.8-x86_64
   centos5.8-xen-x86_64
   centos6.3-x86_64
   centos6.4-x86_64
 
systems:
 
repos:
 
p_w_picpaths:
 
mgmtclasses:
 
packages:
 
files:
列出详细信息可以使用cobbler report
4.6.6 比对大小,确保数据的完整性
du -sh /var/www/cobbler/ks_mirror/centos5.8-x86_64/  
4.1G    /var/www/cobbler/ks_mirror/centos5.8-x86_64/
du -sh /var/os/Linux/Centos/x86_64/Centos5.8/dvd/
4.3G    /var/os/Linux/Centos/x86_64/Centos5.8/dvd/
4.6.7 CentOS6.3、6.4导入过程
CentOS6.3
mount -o loop   /var/iso/Linux/Centos/x86_64/CentOS-6.3-x86_64-bin-DVD1.iso /var/os/Linux/Centos/x86_64/Centos6.3/dvd/
 
cobbler import --path=/var/os/Linux/Centos/x86_64/Centos6.3/dvd/ --name=centos6.3 --arch=x86_64   
 
CentOS6.4
mount -o loop   /var/iso/Linux/Centos/x86_64/CentOS-6.4-x86_64-bin-DVD1.iso /var/os/Linux/Centos/x86_64/Centos6.4/dvd/ 
cobbler import --path=/var/os/Linux/Centos/x86_64/Centos6.4/dvd/ --name=centos6.4 --arch=x86_64   

 

4.7 删除导入的系统
cobbler profile find --distro=centos6.3-x64-x86_64 #查看配置是否存在
centos6.3-x64-x86_64
cobbler profile remove --name=centos6.3-x64-x86_64 #删除配置文件
 
cobbler distro remove --name=centos6.3-x64-x86_64 #删除distro
cobbler profile find --distro=centos6.3-x64-x86_64 #再查看配置已无

请看《Cobbler部署指南》系列续文

《Cobbler部署指南之配置管理篇[下文]》http://dreamway.blog.51cto.com/blog/1281816/1166932

《Cobbler部署指南》系列文档下载:http://down.51cto.com/data/745895