Mysql2009 发表于 2012-05-02 14:10

Cobbler 的使用

一个简短的关于 cobbler 的介绍,点击这里。

母机环境为 CentOS-5.6-x86_64。google 看 cobbler,夸赞他的人很多,大致就是将网络环境安装的难度降低到 ”cobbler“ 的水平了,虽说夸张了些,但是跟 pxe 等一系列工具组合使用对比来看 ,在配置难度上略微降低。

使用 epel 源安装 cobbler:

# rpm -ivh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# yum install cobbler httpd tftp-server dhcp xinetd

修改 tftp:

# sed '/disable/s/no/yes/g' /etc/xinetd.d/tftp
# sed '/disable/s/no/yes/g' /etc/xinetd.d/rsync
# /etc/init.d/xinetd restart

修改 cobbler 的配置:

# vi /etc/cobbler/settings

将 server 段即本机的地址;next_server 段表示的是 dhcp 的地址,将二者都设置成本机的 ip;将 manage_dhcp 置为 1。

default_kickstart 字段默认是 /var/lib/cobbler/kickstarts/default.ks。而该文件默认为空,需要自己配置。

在做了任何有关 cobbler 的修改后,需要执行:

# cobbler sync

修改 cobbler 中的 dhcp 模版,通过该模版会生成 /etc/dhcpd.conf 文件:

# vi /etc/cobbler/dhcp.template

ddns-update-style interim;

allow booting;
allow bootp;

ignore client-updates;
set vendorclass = option vendor-class-identifier;

subnet 10.18.101.0 netmask 255.255.255.0 {
option routers             10.18.101.254;
option domain-name-servers 8.8.4.4;
option subnet-mask         255.255.255.0;
range dynamic-bootp      10.18.101.240 10.18.101.250;
filename                   "/pxelinux.0";
default-lease-time         21600;
max-lease-time             43200;
next-server                $next_server;
}

检查 cobbler 的配置,根据出现的提示进行接下来的步骤:

# cobbler check
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, and 25151 are unblocked
6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
7 : 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
8 : 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.

挂载 iso 镜像,制作 cobbler 源:

# mount -o loop CentOS-5.6-x86_64.iso /mnt
# cobbler import –path=/mnt–name=CentOS-5-x86_64

注意:cobbler 默认是在 /var/www/cobbler 下建立源,所以 /var 需要足够大。

kickstart 文件默认在 /var/liv/cobbler/kickstarts/ 目录中,该步骤可以参考前面的 kickstart 配置。可以在下面的链接中看到写的 kickstart 文件:

http://10.18.101.252/cblr/svc/op/ks/system/xen-215

注意:将原来的 nfs 方式换成 http:

url –url=http://10.18.101.252/cobbler/ks_mirror/CentOS-5-x86_64

重启 cobbler,生效:

# /etc/init.d/cobblerd restart

建立相应的 profiles,systems:
# cobbler profile add –name=xen-215 –distro=CentOS-5-x86_64 –kickstart=/var/lib/cobbler/kickstarts/xen-215.ks
# cobbler system add –name=xen-215 –mac=00:00:22:22:33:33 –profile=xen-215

列出 cobbler 的所有元素:

# cobbler list
distros:
CentOS-5-x86_64
CentOS-5-xen-x86_64

profiles:
CentOS-5-x86_64
CentOS-5-xen-x86_64
webserver
xen-215

systems:
webserver1
xen-215

repos:
centos-5.6-x86_64

images:

在原系统上安装安装 koan 这个客户来完成一些诸如重装系统等的事情:

# yum install koan

列出服务器上的 profiles:

# koan –server=10.18.101.252 –list=profiles

重新安装系统:

# koan –replace-self –server=10.18.101.252 –profile=xen-215
可以安装 cobbler-web,功能很强大,”数形结合“有助理解:

# yum install cobbler-web

添加新用户以及登陆密码:

# htdigest /etc/cobbler/users.digest "Cobbler" jaseywang

修改认证方式:

# vi /etc/cobbler/modules.conf

module = authn_configfile

module = authz_allowall   

这里是一篇如何使用 cobbler 安装 CentOS 6 的教程。

参考:
http://mdehaan.fedorapeople.org/screencasts/cobbler.htm

http://jaseywang.me/2011/08/16/cobbler-%E7%9A%84%E4%BD%BF%E7%94%A8/

jmyychen 发表于 2012-05-02 15:21

楼主辛苦了,谢谢分享
页: [1]
查看完整版本: Cobbler 的使用