卡饭网 > 其他 > 正文

运维自动化部署Cobbler的安装过程

来源:本站整理 作者:梦在深巷 时间:2013-05-09 18:20:56

一、概述

服务最好安装在 Centos下,它需要Python支持。

Cobbler服务是一个容器,它整合了以下几个开源软件:

1 Dhcp

2 Dns (可选bind,dnsmasq)

3 Kickstart/PXE

4 Apache(提供kickstart 的安装源,并提供定制化的kickstart配置)

5 Tftp (PXE启动时需要)

同时,它和apache做了深度整合。通过 cobbler,可以实现对RedHat/Centos/Fedora系统的快速部署,同时也支持Suse 和Debian(Ubuntu)系统。

综上所述,一个理想的安装环境是:

运维自动化部署Cobbler的安装过程

相关配置参数:

运维自动化部署Cobbler的安装过程

官方文档 : https://github.com/cobbler/cobbler/wiki/

二、 安装

1) 定义 Yum源

可根据自己所在地选择离自己近的镜像源,比如mirrors.163.com或mirrors.sohu.com

相关配置文件: /etc/yum.repos.d/CentOS-Base.repo

2) 安装 epel源

Centos5 32位: rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/5/i386/epel-release-5-4.noarch.rpm

Centos5 64位: rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm

Centos6 32位: rpm -Uvh 'http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-7.noarch.rpm'

Centos6 64位: rpm -Uvh 'http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm'

确定是否正确安装 :

yum list|grep -E "^epel"

epel-release.noarch 5-4 installed

也可以用这个命令: rpm -qa |grep -i epel

3) 安装cobbler服务

A) yum -y install cobbler

确认是否正确安装 :

rpm -qa |grep -i cobbler

B) 安装其它需要的服务

yum -y install cman tftp-server dhcp cobbler cobbler-web bind pykickstart rsync

根据需要来,比如 我的测试环境不需要bind,就没有安装

需要确认 mod_wsgi已经正确安装,否则需要手动安装

yum -y install mod_wsgi

确认apache配置已经 加载wsgi_module: /etc/httpd/conf.d/wsgi.conf

4) 安装debmirror

debmirror 可以用来下载 ubuntu 12.04的镜像源 来做本地源.

目前debmirrors, 只能使用rpm包安装, 先装依赖包

yum -y install ed patch perl perl-Compress-Zlib perl-Cwd perl-Digest-MD5 perl-Digest-SHA1 perl-LockFile-Simple perl-libwww-perl

安装debmirrors :

rpm -Uvh 'http://mirrors.ustc.edu.cn/fedora/epel/5Server/x86_64/debmirror-20090807-1.el5.noarch.rpm'

5) 关闭selinux 和防火墙

sed -i '/^SELINUX=/ s/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config

setenforce 0

//为调试方便,暂时关闭防火墙

service iptables stop

6) 启动Cobbler服务

/etc/init.d/cobblerd start

7) 可能会缺少的包:

请注意察看 cobbler服务启动的报错信息,我第一次安装时候就遇到有关 ctypes的报错,只能手动安装:

yum -y install python-ctypes

8) Cobbler相关配置

根据需要修改 cobbler主配置文件: /etc/cobbler/settings

//cobbler监听IP是 192.168.100.1

sed -i 's/server: 127.0.0.1/server: 192.168.100.1/g' /etc/cobbler/settings

//pxe安装 只允许一次,防止误操作 ( 在正式环境有用。实际测试来看,这个功能可以屏蔽掉 )

sed -i 's/pxe_just_once: 0/pxe_just_once: 1/g' /etc/cobbler/settings

//dhcp 服务的IP地址,PXE过程中 会用到

sed -i 's/next_server: 127.0.0.1/next_server: 192.168. 100.1 /g' /etc/cobbler/settings

//支持 对的dhcp管理,在做自定义配置时,需要修改dhcp相关配置,以配合PXE启动用

sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings

9) 进行cobbler系统检查

cobbler check

可自动 检查安装环境是否满足cobbler服务的需要

出现如下结果提示:

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.

//解决办法 : 执行 cobbler get-loaders

2 : since iptables may be running, ensure 69, 80/443, and 25151 are unblocked

//解决办法 : iptables 保证对 69 80 443 25151 端口的 数据没有限制,如果仅仅只是在内部环境中使用,建议直接将防火墙关掉

3 : debmirror package is not installed, it will be required to manage debian deployments and repositories

//解决办法 : debian 安装用,暂时可以不管;如果需要安装,下载地址为:http://rpmfind.net/linux/rpm2html/search.php?query=debmirror

4 : 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

//解决办法 : 默认加密的密码,可以修改

5 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

//解决办法 : 关于电源管理(跟DELl 远程控制协议类似东西?),也暂时不管。

10)重启 cobbler,并更新相关配置

//重启服务

/etc/init.d/cobblerd restart

//同步最新cobbler配置,它会根据配置自动修改dhcp,bind 等服务,因此我称之为容器的原因。

cobbler sync

注:在 对cobbler进行研究的整个过程中,得到了前辈陈沙克老师( www.chenshake.com ) 的大力支持和解惑,在编写此文时,也借鉴了部分沙克老师的文章,特此感谢。

相关推荐