默认的rhel 光盘中没有 cobbler 软件,必须使用第三方的软件源才能安装 cobbler 软件 。但是呢光是安装这一个软件包是不能帮助我们完成大批量安装这个工作滴。那么问题来了。看见这个标题有童鞋问了。为什么不用 Kickstart 部署呢?你这种部署有啥与众不同呢? Cobbler 批量部署的原理其实和 Kickstart 部署的原理有类似之处。 在此 就不予以深究,没有理解的童鞋请回顾 Kickstart 网络安装的原理以及实施方式。    直奔Cobbler 的主题吧,这才是今天讨论的重点。 Cobbler 项目最初在 2008 年左右发布。是红帽软件 Fedora 项目社区的一个子项目。是新一代网络安装套件可以快速建立网络安装环境。降低大批量部署安装的难度。兄弟们苦逼的日子来啦啊。 原因你懂的!

cobbler官方网站: https://fedorahosted.org/cobbler

Cobbler作为一个预备工具,使部署 RedHat/Centos/Fedora 系统更容易,同时也支持 Suse 和 Debian 系统的部署。(据说支持WINDOWS,还么测试哦。不过有个东西可以再LINUX上快速部署WIN系统。已经测试很成功。下回分享给大家)

它提供以下服务集成:

* PXE服务支持

* DHCP服务管理

* DNS服务管理

* Kickstart服务支持

* yum仓库管理

Cobbler客户端 Koan 支持虚拟机安装和操作系统重新安装。

Cobbler服务器部署:

1、 先 确保EPEL 仓库可用,如果不可用先安装 epel 包: 同时确保本地仓库也是可用的。 (确保机器可以联网)需要注意一点,注意 /var/www/cobbler  目录必须具有足够容纳  Linux  安装文件的空间 ( 移动,建软链接 ) 一本 5G 左右吧,但是你要同步不了 YUM 源了。这个后面再探讨。

# rpm -Uvh  http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

# wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

# rpm -ivh  epel-release-5-4.noarch.rpm

#yum list

2、安装 cobbler server 需要的的所有包:

# yum install cobbler httpd rsync tftp-server xinetd dhcp

修改 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

3、启动 httpd 和 cobblerd ,并设置为开机自启动:

# service httpd start

# service cobblerd start

chkconfig httpd on

chkconfig dhcpd on

sbin/chkconfig xinetd on

sbin/chkconfig tftp on

sbin/chkconfig cobblerd on

4、检查 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.

#修改 server 选项为主机名或是 IP 地址

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.

#修改 next-server 对应的 IP  地址

3 : Must enable a selinux boolean to enable vital web services components, run: setsebool -P httpd_can_network_connect true

#修改 SELINUX setsebool -P httpd_can_network_connect true

4 : you need to set some SELinux content rules to ensure cobbler serves content 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/p_w_picpaths/.*"

#修改 selinux 安全上下文标签

5 : you need to set some SELinux rules if you want to use cobbler-web (an optional package), run the following: /usr/sbin/semanage fcontext -a -t httpd_sys_content_rw_t "/var/lib/cobbler/webui_sessions/.*"

#修改   cobbler 对应的安全上下文标签

6 : 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   以获取 PXE 启动需要的文件

7 : change 'disable' to 'no' in /etc/xinetd.d/tftp

#开启 tftp

8 : change 'disable' to 'no' in /etc/xinetd.d/rsync

#开启 rsync

9 : since iptables may be running, ensure 69, 80, and 25151 are unblocked

#确保 69,80,25151 这个几个端口没有 iptables 阻止

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

# debian的镜像包没有安装,如果不安装 debian ,这条可忽略

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

# 要求使用以上命令行创建新的密码

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

# 没有安装 fencing 工具,

Restart cobblerd and then run 'cobbler sync' to apply changes.上面已经说的够清楚的了吧?你看懂了嘛?下面给出我的应对之策:

修正上面错误:

1)、 vi /etc/cobbler/settings

server: 192.168. 1.40    #设置 cobbler server 的 IP 地址

next-server: 192.168. 1 . 40   #设置 PXE server 的 IP 地址

manage_dhcp: 1   #开启管理 DHCP 服务

default_kickstart: /var/lib/cobbler/kickstarts/default.ks    #设置默认的 kickstart 配置文件,用 system-config-kickstart (需要 图形 环境)生成 。直接写得了。

