#####################################################
##如有转载,请务必保留本文链接及版权信息
##欢迎广大运维同仁一起交流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
六、yum仓库配置管理
6.1 首先导入系统镜像
参考步骤四、导入系统镜像,导入完毕后,进行下面的步骤
6.2 添加镜像
base、updates库使用163的repo源并增加EPEL库
base
cobbler repo add --name=centos5.8-x86_64-Base --mirror=http://mirrors.163.com/centos/5/os/x86_64/
将定义的仓库大写名字Base修改为小写base
cobbler repo edit --name=centos5.8-x86_64-base --mirror=http://mirrors.163.com/centos/5/os/x86_64/ --arch=x86_64 --breed=yum
updates
cobbler repo add --name=centos5.8-x86_64-updates --mirror=http://mirrors.163.com/centos/5/updates/x86_64/ --arch=x86_64 --breed=yum
添加EPEL仓库
cobbler repo add --name=centos5.8-x86_64-epel --mirror=http://mirrors.ustc.edu.cn/epel/5/x86_64/ --arch=x86_64 --breed=yum
6.3 同步yum仓库内容到本地
时间较长,注意磁盘容量是否满足。
cobbler reposync
task started: 2013-03-26_111553_reposync
task started (id=Reposync, time=Tue Mar 26 11:15:53 2013)
hello, reposync
run, reposync, run!
creating: /var/www/cobbler/repo_mirror/centos5.8-x86_64-updates/.origin/centos5.8-x86_64-updates.repo
running: /usr/bin/reposync -l -m -d --config=/var/www/cobbler/repo_mirror/centos5.8-x86_64-updates/.origin/centos5.8-x86_64-updates.repo --repoid=centos5.8-x86_64-updates --download_path=/var/www/cobbler/repo_mirror -a x86_64
………………略…………………………
received on stdout:
received on stderr:
*** TASK COMPLETE ***
6.4 repo添加到profle,
安装系统时会自动添加仓库配置
cobbler profile edit --name=centos5.8-x86_64 --repos="centos5.8-x86_64-base centos5.8-x86_64-epel centos5.8-x86_64-updates" --distro=centos5.8-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos5u8-x64.cfg
6.4 删除仓库配置
cobbler repo remove --name=centos5.8-x86_64- updates
6.5 添加更新仓库源计划任务
cobbler reposync --tries=3 --no-fail
加入crontab 每周日更新一次即可
echo "0 2 * * 0 cobbler reposync --tries=3 --no-fail" >> /var/spool/cron/root
注意检查crond是否启动
/etc/init.d/crond status
crond is stopped
/etc/init.d/crond start
Starting crond: [ OK ]
chkconfig crond on
6.6 装机自动配置yum
如果你想安装系统时自动配置yum,请进行以下配置。
vim /etc/cobbler/settings
yum_post_install_mirror: 1
在装机脚本ks文件加入以下内容
%post
# Start yum configuration
$yum_config_stanza
# End yum configuration
下面的参数PXE安装系统是会引用你添加的cobbler repo配置
注意可能将系统、应用部署到较新版本,根据情况而配置
$yum_repo_stanza
这两个参数都来自Kickstart snippets,很值得研究https://github.com/cobbler/cobbler/wiki/Kickstart-snippets
系统安装自动配置的yum
cat /etc/yum.repos.d/cobbler-config.repo
[core-0]
name=core-0
baseurl=http://172.17.10.14/cobbler/ks_mirror/centos5.8-x86_64
enabled=1
gpgcheck=0
priority=1
[centos5.8-x86_64-base]
name=centos5.8-x86_64-base
baseurl=http://172.17.10.14/cobbler/repo_mirror/centos5.8-x86_64-base
enabled=1
priority=99
gpgcheck=0
[centos5.8-x86_64-epel]
name=centos5.8-x86_64-epel
baseurl=http://172.17.10.14/cobbler/repo_mirror/centos5.8-x86_64-epel
enabled=1
priority=99
gpgcheck=0
[centos5.8-x86_64-updates]
name=centos5.8-x86_64-updates
baseurl=http://172.17.10.14/cobbler/repo_mirror/centos5.8-x86_64-updates
enabled=1
priority=99
gpgcheck=0
请看《Cobbler部署指南》系列续文
《Cobbler部署指南》系列文档下载:http://down.51cto.com/data/745895