| 
	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这类的应该不行。 
			  
	
		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 
					2.编辑vim /etc/cobbler/settings 
					  
					
						[root@server1 ~]# vim /etc/cobbler/settings 
						 
						next_server: 127.0.0.1 修改为:next_server: 192.168.0.45(是cobbler服务器的地址) 
						 
						server: 127.0.0.1 修改为: server: 192.168.0.45(是cobbler服务器的地址) 
						 
						manage_dhcp: 0 修改为 manage_dhcp: 1 (1意思就是由cobbler自动管理dhcpd) 
						 
						manage_rsync: 0 修改为 manage_rsync: 1 (1意思就是由cobbler自动管理rsync)  
					
						3.编辑/etc/httpd/conf/httpd.conf 
						  
						
							[root@server1 ~]# vim /etc/httpd/conf/httpd.conf 在LoadModule附近 添加以下行 
							LoadModule suexec_module modules/mod_suexec.so 
							LoadModule disk_cache_module modules/mod_disk_cache.so 
							LoadModule file_cache_module modules/mod_file_cache.so 
							LoadModule mem_cache_module modules/mod_mem_cache.so 
							LoadModule cgi_module modules/mod_cgi.so 
							LoadModule version_module modules/mod_version.so 
							LoadModule wsgi_module modules/mod_wsgi.so  <- 在这里添加这行  
						
							4.启动httpd和cobbler 
							  
							
								[root@server1 ~]# service httpd start 
								启动 httpd: [确定] 
								[root@server1 ~]# service cobblerd start 
								Starting cobbler daemon: [确定] 
								[root@server1 ~]#  
					
						5.编辑/etc/xinetd.d/rsync  
						  
						  
						
							[root@server1 ~]# vim /etc/xinetd.d/rsync 
							service rsync 
							{ 
							disable = no 修改yes 为 no(就是启用) 
							socket_type = stream
							wait = no
							user = root
							server = /usr/bin/rsync 
							server_args = --daemon 
							log_on_failure += USERID 
							}  
					
						6.编辑/etc/xinetd.d/tftp 
						  
						
							[root@server1 ~]# vim /etc/xinetd.d/tftp 
							service tftp 
							{ 
							socket_type = dgram
							protocol = udp
							wait = yes
							user = root
							server = /usr/sbin/in.tftpd 
							server_args = -s /tftpboot 
							disable = no 修改yes 为 no(就是启用) 
							per_source = 11
							cps = 100 2 
							flags = IPv4
							}  
					
						7.编辑/etc/cobbler/dhcp.template 
						  
						
							[root@server1 ~]# vim /etc/cobbler/dhcp.template 
							ddns-update-style interim; 
							 
							allow booting; 
							allow bootp; 
							 
							ignore client-updates; 
							set vendorclass = option vendor-class-identifier; 
							 
							subnet 192.168.0.0 netmask 255.255.255.0 { 
							option routers 192.168.0.1; 
							option domain-name-servers 192.168.0.1; 
							option subnet-mask 255.255.255.0; 
							range dynamic-bootp 192.168.0.10 192.168.0.20; 
							filename "/pxelinux.0"; 
							default-lease-time 21600; 
							max-lease-time 43200; 
							next-server $next_server; 
							} 
						
							8.执行检查 
							  
							  
							
								[root@server1 ~]# cobbler check 
								The following are potential configuration items that you may want to fix: 
								 
								1 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements. 
								2 : debmirror package is not installed, it will be required to manage debian deployments and repositories 
								3 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one 
								 
								Restart cobblerd and then run 'cobbler sync' to apply changes.  
							
								修复第1条: 
								  
								
									[root@server1 ~]# cobbler get-loaders 
									task started: 2012-12-09_055900_get_loaders 
									task started (id=Download Bootloader Content, time=Sun Dec 9 05:59:00 2012) 
									downloading http://dgoodwin.Fedorapeople.org/loaders/README to /var/lib/cobbler/loaders/README 
									downloading http://dgoodwin.fedorapeople.org/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo 
									downloading http://dgoodwin.fedorapeople.org/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot 
									downloading http://dgoodwin.fedorapeople.org/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux 
									downloading http://dgoodwin.fedorapeople.org/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi 
									downloading http://dgoodwin.fedorapeople.org/loaders/yaboot-1.3.14-12 to /var/lib/cobbler/loaders/yaboot 
									downloading http://dgoodwin.fedorapeople.org/loaders/pxelinux.0-3.61 to /var/lib/cobbler/loaders/pxelinux.0 
									downloading http://dgoodwin.fedorapeople.org/loaders/menu.c32-3.61 to /var/lib/cobbler/loaders/menu.c32 
									downloading http://dgoodwin.fedorapeople.org/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi 
									downloading http://dgoodwin.fedorapeople.org/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi 
									*** TASK COMPLETE ***  <-看到这就代表成功完成  |