2)、关闭防火墙和 SElinux

3)、获取启动镜像

# cobbler get-loaders

4)、启动 tftp 和 rsync

vi /etc/xinetd.d/tftp

将disable                 = yes 改为: disable                 = no

vi /etc/xinetd.d/rsync

将disable                 = yes 改为: disable                 = no

重启xinetd 服务:

/etc/init.d/xinetd restart

5)、修改 DHCP 模板,确保 DHCP 分配的地址和 Cobbler 在同一网段 (这个可用不这么做。你可以直接架设一个 DHCP)

vi

/etc/cobbler/dhcp.template

# ******************************************************************

# Cobbler managed dhcpd.conf file

#

# generated from cobbler dhcp.conf template ($date)

# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes

# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be

# overwritten.

#

# ******************************************************************

ddns-update-style interim;

allow booting;

allow bootp;

ignore client-updates;

set vendorclass = option vendor-class-identifier;

subnet 192.168. 1 .0 netmask 255.255.255.0    {

option routers             192.168. 1 . 254 ;

# option domain-name-servers 192.168. 1.1 ;

option subnet-mask         255.255.255.0;

range dynamic-bootp        192.168. 1 .100 192.168. 1 .200;

filename                   "/pxelinux.0";

next-server                $next_server;

default-lease-time         21600;

max-lease-time             43200;

}

#for dhcp_tag in $dhcp_tags.keys():

## group could be subnet if your dhcp tags line up with your subnets

## or really any valid dhcpd.conf construct ... if you only use the

## default dhcp tag in cobbler, the group block can be deleted for a

## flat configuration

# group for Cobbler DHCP tag: $dhcp_tag

group {

#for mac in $dhcp_tags[$dhcp_tag].keys():

#set iface = $dhcp_tags[$dhcp_tag][$mac]

host $iface.name {

hardware ethernet $mac;

#if $iface.ip_address:

fixed-address $iface.ip_address;

#end if

#if $iface.hostname:

option host-name "$iface.hostname";

#end if

#if $iface.subnet:

option subnet-mask $iface.subnet;

#end if

#if $iface.gateway:

option routers $iface.gateway;

#end if

filename "$iface.filename";

## Cobbler defaults to $next_server, but some users

## may like to use $iface.system.server for proxied setups

next-server $next_server;

## next-server $iface.next_server;

}

#end for

}

#end for

5、同步 cobbler 配置,使修改生效:

# cobbler sync

6、挂载 Linux 光盘 ,生成安装镜像:

# mount /dev/cdrom /mnt/

# cobbler import --path=/mnt/ --name= RHEL5.6-x86-64

7、 RPM 仓库管理 (根据需要自己决定吧)

相关阅读:https://fedorahosted.org/cobbler/wiki/ManageYumRepos

我们可以为cobbler 添加 RPM 仓库:

cobbler repo add --name=  RHEL5.6-x86-64   --mirror= http://mirrors.163.com/centos/5/os/x86_64/

cobbler repo add --name= EPEL5.-x86-64    --mirror= http://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/

同步仓库到本地:

cobbler reposync

也可以通过设置--mirror-locally=0 不下载到本地,而通过 kickstart server 去仓库下载 rpm 包。

添加计划任务,每天凌晨两点进行一次同步:

crontab -e

0 2 * * * cobbler reposync --tries=3 --no-fail

8、设置 profile 和 system (这个功能比较牛 P。需要深入研究哈)

profile可以理解为按角色进行分类。

cobbler profile add --name=webserver --distro=CentOS-5-i386 --repos=EPEL-5-i386 --kickstart=/var/lib/cobbler/kickstarts/webserver.ks

system是对待安装机器做具体设置,如设置主机名、 IP 地址、 hostname 等,这些设置根据 MAC 应用到具体机器上。

# cobbler system add --name=webserver1 --ip=192.168.0.110 --mac=00:0C:29:77:89:c7 --profile=webserver --kickstart=/var/lib/cobbler/kickstarts/webserver.ks --static=1

# cobbler system edit --name=webserver1 --dns-name=webserver1.grid.house.sina.com.cn --hostname=webserver1.grid.house.sina.com.cn

cobbler system edit --name=webserver1 --gateway=192.168.0.1 --subnet=255.255.255.0

cobbler system edit --name=webserver1 --interface=eth1 --static=0

可以通过访问http://192.168.0.2/cblr/svc/op/ks/system/webserver1 来查看真正的 kickstart 配置。

