运维自动化部署Cobbler之服务安装篇

运维 系统运维 自动化
通过 cobbler,可以实现对RedHat/Centos/Fedora系统的快速部署,同时也支持Suse 和Debian(Ubuntu)系统。本文详尽描述了运维自动化部署Cobbler的安装过程,一起学习一下。

  [[70832]]

一、概述

  服务最好安装在 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)系统。

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

  相关配置参数:

  官方文档 : 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 ) 的大力支持和解惑,在编写此文时,也借鉴了部分沙克老师的文章,特此感谢。

责任编辑:黄丹 来源: 博客
相关推荐

2013-04-11 17:31:28

运维自动化Cobbler

2011-09-01 10:22:03

Cobbler运维自动化

2014-05-16 14:31:55

运维自动化Cobbler

2014-08-04 10:10:35

IT运维自动化运维

2016-03-30 11:53:51

Cobbler运维运维自动化

2013-04-16 14:55:21

自动化运维Puppet实战

2014-09-22 11:24:18

运维

2012-05-05 21:28:44

2012-10-22 14:54:48

2012-05-05 22:27:46

puppet自动化运维

2012-05-05 21:48:43

puppet自动化运维

2010-08-12 17:39:07

网站运维自动化管理

2012-05-05 21:43:27

puppet自动化运维

2017-03-22 18:30:44

Linux运维自动化ansible

2018-06-23 07:31:05

2012-05-05 21:03:35

puppet自动化运维

2017-03-22 16:31:30

Linux运维自动化ansible

2015-03-09 11:10:14

运维

2017-10-13 13:14:35

互联网

2012-05-05 22:10:13

puppet自动化运维
点赞
收藏

51CTO技术栈公众号