原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://dreamway.blog.51cto.com/1281816/1166589#######################################################如有转载,请务必保留本文链接及版权信息##欢迎广大运维同仁一起交流linux/unix网站运维技术!##QQ:335623998##E-mail:[email protected]##博客: http://dreamway.blog.51cto.com/##weibo:http://weibo.com/zhaixiangpan#####################################################
文档信息:
文档版本:Version 1.0
修改记录: 2013-03-12|2013-03-29
系统环境:CentOS 5.8 64bit
《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是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows。该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP、DNS、以及yum仓库、构造系统ISO镜像。
Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用。
Cobbler客户端Koan支持虚拟机安装和操作系统重新安装,使重装系统更便捷。
Cobbler提供以下服务集成:
* PXE服务支持
* DHCP服务管理
* DNS服务管理
* 电源管理
* Kickstart服务支持
* yum仓库管理
摘自https://github.com/cobbler/cobbler/wiki/Who-Uses-Cobbler
http://www.cobblerd.org/users.html
Cobbler最初是支持系统版本Fedora, Red Hat和衍生版本,如CentOS 和Scientific Linux.现在对
Debian 和Ubuntu SuSE支持也相当强。还支持FreeBSD、ESXI等。
koan 在Fedora, Red Hat Enterprise Linux, or CentOS工作正常,其他Linux版本应该也不错。
摘自https://github.com/cobbler/cobbler/wiki/How%20We%20Model%20Things
lsb_release -a
LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 5.8 (Final)
Release: 5.8
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 15G 438M 14G 4% /
/dev/sda7 90G 236M 85G 1% /var
/dev/sda6 7.8G 147M 7.3G 2% /opt
/dev/sda5 7.8G 2.0G 5.4G 28% /usr
/dev/sda1 494M 17M 452M 4% /boot
tmpfs 3.9G 0 3.9G 0% /dev/shm
free -m
total used free shared buffers cached
Mem: 7985 148 7837 0 30 37
-/+ buffers/cache: 80 7905
Swap: 12291 0 12291
Cobbler版本: 2.2.3
Koan 版本:koan-1.6.6
cman版本:cman-2.0.115
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
warning: /var/tmp/rpm-xfer.mDDqhT: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
Cobbler版本 2.2.3
yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes cman pykickstart -y
Loaded plugins: fastestmirror, security
Determining fastest mirrors
* epel: mirrors.ustc.edu.cn
CentOS | 1.3 kB 00:00
CentOS/primary | 1.2 MB 00:00
CentOS 3595/3595
epel | 3.6 kB 00:00
epel/primary_db | 3.7 MB 00:01
……略……
Transaction Summary
====================================================================================================================================
Install 12 Package(s)
Upgrade 0 Package(s)
Total download size: 3.7 M
……略……
Installed:
cobbler.noarch 0:2.2.3-2.el5 dhcp.x86_64 12:3.0.5-31.el5 python-ctypes.x86_64 0:1.0.2-3.el5
Dependency Installed:
PyYAML.x86_64 0:3.08-4.el5 createrepo.noarch 0:0.4.11-3.el5 libyaml.x86_64 0:0.1.2-3.el5
mkisofs.x86_64 9:2.01-10.7.el5 mod_wsgi.x86_64 0:3.2-2.el5 python-cheetah.x86_64 0:2.0.1-1.el5
python-netaddr.noarch 0:0.5.2-1.el5 python-simplejson.x86_64 0:2.0.9-8.el5 yum-utils.noarch 0:1.1.16-21.el5.centos
Complete!
vim /etc/cobbler/settings #Cobbler主配置文件
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings
配置前后内容对比
diff /etc/cobbler/settings /etc/cobbler/settings_2013-03-10
218c218
<manage_dhcp: 1 #启用cobbler管理DHCP功能
---
> manage_dhcp: 0
237c237
<manage_rsync: 1 #启用cobbler管理rsync功能
---
> manage_rsync: 0
248c248
<next_server: 172.17.10.14 # DHCP服务地址
---
> next_server: 127.0.0.1
360c360
<server: 172.17.10.14 # cobbler服务地址
---
> server: 127.0.0.1
3.4 检查、关闭SELinux、iptables
getsebool
getsebool: SELinux is disabled
service iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
chkconfig iptables off
设置 'disable' 为 'no'
sed -i '/disable/c\\tdisable\t\t\t= no' /etc/xinetd.d/tftp
sed -i 's/\=\ yes/\=\ no/g' /etc/xinetd.d/rsync
sed -i 's@#LoadModule@LoadModule@g' /etc/httpd/conf.d/wsgi.conf
这里生成密钥和配置默认密钥,ks文件引用
openssl passwd -1 -salt 'random-phrase-here' 'hexun'
$1$random-p$Q1IN9LaNg7yhRKJuY50fV1s
加入cobbler配置
vim /etc/cobbler/settings
grep default_password_crypted /etc/cobbler/settings#修改为如下配置
default_password_crypted: "$1$random-p$Q1IN9LaNg7yhRKJuY50fV1s"
cp /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.$(date +%F) #备份
vim /etc/cobbler/dhcp.template
dhcp.template dhcp.template.2013-03-10
vim /etc/cobbler/dhcp.template #编辑
diff /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.2013-03-10 |grep '<' #配置前后差异对比
< subnet 172.17.0.0 netmask 255.255.0.0 {
< option routers 172.17.10.119;
< option domain-name"sys.hexun";
< option domain-name-servers 172.17.10.2;
< option subnet-mask 255.255.0.0;
< range dynamic-bootp 172.17.188.60 172.17.188.120;
< default-lease-time 600;
< max-lease-time 1200;
/sbin/service httpd start
/sbin/service dhcpd start
/sbin/service xinetd start
/sbin/service cobblerd start
/sbin/chkconfig httpd on
/sbin/chkconfig dhcpd on
/sbin/chkconfig xinetd on
/sbin/chkconfig tftp on
/sbin/chkconfig cobblerd on
cobbler get-loaders
yum -y install debmirror
修改 /etc/debmirror.conf 配置文件,注释掉 @dists 和 @arches 两行
sed -i 's|@dists=.*|#@dists=|' /etc/debmirror.conf
sed -i 's|@arches=.*|#@arches=|' /etc/debmirror.conf
cobbler check
No configuration problems found. All systems go. #出现此提示即正常
cobblerd does not appear to be running/accessible #此提示是因为cobbler服务没启动
cobbler check出现的相关报错处理请看http://dreamway.blog.51cto.com/blog/1281816/1167078
cobbler sync
四、配置管理Cobbler
请访问
http://dreamway.blog.51cto.com/blog/1281816/1166921
五、Cobbler Web管理
http://dreamway.blog.51cto.com/blog/1281816/1166932
六、yum仓库配置管理
http://dreamway.blog.51cto.com/1281816/1166936
七、Cobbler安装操作系统
http://dreamway.blog.51cto.com/1281816/1166947
7.5 安装Xen 宿主机
7.6 安装Xen虚拟机
http://dreamway.blog.51cto.com/1281816/1166950
八、电源管理
http://dreamway.blog.51cto.com/1281816/1166957
九、Cobbler报错处理
http://dreamway.blog.51cto.com/1281816/1167078
请看《Cobbler部署指南》系列续
《运维自动化装机篇之Cobbler部署指南【技术文档】》下载 http://down.51cto.com/data/745895