9、启动待安装的服务器,开始安装。

10、重新安装

yum install koan

koan --server=192.168. 1 . 40  --list=profiles

koan --replace-self --server=192.168. 1 . 40  --profile=webserver

reboot

11、设置 Cobbler web 界面

Cobbler web界面是一个很好的前端,非常容易管理很多 Cobbler 操作。可以用它列出和编辑distros, profiles, subprofiles, systems, repos and kickstart 文件。

安装Cobbler web :

yum install cobbler-web

Cobbler web界面访问地址:

http://192.168. 1.40 /cobbler_web/

(192.168. 1.40 为Cobbler web server 地址)

设置用户名密码:

为已存在的用户重置密码:

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

添加新用户:

htdigest /etc/cobbler/users.digest "Cobbler"  username

设置/etc/cobbler/modules 如下:

[authentication]

module = authn_configfile

[authorization]

module = authz_allowall

重启Cobbler 服务:

service cobblerd restart

12、 Cobbler 命令说明

cobbler check - 核对当前设置是否有问题

cobbler list - 列出所有的 cobbler 元素

cobbler report - 详细的列出个元素

cobbler sync - 同步配置到 dhcp/pxe 和数据目录

cobbler reposync - 同步 yum 仓库

13、 Cobbler 配置文件说明

Cobbler配置文件存放在 /etc/cobbler 下。 /etc/cobbler/settings 为主配置文件;在 /etc/cobbler 下你还能看到 dhcp 、 dns 、 pxe 、 dnsmasq 的模板配置文件; /etc/cobbler/users.digest 为用于 web 访问的用户名密码配置文件; /etc/cobbler/modules.conf  为模块配置文件;/etc/cobbler/users.conf 为 Cobbler WebUI/Web service 授权配置文件。

Repo数据目录 /var/www/cobbler

导入的发行版,repos 镜像和 kickstart 文件都放置在 /var/www/cobbler 目录下。确保 /var 目录有足够的空间来存储这些文件。

p_w_picpaths/ - 存储所有导入发行版的 Kernel 和 initrd 镜像用于远程网络启动

ks_mirror/ - 存储导入的发行版

repo_mirror/ - yum repos存储目录

/var/log/cobbler用于存放日志文件 /var/log/cobbler/cobbler.log

Cobbler数据目录 /var/lib/cobbler ,此目录存储和 Cobbler profiles 、 systems 、 distros 相关的配置。

configs/ - 此目录用于存储 distros 、 repos 、 systems 和 profiles 相关信息

backup/ - 备份目录

snippets/  - 用于放置一些可以在 kickstarts 导入的脚本小片段

triggers/  - 此目录用来放置一些可执行脚本

kickstarts/  - 此目录用来放置 kickstart 模板文件

与Puppet 整合进行配置管理: 这个功能后续在研究吧。先写到这里。感谢你的支持。

参考文献:

https://fedorahosted.org/cobbler/

http://candon123.blog.51cto.com/704299/596302

http://hi.baidu.com/lenvol/blog/item/8e8b123d038f98fb55e72342.html

https://fedorahosted.org/cobbler/wiki/CobblerWebInterface

http://kugoou.8bbs.cn/script/forum/view.asp?article_id=35137766

http://consultancy.edvoncken.net/index.php/HOWTO_Configure_Cobbler_on_Fedora_or_Red_Hat#Red_Hat_or_CentOS

http://www.iteye.com/topic/642690

http://myhat.blog.51cto.com/391263/684485

转载于:https://blog.51cto.com/susir/755672

