Cobbler部署指南之yum倉庫配置管理篇

#####################################################
##若有轉載,請務必保留本文連接及版權信息
##歡迎廣大運維同仁一塊兒交流linux/unix網站運維技術!
##QQ:335623998
##E-mail:335623998@qq.com
##博客: http://dreamway.blog.51cto.com/
##weibo:http://weibo.com/zhaixiangpan
#####################################################linux

《Cobbler部署指南》系列git

一、《Cobbler部署指南之安裝篇》http://dreamway.blog.51cto.com/blog/1281816/1166589github

二、《Cobbler部署指南之配置管理篇[上文]》http://dreamway.blog.51cto.com/blog/1281816/1166921vim

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

四、《Cobbler部署指南之yum倉庫配置管理篇》http://dreamway.blog.51cto.com/blog/1281816/1166936運維

五、《Cobbler部署指南之Cobbler安裝操做系統篇》http://dreamway.blog.51cto.com/blog/1281816/1166947ide

六、《Cobbler部署指南之安裝虛擬化Xen系統篇》http://dreamway.blog.51cto.com/blog/1281816/1166950post

七、《Cobbler部署指南之電源管理篇》http://dreamway.blog.51cto.com/blog/1281816/1166957網站

八、《Cobbler部署指南之FAQ處理篇》http://dreamway.blog.51cto.com/blog/1281816/1167078
 url

6、yum倉庫配置管理

6.1 首先導入系統鏡像

參考步驟4、導入系統鏡像,導入完畢後,進行下面的步驟

6.2 添加鏡像

baseupdates庫使用163repo源並增長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

相關文章
相關標籤/搜索