利用Cobbler批量快速网络安装CentOS
Cobbler是什么?
Cobbler(补鞋匠)集成了PXE、DHCP、DNS、Kickstart服务管理和yum仓库管理工具,相对之前的 Kickstart 更加快捷、方便的批量布署Red Hat、CentOS类系统
测试环境:
VMware® Workstation : 9.0.0 build-812388
操作系统 : CentOS 5.6 32位
一.安装epel源
- [root@server1 ~]# wget http://dl.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
相关推荐
xushxbigbear微信 2019-11-11
annan 2019-10-29
chinawap 2018-09-05
86520391 2018-03-13
步知道 2018-03-12
87447007 2017-10-16
87530399 2017-09-17
suyongxing 2017-09-17
nenusoulcsdn 2017-09-03
84467015 2017-05-26
83560193 2017-05-26
AReallyMan 2016-11-15
86981130 2016-07-25
unixlinuxsys 2015-09-20
joshwan 2015-09-12
hfight 2015-02-09
MARQUIS 2015-02-09
VictoryKingLIU 2014-02-26