1.cobbler 相关术语
(1)发行版:
表示一个操作系统版本,它承载了内核和 initrd 的信息,以及内核参数等其他数据
(2)配置文件:
包含一个发行版、一个 kickstart 文件以及可能的存储库,还包含更多特定的内核参数等其他数据
(3)系统:
表示要配置的主机,它包含一个配置文件或一个镜像,还包含IP 和 MAC 地址、电源管理(地址、凭据、类型)以及更为专业的数据等信息
(4)存储库:
保存一个 yum 或 rsync 存储库的镜像信息
(5)镜像:
可替换一个包含不属于此类别的文件的发行版对象(例如,无法分为内核和 initrd 的对象)
2.cobbler 各种配置目录说明
配置文件目录 /etc/cobbler
/etc/cobbler/settings : cobbler 主配置文件
/etc/cobbler/iso/: iso模板配置文件
/etc/cobbler/pxe: pxe模板文件
/etc/cobbler/power: 电源配置文件
/etc/cobbler/user.conf: web服务授权配置文件
/etc/cobbler/users.digest: web访问的用户名密码配置文件
/etc/cobbler/dhcp.template : dhcp服务器的的配置模板
/etc/cobbler/dnsmasq.template : dns服务器的配置模板
/etc/cobbler/tftpd.template : tftp服务的配置模板
/etc/cobbler/modules.conf : 模块的配置文件
3.cobbler 目录介绍
(1)数据目录
/var/lib/cobbler/config/: 用于存放distros,system,profiles 等信息配置文件
/var/lib/cobbler/triggers/: 用于存放用户定义的cobbler命令
/var/lib/cobbler/kickstart/: 默认存放kickstart文件
/var/lib/cobbler/loaders/: 存放各种引导程序
(2)镜像目录
/var/www/cobbler/ks_mirror/: 导入的发行版系统的所有数据
/var/www/cobbler/images/ : 导入发行版的kernel和initrd镜像用于远程网络启动
/var/www/cobbler/repo_mirror/: yum 仓库存储目录
(3)日志目录
/var/log/cobbler/installing: 客户端安装日志
/var/log/cobbler/cobbler.log : cobbler日志
4.cobbler 命令介绍
cobbler check 核对当前设置是否有问题
cobbler list 列出所有的cobbler元素
cobbler report 列出元素的详细信息
cobbler sync 同步配置到数据目录,更改配置最好都要执行下
cobbler reposync 同步yum仓库
cobbler distro 查看导入的发行版系统信息
cobbler system 查看添加的系统信息
cobbler profile 查看配置信息
5.cobbler 重要的参数
/etc/cobbler/settings中重要的参数设置
default_password_crypted:
"$1$gEc7ilpP$pg5iSOj/mlxTxEslhRvyp/"
manage_dhcp:1
manage_tftpd:1
pxe_just_once:1
next_server:< tftp服务器的 IP 地址>
server:<cobbler服务器的 IP 地址>
6.cobbler 环境检查
执行Cobbler check命令会报如下异常
1 : The ‘server’ field in /etc/cobbler/settings must be set
to something other thanlocalhost, 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 setto something other than
127.0.0.1, and should match the IP of the boot server on
thePXE 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 handlex86/x86_64netbooting,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, andyaboot. The ‘cobbler get-loaders’ command is the easiest way to resolve theserequirements.
4 : change ‘disable’ to ‘no’ in /etc/xinetd.d/rsync
5 : comment ‘dists’ on /etc/debmirror.conf for proper debian support
6 : comment ‘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
cobbler 报错解决
执行Cobbler check报错解决方式
修改/etc/cobbler/settings文件中的server参数的值为提
供cobbler服务的主机相应的IP地址或主机名
修改/etc/cobbler/settings文件中的next_server参数的
值为提供PXE服务的主机相应的IP地址
如果当前节点可以访问互联网,执行“cobbler getloaders”命令即可;否则,需要安装syslinux程序包,而后复制/usr/share/syslinux/{pxelinux.0,memu.c32}等文件
至/var/lib/cobbler/loaders/目录中
执行“chkconfig rsync on”命令即可
执行“openssl passwd -1 生成密码,并用其替换
/etc/cobbler/settings文件中default_password_crypted
参数的值
6.cobbler 相关管理
下载启动菜单: cobbler get-loaders
管理distro
cobbler import --name=centos-6.9-x86_64 -- path=/media/cdrom
管理profile
cobbler profile add --name=centos-6.9-x86_64-basic -- distro=centos-6.9-x86_64 --kickstart=/tmp/centos- 6.9-x86_64.cfg
查看profiles
cobbler profile list
查看引导文件
cat /var/lib/tftpboot/pxelinux.cfg/default
同步cobbler配置
cobbler sync
7.多系统引导方案
cobbler import --name=CentOS-7-x86_64 --
path=/media/cdrom
cobbler distro list
cobbler profile list
cobbler sync
cobbler 实现步骤
安装包,并设置服务
检查配置
根据上面提示修改配置
下载启动相关文件菜单
配置DHCP服务
分别导入centos的安装源,并查看
准备kickstart文件并导入cobbler
测试
8.cobbler的web管理实现
cobbler-web
提供cobbler的基于web管理界面,epel源
yum install cobbler-web
认证方式
定义认证方法:/etc/cobbler/modules.conf
使用authn_pam模块认证cobbler_web用户
[authentication] 块中指定 module = authn_pam
创建cobbler用户:useradd cobbler
修改文件 /etc/cobbler/users.conf
[admins]
admin = "cobbler"
使用authn_configfile模块认证cobbler_web用户
[authentication]块中module=authn_configfile
创建其认证文件/etc/cobbler/users.digest,并添加所
需的用户
htdigest -c /etc/cobbler/users.digest Cobbler admin
注意:添加第一个用户时,使用“-c”选项,后续添加其他
用户时不要再使用,cobbler_web的realm只能为Cobbler
Web访问cobbler
重启cobblerd服务
通过http://cobblerserver/cobbler_web访问即可
网友评论