您的位置:首页 > 运维架构

运维自动化之Cobbler系统安装详解(1)

2011-11-17 09:38 811 查看
转载自:http://os.51cto.com/art/201109/288604.htm
运维自动化安装方面,早期一般使用人工配置pxe+dhcp+tftp配合kickstart,现在开源工具 就多了,如cobbler,OpenQRM和Spacewalk。本文重点介绍Cobbler。和Kickstart不同的是,使用cobbler不会因 为在局域网中启动了dhcp而导致有些机器在重启服务器后启动终止。
AD:

【51CTO独家特稿】SA们现在都知道运维自动化的重要性,尤其是对于在服务器数量按几百台、几千台增加的公司而言,单单是装系统,如果不通过自动化来完成,根本是不可想象的。

运维自动化安装方面,早期一般使用人工配置pxe+dhcp+tftp配合kickstart,现在开源工具就多了,如cobbler,OpenQRM和Spacewalk。本文重点介绍Cobbler。

Cobbler介绍

Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows。该工具使用python开发,小巧轻便(才15k行代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP,DNS,以及yum包镜像。

Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用。



和Kickstart不同的是,使用cobbler不会因为在局域网中启动了dhcp而导致有些机器因为默认从pxe启动在重启服务器后加载tftp内容导致启动终止。

常用架构如下图:



cobbler的安装部署配置

cobbler安装环境准备

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

1, 安装epel

rpm -Uvh 'http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm'

2, 安装dhcp服务

yum -y install dhcp

3, 其他服务的安装

额外需要的服务还有tftp,rsync,xinetd,httpd。所以如果安装系统的时候如果这几个包没装上,请手动安装。

4,关闭selinux

关闭后最好重启一下,让selinux的设置生效

cobbler安装配置

1, cobbler安装

yum -y install cobbler

2, cobbler的配置

启动cobbler

# /etc/init.d/cobblerd start

启动httpd服务

# /etc/init.d/httpd start

检查配置,执行

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 : you need to set some SELinux content rules to ensure cobbler works correctly in your SELinux environment, run the following:
/usr/sbin/semanage fcontext -a -t public_content_t "/tftpboot/.*" && \
/usr/sbin/semanage fcontext -a -t public_content_t "/var/www/cobbler/images/.*"
4 : 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.
5 : change 'disable' to 'no' in /etc/xinetd.d/tftp
6 : change 'disable' to 'no' in /etc/xinetd.d/rsync
7 : since iptables may be running, ensure 69, 80, and 25151 are unblocked
8 : debmirror package is not installed, it will be required to manage debian deployments and repositories
9 : 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,编辑/etc/cobbler/settings文件,找到 server选项,修改为适当的ip地址,本实例配置ip为:192.168.10.1

2,编辑/etc/cobbler/settings文件,找到 next_server选项,修改为适当的ip地址,本实例配置ip为:192.168.10.1

3,SELinux的设置。如果上面已经关闭了SELinux就不用管了

4,执行 cobbler get-loaders,系统将自动下载loader程序,完成提示4的修复工作。

5,编辑/etc/xinetd.d/tftp文件,将文件中的disable字段的配置由yes改为no

6,编辑/etc/xinetd.d/rsync文件,将文件中的disable字段的配置由yes改为no

7,在iptables中将69,80,25151端口打开。如果仅仅只是在内部环境中使用,建议直接将防火墙关掉

8,提示说debmirror没安装。如果不是安装 debian之类的系统,此提示可以忽略,如果需要安装,下载地址为:

http://rpmfind.net/linux/rpm2html/search.php?query=debmirror[/code] CentOS 6使用RHEL 5的包就可以。

9,修改cobbler用户的默认密码,可以使用如下命令生成密码,并使用生成后的密码替换/etc/cobbler/settings中的密码。生成密码命令:

openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'

其中“random-phrase-here”为干扰码

所有提示全部fix之后,执行

/etc/init.d/cobblerd restart


1 2 3 4 下一页>>
内容导航

第 1 页:cobbler的安装部署配置第 2 页:cobbler的使用
第 3 页:Cobbler测试安装第 4 页:重装测试与使用心得
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: