cobbler全自动批量安装部署linux
Cobbler的设计方式:
Cobbler的配置结构基于一组注册的对象。每个对象表示一个与另一个实体相关联的实体(该对象指向另一个对象,或者另一个对象指向该对象)。当一个对象指向另一个对象时,它就继承了被指向对象的数据,并可覆盖或添加更多特定信息。以下对象类型的定义
Distros(发行版):表示一个操作系统,它承载了内核和initrd的信息,以及内核参数等其他数据
Profile(配置文件):包含一个发行版、一个kickstart文件以及可能的存储库,还包含更多特定的内核参数等其他数据
Systems(系统):表示要配给的额机器。它包含一个配置文件或一个景象,还包含IP和MAC地址、电源管理(地址、凭据、类型)、(网卡绑定、设置valn等)
Repository(镜像):保存一个yum或rsync存储库的镜像信息
Image(存储库):可替换一个包含不属于此类比的额文件的发行版对象(例如,无法分为内核和initrd的对象)。
基于注册的对象以及各个对象之间的关联,Cobbler知道如何更改文件系统以反应具体配置。因为系统配置的内部是抽象的,所以您可以仅关注想要执行的操作。

Cobbler流程图如下:

1、安装cobbler和所需组件
cobbler可以手动编译安装,也可以基于yum源的安装,如果使用yum源安装,则需要配置epel源epel源可以通过下载官网的epel源的目录来实现。由于cobbler是由python而写,所以还要安装python环境。
https://fedoraproject.org/wiki/EPEL/zh-cn
# yum -y install cobbler cobbler-web pykickstart debmirror cman createrepo httpd dhcp xinted tftp-server rsync python
2、配置cobbler依赖的服务,本次操作使用cobbler来管理这些依赖服务,即使用cobbler提供的模板配置文件。
cobbler可行管理这些服务中的部分甚至全部,但需要配置/etc/cobbler/settings文件中的“manager_dhcp”、 “manage_tftpd”、“manage_rsync”、“manage_dns”来定义,同时各种服务都有着不同的实现方式,如果进行自定义,需要通过修改/etc/cobbler/modules.conf配置文件中各个服务的模块参数的值来实现。
#在Cobbler主配置文件/etc/cobbler/settings设置开启自带的dhcp服务开关
# sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
# sed -i 's/manage_tftpd: 0/manage_tftpd: 1/g' /etc/cobbler/settings
# sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings
# sed -i 's/pxe_just_once: 0/pxe_just_once: 1/g' /etc/cobbler/settings
按环境需求编辑以下dhcp模板文件部分内容
# vim /etc/cobbler/dhcp.template
subnet 172.16.65.0 netmask 255.255.255.0 {
option routers 172.16.65.1;
option domain-name-servers 8.8.8.8;
option subnet-mask 255.255.255.0;
range dynamic-bootp 172.16.65.100 172.16.65.200;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
3、检查配置文件,需要在启动httpd服务的前提下检查
#service httpd start
#service cobblerd start
#cobbler sync #让cobbler接管所依赖的服务,应用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.
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 : comment out 'dists' on /etc/debmirror.conf for proper debian support
6 : comment out 'arches' on /etc/debmirror.conf for proper debian support
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.
以上8个问题的解决方法
1.修改/etc/cobbler/settings文件中的server参数的值为提供cobbler服务的主机对应的ip地址
2.修改/etc/cobbler/settings文件的next_server参数的值为提供PXE服务的主机的ip
#sed -i 's/next_server: 127.0.0.1/next_server: 172.16.65.222/g' /etc/cobbler/settings
3.如果当前节点可以访问互联网,执行“cobbler get-loaders”命令下载pxelinux.0,menu.c32,elibo.efi,yaboot文件,否则则需要安装syslinux程序 包,复制/usr/share/syslinux/中的pxelinux.0,menu.c32等文件至/var/lib/cobbler /loaders目录中
4.将/etc/xinetd.d/rsync 中的disable改为no
#sed -i '/disable/s/yes/no/g' /etc/xinetd.d/rsync
#sed -i '/disable/s/yes/no/g' /etc/xinetd.d/tftp
5.注释/etc/debmirror.conf文件中的@dists="sid";一行
6.注释/etc/debmirror.conf文件中的@arches="i386";一行
# sed -i 's/@dists=\"sid\";/#@dists=\"sid\";/g' /etc/debmirror.conf
# sed -i 's/@arches=\"i386\";/#@arches=\"i386\";/g' /etc/debmirror.conf
7.执行 openssl passwd -1 -salt 'haha' '123456' 生成密码 其中haha为随意给出的干扰码,并将密码串替换掉/etc/cobbler/settings中的default_password_crypted
default_password_crypted: "$1$haha$T7nt1ThchynsrEviA0KLT0" #该密码即创建完成后新装系统的root密码
8.安装cam和fence-agents来实现电源管理
4、同步数据,与此同时同步配置文件到dhcp服务器,并自动重新启动dhcp服务。
# /etc/init.d/xinetd restart
# service cobblerd restart
# cobbler sync #每次对各依赖服务的配置进行修改完毕后都需要执行此命令进行同步生效,尤其是dhcp服务被接管后,更改dhcp配置的话,应该配 置/etc/cobbler/dhcp.template文件,否则如果每次执行cobbler sync同步的话,/etc/dhcp/dhcpd.conf会被覆盖。
5、导入系统镜像到cobbler
# mount /dev/cdrom /media
# cobbler import --name=centos6.5-x86-64 --path=/media/
6、设置profile,使用自定义的ks文件进行全自动安装
# cobbler profile edit --name=centos-6.5-x86_64 --distro=centos-6.5-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos65.ks
profile默认是采用 /var/lib/cobbler/kickstarts/sample_end.ks 模板文件作为ks文件,而不是default.ks
此至,cobbler全部安装完毕,可以进行客户端服务器系统PXE安装了。
以下为详细说明:
在第一次导入系统镜像时,cobbler会给安装镜像指定一个默认的kickstart自动安装文件
例如:CentOS-5.10-x86_64版本的kickstart自动安装文件为:/var/lib/cobbler/kickstarts/sample.ks
cobbler profile report --name CentOS-5.10-x86_64 #查看profile设置
cobbler distro report --name CentOS-5.10-x86_64 #查看安装镜像文件信息
cobbler profile remove --name=CentOS-5.10-x86_64 #移除profile
cobbler profile add --name=CentOS-5.10-x86_64 --distro=CentOS-5.10-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-5.10-x86_64.ks #添加
cobbler profile edit --name=CentOS-5.10-x86_64 --distro=CentOS-5.10-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-5.10-x86_64.ks #编辑
命令:cobbler profile add|edit|remove --name=安装引导名 --distro=系统镜像名 --kickstart=kickstart自动安装文件路径
--name:自定义的安装引导名,注意不能重复
--distro:系统安装镜像名,用cobbler distro list可以查看
--kickstart:与系统镜像文件相关联的kickstart自动安装文件
#查看Cobbler列表
cobbler list
cobbler report
cobbler profile report
cobbler distro list
#通过profile查找对应的kickstart自动安装文件文件
例如:
ksfile=$( cobbler profile report --name CentOS-5.10-x86_64|grep -E '^Kickstart' |head -n 1|cut -d ':' -f 2 );cat $ksfile;
重复上面的操作,把其他的系统镜像文件和kickstart自动安装文件关联起来
7、配置cobbler_web
cobbler_web支持多种认证方式,如authn_configfil、authn_ldap或 authn_pam等,默认为authn_denyall拒接所有。
下面我们使用authn_pam模块认证cobbler_web用户
# vim /etc/cobbler/modules.conf
[authentication]
module = authn_pam
# useradd wjoyxt
# passwd wjoyxt
# vim /etc/cobbler/users.conf
[admins]
admin = "wjoyxt"
访问:https://172.16.65.222/cobbler_web
此时我们可以手动的添加删除配置,更灵活的对distro 、profile等组件的管理!
参考资料:http://www.osyunwei.com/archives/7606.html
http://www.cnblogs.com/xiaocen/p/3734767.html
---------------------------------------------------------------------------------------------
如果想要实现进入启动项时输入密码的话,需要在以下两个模板文件中添加红色项:

vim /etc/cobbler/pxe/pxedefault.template
DEFAULT menu
PROMPT
MENU TITLE Cobbler | http://cobbler.github.com
MENU MASTER PASSWD $1$haha$T7nt1ThchynsrEviA0KLT0
TIMEOUT
TOTALTIMEOUT
ONTIMEOUT $pxe_timeout_profile LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT - $pxe_menu_items MENU end
vim /etc/cobbler/pxe/pxeprofile.template
LABEL $profile_name
MENU PASSWD
kernel $kernel_path
$menu_label
$append_line
ipappend
------------------------------------------------------------------

当出现如上报错的话,修改 /var/lib/cobbler/kickstarts/centos65.ks 中的"url --url=...." 改完后cobbler sync同步一次配置,并且确保此url是可以被正常访问的。
此处是 url --url="http://172.16.65.222/cobbler/ks_mirror/CentOS-6.4-x86_64/"
cobbler全自动批量安装部署linux的更多相关文章
- Cobbler全自动批量安装部署Linux系统
说明: Cobbler服务器系统:CentOS 5.10 64位 IP地址:192.168.21.128 需要安装部署的Linux系统: eth0(第一块网卡,用于外网)IP地址段:192.168.2 ...
- 解决pxe网络批量安装部署linux遇到的问题和解决方法
解决“出现Unable to retrieve 192.168.0.100/var/www/html/images/install.img错误” 分析:我们必须了解这个错误出现在哪个阶段才能正确找到错 ...
- kvm cobbler无人值守批量安装操作系统
kvm cobbler无人值守批量安装操作系统 cobbler:一个自动网络安装系统的工具,集成PEX.dhcp.dns.tftpd.sync等服务.可以供大家管理安装操作系统 kvm:Linux系统 ...
- (转)Cobbler无人值守批量安装Linux系统
本文目录: 1.1 pxe安装系统 1.2 cobbler基本介绍 1.3 安装和配置cobbler 1.3.1 安装cobbler 1.3.2 配置dhcp和tftp 1.4 cobbler从本地光 ...
- Cobbler自动化批量安装Linux操作系统 - 运维总结
一.Cobbler简述 Cobbler是一个自动化和简化系统安装的工具,通过使用网络引导来控制和启动安装.Cobbler的特性包括存储库镜像.Kickstart模板和连接电源管理系统.Cobbler通 ...
- Cobbler自动化批量安装linux服务器的操作记录
Cobbler为何物?Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命 ...
- cobbler一键批量安装系统
cobbler是一个可以实现批量安装系统的Linux应用程序.它有别于pxe+kickstart,cobbler可以实现同个服务器批量安装不同操作系统版本. 一.系统环境准备及其下载cobbler 1 ...
- cobbler无人值守批量安装Linux系统
本文目录: 1.1 pxe安装系统 1.2 cobbler基本介绍 1.3 安装和配置cobbler 1.3.1 安装cobbler 1.3.2 配置dhcp和tftp 1.4 cobbler从本地光 ...
- 利用cobbler无人值守批量安装centos
准备: 至少两台机器,分别用作cobbler的服务端和安装测试端 准备一个iso的安装文件,最好是4G多的那个dvd包,以前用网易源上那个centos 6.4 x86_64 通过xen安装时就报错:N ...
随机推荐
- Python中的类(classes)
Python的类机制使用尽可能少的新语法和语义将类引入语言.python的类提供了面向对象程序设计语言所有的 标准特性:类继承机制允许有多个基类,一个派生类可以覆盖基类中的任何方法,一个方法可以使用相 ...
- mySQL 教程 第3章 数据类型和数据完整性
准备数据库 创建练习数据库,以下实验都是在这个数据库中完成. 练习1:比较各种数值型 create table tmp1 ( id INT, name VARCHAR(25), deptId deci ...
- [C++ Primer] : 第11章: 关联容器
目录 使用关联容器 关联容器概述 关联容器操作 无序容器 使用关联容器 关联容器与顺序容器有着根本的不同: 关联容器中的元素是按关键字来保存和访问的, 按顺序容器中的元素是按它们在容器中的位置来顺序保 ...
- 【jmeter】jmeter之-断言和检查点
断言就类似LoadRunner中的检查点.对上一个请求返回的信息,做字符串.数据包大小.HTML.XML.图片等做判断,确保返回的信息的准确性. 简单的来理解一下,上一章讲到,我们对用户名和密码进行了 ...
- Linux内存管理和应用
[作者:byeyear.首发于cnblogs,转载请注明.联系:east3@163.com] 本文对Linux内存管理使用到的一些数据结构和函数作了简要描述,而不深入到它们的内部.对这些数据结构和函数 ...
- sigar在Centos和Windows下使用java系统软硬件配置信息
背景 本来这个网上一大堆实在没什么想写的,但是好像大多数都是互相抄袭的,在centos根本上用不了,因此我整理下自己具体实现的步骤. 使用环境 sigar版本:hyperic-sigar-1.6.4 ...
- Java设计原则之依赖倒转原则
定义:高层模块不应该依赖低层模块,二者都应该依赖其抽象:抽象不应该依赖细节:细节应该依赖抽象. 问题由来:类A直接依赖类B,假如要将类A改为依赖类C,则必须通过修改类A的代码来达成.这种场景下,类A一 ...
- AspectJ入门
AOP的实现方式有两种: AOP框架在编译阶段,就对目标类进行修改,得到的class文件已经是被修改过的.生成静态的AOP代理类(生成*.class文件已经被改掉了,需要使用特定的编译器).以Aspe ...
- [转]链接中 href='#' 和 href='###' 的区别以及优缺点
本文来自:http://c.jinhusns.com/bar/t-829 链接中 href='#' 和 href='###' 的区别以及优缺点 上一篇 下一篇近乎_问阳 发表于:2013-09-09 ...
- 1009 Product of Polynomials (25 分)
1009 Product of Polynomials (25 分) This time, you are supposed to find A×B where A and B are two pol ...