利用Cobbler批量快速网络安装CentOS

Cobbler(补鞋匠)集成了PXE、DHCP、DNS、Kickstart服务管理和yum仓库管理工具,相对之前的 Kickstart 更加快捷、方便的批量布署Red HatCentOS类系统

测试环境:

VMware® Workstation : 9.0.0 build-812388

操作系统 : CentOS 5.6 32位

利用Cobbler批量快速网络安装CentOS

一.安装epel源

 

[root@server1 ~]# wget Fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

[root@server1 ~]# rpm -ivh epel-release-5-4.noarch.rpm

warning: epel-release-5-4.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6

Preparing... ########################################### [100%]

1:epel-release ########################################### [100%]

[root@server1 ~]#

安装epel源的好处

就是epel这个项目是由fedora维护的,在维护的这个源中包含许多软件,包括ntop,nagios之类的,也就是说,你安装了epel源就可以直接用yum install ntop来安装了,不过这个应该针对红帽企业版Linux(RHEL)及其衍生发行版(比如CentOS、Scientific Linux)系统,Ubuntu这类的应该不行。

 

二.安装与配置cobbler

 

1.安装cobbler和一些必须的包,并设置开机自动启动

 

[root@server1 ~]# yum -y install cobbler httpd rsync tftp-server xinetd dhcp Python-ctypes pykickstart cman

...

cobbler-2.2.2-1.el5.rf.noarch from rpmforge has depsolving problems

--> Missing Dependency: python-netaddr is needed by package cobbler-2.2.2-1.el5.rf.noarch (rpmforge)

cobbler-2.2.2-1.el5.rf.noarch from rpmforge has depsolving problems

--> Missing Dependency: mod_wsgi is needed by package cobbler-2.2.2-1.el5.rf.noarch (rpmforge)

Error: Missing Dependency: python-netaddr is needed by package cobbler-2.2.2-1.el5.rf.noarch (rpmforge)

Error: Missing Dependency: mod_wsgi is needed by package cobbler-2.2.2-1.el5.rf.noarch (rpmforge)

You could try using --skip-broken to work around the problem

You could try running: package-cleanup --problems

package-cleanup --dupes

rpm -Va --nofiles --nodigest

我的系统需要安装这2个包。

 

[root@server1 ~]# wget ftp://rpmfind.net/linux/epel/5/i386/python-netaddr-0.5.2-1.el5.noarch.rpm

[root@server1 ~]# rpm -ivh python-netaddr-0.5.2-1.el5.noarch.rpm

warning: python-netaddr-0.5.2-1.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6

Preparing... ########################################### [100%]

1:python-netaddr ########################################### [100%]

[root@server1 ~]# wget ftp://rpmfind.net/linux/epel/5/i386/mod_wsgi-3.2-2.el5.i386.rpm

[root@server1 ~]# rpm -ivh mod_wsgi-3.2-2.el5.i386.rpm

warning: mod_wsgi-3.2-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6

Preparing... ########################################### [100%]

1:mod_wsgi ########################################### [100%]

安装完成2个上面的包之后再次安装

 

[root@server1 ~]# yum -y install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes pykickstart cman

...中间省略

[root@server1 ~]# chkconfig httpd on

[root@server1 ~]# chkconfig cobblerd on

[root@server1 ~]# chkconfig dhcpd on

[root@server1 ~]# chkconfig xinetd on

[root@server1 ~]#/etc/init.d/iptables stop

[root@server1 ~]#chkconfig --level 35 iptables off

服务控制脚本

 

[root@server1 ~]#chmod +x /etc/init.d/cobbler_all

用法:/etc/init.d/cobbler_all start|stop|startus|sync

脚本内容:

 

#!/bin/bash

case $1 in

start)

/etc/init.d/httpd start

/etc/init.d/xinetd start

/etc/init.d/dhcpd start

/etc/init.d/cobblerd start

;;

stop)

/etc/init.d/httpd stop

/etc/init.d/xinetd stop

/etc/init.d/dhcpd stop

/etc/init.d/cobblerd stop

;;

status)

/etc/init.d/httpd status

/etc/init.d/xinetd status

/etc/init.d/dhcpd status

/etc/init.d/cobblerd status

;;

sync)

cobbler sync

;;

*)

echo "Input error,please in put 'start|stop|status|sync'!";

exit 2>&1 >/dev/null &

;;

esac

 

相关配置文件及目录:

cobbler相关配置文件: /etc/cobbler

cobbler数据存储目录: /var/www/cobbler

dhcp配置文件: /etc/dhcpd.conf

dhcp租期缓存文件: /var/lib/dhcpd/dhcpd.leases

pxe配置文件: /tftpboot/pxelinux.cfg/default

ks模板文件: /var/lib/cobbler/kickstarts_*.ks

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/20386.html