Cobbler安装指南

系统:CentOS 6.4 X86_64
软件:Cobbler 2.2.3、2.4.0
一、配置EPEL
rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
 
二、安装Cobbler
# yum -y install cobbler
# /etc/init.d/httpd start
# /etc/init.d/cobblerd start
# chkconfig --add httpd
# chkconfig --level 2345 httpd on
# chkconfig --add cobblerd
# chkconfig --level 2345 cobblerd  on
 
三、配置cobbler
# cobbler check
The following are potential configuration items that you may want to fix:
 
1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work.  This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : 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.
4 : change 'disable' to 'no' in /etc/xinetd.d/rsync
5 : since iptables may be running, ensure 69, 80/443, and 25151 are unblocked
6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
7 : ksvalidator was not found, install pykickstart
8 : 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
9 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
 
Restart cobblerd and then run 'cobbler sync' to apply changes.
 
1. 定义源服务器(server)和tftp服务器(next_server)
# vim /etc/cobbler/settings
next_server: 10.0.65.14
server: 10.0.65.14
 
2.下载网络引导程序
[root@mirrors ~]# cobbler get-loaders
task started: 2013-03-16_081953_get_loaders
task started (id=Download Bootloader Content, time=Sat Mar 16 08:19:53 2013)
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 ***
[root@mirrors ~]#
 
3.开启rsync和tftp
rsync配置:
# vim /etc/xinetd.d/rsync
service rsync
{
        disable = no  #将yes修改为no
        flags           = IPv6
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID
}
 
tftp配置:
# vim /etc/xinetd.d/tftp
service tftp
{
        disable                 = no #将yes修改为no
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -B 1380 -v -s /var/lib/tftpboot
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

启动xinetd服务: 
#/etc/init.d/xinetd restart
#chkconfig --level 2345 xinetd on

4.开启防火墙端口
tftp:udp 69
dhcp:udp 67
http:tcp 80,443 (443为cobbler-web使用)
cobbler vpi:tcp 25251(可选)
rsync:tcp 873
 
#iptables -I INPUT -p udp -m multiport --dport 67,69 -j ACCEPT
#iptables -I INPUT -p tcp -m multiport --dport 80,443,25151,873 -j ACCEPT
 
5.安装扩展工具
# yum -y install debmirror
# yum -y install pykickstart
# yum -y install cman fence-agents
 
6.设置系统的初始密码
# openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'
 
修改/etc/cobbler/settings文件中的default_password_crypted内容。
 
7.修改debmirror.conf文件
2 : comment 'dists' on /etc/debmirror.conf for proper debian support
3 : comment 'arches' on /etc/debmirror.conf for proper debian support
注释掉以下两行:
# vim /etc/debmirror.conf
#@dists="sid";
#@arches="i386";
 
8.配置dhcp
# yum -y install dhcp
 
修改cobbler配置,使用cobbler管理dhcp:
# vim /etc/cobbler/settings
manage_dhcp: 1
 
修改dhcp配置:只需要修改上部分,group下面的默认即可,这里为两个网段提供dhcp服务
# vim /etc/cobbler/dhcp.template
ddns-update-style interim;
allow booting;
allow bootp;
ignore client-updates;
option subnet-mask         255.255.255.0;
filename                   "/pxelinux.0";
next-server                $next_server;
default-lease-time         21600;
max-lease-time             43200;
set vendorclass = option vendor-class-identifier;
subnet 10.0.65.0 netmask 255.255.255.0 {
     option routers             10.0.65.1;
     range dynamic-bootp        10.0.65.243 10.0.65.247;
}
 
subnet 10.0.37.0 netmask 255.255.255.0 {
     option routers             10.0.37.1;
     range dynamic-bootp        10.0.37.230 10.0.37.239;
}
 
如服务器有多个网卡,修改dhcp监听网卡:
# vim /etc/sysconfig/dhcpd
DHCPDARGS= eth1  #监听在eth1网卡
 
9.同步配置
重启cobblerd,使修改的配置生效:
# /etc/init.d/cobblerd restart
 
同步配置:
# cobbler sync
 
四、导入光盘镜像
1.挂载光盘镜像
#mount -o loop /data/software/iso/CentOS-6.3-x86_64-bin-DVD1.iso /media/
 
2.使用import进行导入
# cobbler import --arch=x86_64 --breed=redhat --os-version=rhel6 --path=/media/ --name=CentOS6.3
 
3.创建profile,关联distro和kickstart file(可选)
# cobbler profile add --name=CentOS6.3-KVM --distro=CentOS6.3 --kickstart=/var/lib/cobbler/kickstarts/ks_centos6.3_kvm.cfg
 
五、错误
# /etc/init.d/cobblerd restart
Stopping cobbler daemon: [FAILED]
Starting cobbler daemon: Traceback (most recent call last):
File "/usr/bin/cobblerd", line 76, in main
api = cobbler_api.BootAPI(is_cobblerd=True)
File "/usr/lib/python2.6/site-packages/cobbler/api.py", line 127, in __init__
module_loader.load_modules()
File "/usr/lib/python2.6/site-packages/cobbler/module_loader.py", line 62, in load_modules
blip = __import__("modules.%s" % ( modname), globals(), locals(), [modname])
File "/usr/lib/python2.6/site-packages/cobbler/modules/authn_pam.py", line 121, in <module>
PAM_START = LIBPAM.pam_start
File "/usr/lib64/python2.6/ctypes/__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "/usr/lib64/python2.6/ctypes/__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/bin/python: undefined symbol: pam_start
[ OK ]
 
解决:关闭selinux
临时:#setenforce 0
永久:#vim /etc/sysconfig/selinux
             SELINUX=disabled
 
没有启动httpd出错:
httpd does not appear to be running and proxying cobbler, or SELinux is in the way. Original traceback:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 184, in check_setup
s.ping()
File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib64/python2.6/xmlrpclib.py", line 1235, in request
self.send_content(h, request_body)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1349, in send_content
connection.endheaders()
File "/usr/lib64/python2.6/httplib.py", line 908, in endheaders
self._send_output()
File "/usr/lib64/python2.6/httplib.py", line 780, in _send_output
self.send(msg)
File "/usr/lib64/python2.6/httplib.py", line 739, in send
self.connect()
File "/usr/lib64/python2.6/httplib.py", line 720, in connect
self.timeout)
File "/usr/lib64/python2.6/socket.py", line 567, in create_connection
raise error, msg
 
解决:启动httpd
# /etc/init.d/httpd start
 
六、安装web管理端
1、安装软件包
yum -y install cobbler-web.noarch
2、修改modules.conf配置文件
#vim /etc/cobbler/modules.conf
[authentication]
module = authn_configfile
 
[authorization]
module = authz_allowall
 
3、设置账号和密码
htdigest /etc/cobbler/users.digest "Cobbler" admin
4、重启服务
/etc/init.d/cobblerd restart
/etc/init.d/httpd restart

登录界面:
http://10.1.6.21/cobbler_web

 


来自为知笔记(Wiz)


你可能感兴趣的:(Cobbler安装指南)