批量部署Linux操作系统的一场革命----Cobbler相关推荐

  1. PXE实现批量部署linux系统

    pxe批量部署linux服务器 1.pxe介绍 PXE是有intel设计的协议,它可以使计算机通过网络启动,协议分为client和server两端,PXEclient在网卡的ROM中,当计算机引导时, ...

  2. ubuntu linux 批量部署,使用Cobbler批量部署Linux和Windows:CentOS/Ubuntu批量安装(二)...

    通过前面服务端的部署,已经配置好了 Cobbler Server 端,接下来开始进行 CentOS/Ubuntu 的批量安装,在进行 CentOS/Ubuntu 批量安装时,也需要通过Cobbler来 ...

  3. PXE批量部署linux操作系统

    前言 在实际生产环境中,有时候我们会碰到为几十上百甚至上千台服务器安装Linux操作系统的需求,如果我们还是常规的去使用移动介质逐台安装,显然是一件低效又令人抓狂的事情,那要安装到何年何月啊?这对于我 ...

  4. cobbler命令_使用Cobbler批量部署Linux和Windows:Windows系统批量安装(三)

    说明:时不时会有读者就遇到的一些问题留言或者私信询问解决方法,但本人对 Desktop运维.PE镜像等并不熟悉了解,这篇文章是我曾经一时出于工作需要而进行的研究,因此很多问题我也不了解,故而无法解答, ...

  5. 使用Cobbler批量部署Linux和Windows

    说明:时不时会有读者就遇到的一些问题留言或者私信询问解决方法,但本人对 Desktop运维.PE镜像等并不熟悉了解,这篇文章是我曾经一时出于工作需要而进行的研究,因此很多问题我也不了解,故而无法解答, ...

  6. linux 批量启动服务器,批量部署Linux操作系统systemimager 使用

    systemimager 可以把一个所有软件都安装完成的系统(黄金客户端)镜像到server 端, 在通过PXE 启动,再同过rsync同步到裸机上 因为systemimager大部分由perl编写, ...

  7. linux 虚拟机大量udp请求失败_利用PXE远程装机服务批量部署Linux

    1.安装并配置DHCP服务器 (要先安装yum源) yum -y install dhcp cd /usr/share/doc/ cd dhcp-4.2.5/ 拷贝example文件到另一目录并覆盖: ...

  8. linux ipxe 自动windows,PXE批量部署Linux五:使用iPXE代替PXELINUX

    PXELINUX基本已经没有人在维护了,iPXE在支持HTTP等高级传输协议的同时还支持动态语言php之类的解析,同时还可以烧录在网卡上替代网卡出厂设置. 唯一比PXELINUX复杂的是这玩意需要自己 ...

  9. linux批量安装系统uefi,PXE批量部署Linux之四:一台服务器同时支持BIOS和UEFI

    dnsmasq选(bu)项(hui)简(pei)单(zhi),这里换高级的DHCP,同时搭建tftp服务器 因为uefi和bios平台用到的vesamenu.c32文件不同,我们重新规划tftp目录如 ...

最新文章

  1. Java虚拟机性能监控工具草览
  2. CVPR2022最新106篇论文整理|包含目标检测、动作识别、图像处理等32个方向
  3. Android UI开发第五篇——自定义列表
  4. odoo开发笔记:前端显示强制换行
  5. 异常处理——Logging initialized using configuration in jar:file:/usr/local/apache-hive-2.3.4/lib/hive-comm
  6. 数据结构(七)排序---直接插入排序(稳定)
  7. drbd相关知识点解析
  8. 职员)2015-11-09 星期一 日志
  9. 【动态规划】状压dp:蓝桥2020补给(旅行商问题)
  10. ZOJ 3993 2017CCPC秦皇岛 M:Safest Buildings
  11. matlab寻找直线_matlab寻找直线_Matlab 霍夫变换 ( Hough Transform) 直线检测
  12. marlin固件烧录教程_marlin固件中文(marlin固件下载)
  13. GNSS-SINEX文件格式简介
  14. 新点互联互通_新点驱动(江苏省互联互通版)
  15. Leetcode广度优先搜索笔记2 腐烂的橘子
  16. 《迷人的8051单片机》——导读
  17. 利用百度AI接口实现车牌识别功能(一)
  18. 电子签名生成的图片为空白,以及生成透明底签名图片转为白色底
  19. arm裸机程序启动流程
  20. Android 是Google开发的基于Linux平台的开源手机操作系统

热门文章

  1. tyvj1202 数数食物链
  2. 什么样的数据才有价值?应该怎样收集和处理?终于有人讲明白了
  3. 柱状图用腻了?玉玦图给你更美的数据呈现
  4. linux内核源码目录分析
  5. 接口并发如何模仿用户点击率和提交率_洞察| 五大法则揭秘!在抖音如何打造“爆款”?...
  6. python元组和列表字典_python:列表、元组和字典
  7. python 函数图_如何查看Python函数调用图 Ubuntu
  8. 求你了,别再随便打日志了,教你动态修改日志级别!
  9. WePY,微信小程序开发利器,进一步简化小程序开发难度
  10. Navicat for MySQL 使用SSH方式链接远程数据库