阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Cobbler无人值守安装详解

432次阅读
没有评论

共计 10597 个字符,预计需要花费 27 分钟才能阅读完成。

Cobbler 是一个 Linux 服务器安装的服务,可以通过网络启动 (PXE) 的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理 DHCP,DNS 等。

Cobbler 可以使用命令行方式管理,也提供了基于 Web 的界面管理工具(cobbler-web),还提供了 API 接口,可以方便二次开发使用。

Cobbler 是较早前的 kickstart 的升级版,优点是比较容易配置,还自带 Web 界面比较易于管理。
Cobbler 内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如 Puppet,暂时不支持 SaltStack。

kickstart 是由 dhcp、tftp、http 这三种服务有机组成,为有 pxe 功能的客户端提供自动装机服务。kickstart 只是这套系统的名字,并没有这个独立的软件。
cobbler 是对 kickstart 进行二次开发,安装 cobbler 的过程中,其实已经悄悄地安装了和 kickstart 一样的服务,因此在工作中安装 cobbler 直接一条 yum 命令即可,不需要先把 kickstart 服务安装配置好。

环境
Linux CentOS6 2.6.32-642.el6.x86_64
cobbler-2.6.11-1.el6.x86_64
cobbler-web-2.6.11-1.el6.noarch
dhcp-4.1.1-51.P1.el6.centos.x86_64
tftp-server-0.49-8.el6.x86_64
pykickstart-1.74.20-1.el6.noarch
httpd-2.2.15-56.el6.centos.3.x86_64 

系统环境准备
1234567 [root@CentOS6 ~]# getenforce
Disabled
[root@CentOS6 ~]# /etc/init.d/iptables status
iptables: Firewall is not running.
[root@CentOS6 ~]#  cat /etc/RedHat-release
CentOS release 6.8 (Final)
[root@CentOS6 ~]#wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

注意:虚拟机 VMware 模式的 DHCP 服务关闭,同一台机器上面不允许两个 DHCP 服务

Cobbler 无人值守安装详解

Cobbler 安装配置
[root@CentOS6 ~]#  yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd
[root@CentOS6 ~]# /etc/init.d/httpd restart
[root@CentOS6 ~]# /etc/init.d/cobblerd restart
[root@CentOS6 ~]# /etc/init.d/xinetd restart

[root@CentOS6 ~]#  rpm -ql cobbler
/etc/cobbler                  # 配置文件目录
/etc/cobbler/settings        # cobbler 主配置文件,这个文件是 YAML 格式,Cobbler 是 Python 写的程序。
/etc/cobbler/dhcp.template    # DHCP 服务的配置模板
/etc/cobbler/tftpd.template  # tftp 服务的配置模板
/etc/cobbler/rsync.template  # rsync 服务的配置模板
/etc/cobbler/iso              # iso 模板配置文件目录
/etc/cobbler/pxe              # pxe 模板文件目录
/etc/cobbler/power            # 电源的配置文件目录
/etc/cobbler/users.conf      # Web 服务授权配置文件
/etc/cobbler/users.digest    # 用于 web 访问的用户名密码配置文件
/etc/cobbler/dnsmasq.template # DNS 服务的配置模板
/etc/cobbler/modules.conf    # Cobbler 模块配置文件
/var/lib/cobbler              # Cobbler 数据目录
/var/lib/cobbler/config      # 配置文件
/var/lib/cobbler/kickstarts  # 默认存放 kickstart 文件
/var/lib/cobbler/loaders      # 存放的各种引导程序
/var/www/cobbler              # 系统安装镜像目录
/var/www/cobbler/ks_mirror    # 导入的系统镜像列表
/var/www/cobbler/images      # 导入的系统镜像启动文件
/var/www/cobbler/repo_mirror  # yum 源存储目录
/var/log/cobbl              # 日志目录
/var/log/cobbler/install.log  # 客户端系统安装日志
/var/log/cobbler/cobbler.log  # cobbler 日志

配置 Cobbler
[root@CentOS6 ~]# 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 : change ‘disable’ to ‘no’ in /etc/xinetd.d/tftp
4 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run ‘cobbler get-loaders’ to download th
em, 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/rsync
6 : file /etc/xinetd.d/rsync does not exist  # 这是一个 bug
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobb
ler/settings) is still set to ‘cobbler’ and should be changed, try: “openssl passwd -1 -salt ‘random-phrase-here’ ‘your-password-here'” to generate new one9 : 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.
12345678 [root@CentOS6 ~]cp /etc/cobbler/settings{,.ori}  ## 备份
1.[root@CentOS6 ~]# sed -i ‘s#server: 127.0.0.1#server: 172.16.1.101#’ /etc/cobbler/settings    ### 指定 cobbler 服务器地址
2.[root@CentOS6 ~]#sed -i ‘s#yes#no#’ /etc/xinetd.d/rsync 
3.[root@CentOS6 ~]# sed ‘s#manage_dhcp: 0#manage_dhcp: 1#’  /etc/cobbler/settings  ## 用 Cobbler 管理 DHCP
4.[root@CentOS6 ~]# sed -n ‘s/pxe_just_once: 0/ pxe_just_once: 1/’ /etc/cobbler/settings  ## 防止循环装系统,适用于服务器第一启动项是 PXE 启动。务
5.[root@CentOS6 ~]# sed -i ‘s#yes#no#’ /etc/xinetd.d/tftp 
6.[root@CentOS6 ~]# sed -ri “/default_password_crypted/s#(.*:).*#\1\”`openssl passwd -1 -salt ‘oldboy’ ‘123456’`\”#” /etc/cobbler/settings
7.[root@CentOS6 ~]# sed -i ‘s/next_server: 127.0.0.1/next_server: 172.16.1.101/’ /etc/cobbler/settings

问题 4 解决方法

####http://pan.baidu.com/s/1kVqhMT5### 需要从官网下载,我这里已经下载好了。
tar xfP cobbler_load.tar.gz

配置 DHCP
[root@CentOS6 ~] vim /etc/cobbler/dhcp.template
:%s/192.168.1/172.16.1/g

镜像挂载
[root@CentOS6 ~]# mount /dev/cdrom /mnt

rsync 服务是批量增加的

更多详情见请继续阅读下一页的精彩内容:http://www.linuxidc.com/Linux/2017-04/142587p2.htm

Kickstart 创建
# Cobbler for Kickstart Configurator for CentOS 6.8 by yao zhang
install
url –url=$tree
text
lang en_US.UTF-8
keyboard us
zerombr
bootloader –location=mbr –driveorder=sda –append=”crashkernel=auto rhgb quiet”
$SNIPPET(‘network_config’)
timezone –utc Asia/Shanghai
authconfig –enableshadow –passalgo=sha512
rootpw  –iscrypted $default_password_crypted
clearpart –all –initlabel
part /boot –fstype=ext4 –asprimary –size=200
part swap –size=1024
part / –fstype=ext4 –grow –asprimary –size=200
firstboot –disable
selinux –disabled
firewall –disabled
logging –level=info
reboot

%pre
$SNIPPET(‘log_ks_pre’)
$SNIPPET(‘kickstart_start’)
$SNIPPET(‘pre_install_network_config’)
# Enable installation monitoring
$SNIPPET(‘pre_anamon’)
%end

%packages
@base
@compat-libraries
@debugging
@development
tree
nmap
sysstat
lrzsz
dos2unix
telnet
%end

%post –nochroot
$SNIPPET(‘log_ks_post_nochroot’)
%end

%post
$SNIPPET(‘log_ks_post’)
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET(‘post_install_kernel_options’)
$SNIPPET(‘post_install_network_config’)
$SNIPPET(‘func_register_if_enabled’)
$SNIPPET(‘download_config_files’)
$SNIPPET(‘koan_environment’)
$SNIPPET(‘RedHat_register’)
$SNIPPET(‘cobbler_register’)
# Enable post-install boot notification
$SNIPPET(‘post_anamon’)
# Start final steps
$SNIPPET(‘kickstart_done’)
# End final steps
%end

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

Cobbler 无人值守安装详解

本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-04/142587.htm

Cobbler 是一个 Linux 服务器安装的服务,可以通过网络启动 (PXE) 的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理 DHCP,DNS 等。

Cobbler 可以使用命令行方式管理,也提供了基于 Web 的界面管理工具(cobbler-web),还提供了 API 接口,可以方便二次开发使用。

Cobbler 是较早前的 kickstart 的升级版,优点是比较容易配置,还自带 Web 界面比较易于管理。
Cobbler 内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如 Puppet,暂时不支持 SaltStack。

kickstart 是由 dhcp、tftp、http 这三种服务有机组成,为有 pxe 功能的客户端提供自动装机服务。kickstart 只是这套系统的名字,并没有这个独立的软件。
cobbler 是对 kickstart 进行二次开发,安装 cobbler 的过程中,其实已经悄悄地安装了和 kickstart 一样的服务,因此在工作中安装 cobbler 直接一条 yum 命令即可,不需要先把 kickstart 服务安装配置好。

环境
Linux CentOS6 2.6.32-642.el6.x86_64
cobbler-2.6.11-1.el6.x86_64
cobbler-web-2.6.11-1.el6.noarch
dhcp-4.1.1-51.P1.el6.centos.x86_64
tftp-server-0.49-8.el6.x86_64
pykickstart-1.74.20-1.el6.noarch
httpd-2.2.15-56.el6.centos.3.x86_64 

系统环境准备
1234567 [root@CentOS6 ~]# getenforce
Disabled
[root@CentOS6 ~]# /etc/init.d/iptables status
iptables: Firewall is not running.
[root@CentOS6 ~]#  cat /etc/RedHat-release
CentOS release 6.8 (Final)
[root@CentOS6 ~]#wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

注意:虚拟机 VMware 模式的 DHCP 服务关闭,同一台机器上面不允许两个 DHCP 服务

Cobbler 无人值守安装详解

Cobbler 安装配置
[root@CentOS6 ~]#  yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd
[root@CentOS6 ~]# /etc/init.d/httpd restart
[root@CentOS6 ~]# /etc/init.d/cobblerd restart
[root@CentOS6 ~]# /etc/init.d/xinetd restart

[root@CentOS6 ~]#  rpm -ql cobbler
/etc/cobbler                  # 配置文件目录
/etc/cobbler/settings        # cobbler 主配置文件,这个文件是 YAML 格式,Cobbler 是 Python 写的程序。
/etc/cobbler/dhcp.template    # DHCP 服务的配置模板
/etc/cobbler/tftpd.template  # tftp 服务的配置模板
/etc/cobbler/rsync.template  # rsync 服务的配置模板
/etc/cobbler/iso              # iso 模板配置文件目录
/etc/cobbler/pxe              # pxe 模板文件目录
/etc/cobbler/power            # 电源的配置文件目录
/etc/cobbler/users.conf      # Web 服务授权配置文件
/etc/cobbler/users.digest    # 用于 web 访问的用户名密码配置文件
/etc/cobbler/dnsmasq.template # DNS 服务的配置模板
/etc/cobbler/modules.conf    # Cobbler 模块配置文件
/var/lib/cobbler              # Cobbler 数据目录
/var/lib/cobbler/config      # 配置文件
/var/lib/cobbler/kickstarts  # 默认存放 kickstart 文件
/var/lib/cobbler/loaders      # 存放的各种引导程序
/var/www/cobbler              # 系统安装镜像目录
/var/www/cobbler/ks_mirror    # 导入的系统镜像列表
/var/www/cobbler/images      # 导入的系统镜像启动文件
/var/www/cobbler/repo_mirror  # yum 源存储目录
/var/log/cobbl              # 日志目录
/var/log/cobbler/install.log  # 客户端系统安装日志
/var/log/cobbler/cobbler.log  # cobbler 日志

配置 Cobbler
[root@CentOS6 ~]# 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 : change ‘disable’ to ‘no’ in /etc/xinetd.d/tftp
4 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run ‘cobbler get-loaders’ to download th
em, 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/rsync
6 : file /etc/xinetd.d/rsync does not exist  # 这是一个 bug
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobb
ler/settings) is still set to ‘cobbler’ and should be changed, try: “openssl passwd -1 -salt ‘random-phrase-here’ ‘your-password-here'” to generate new one9 : 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.
12345678 [root@CentOS6 ~]cp /etc/cobbler/settings{,.ori}  ## 备份
1.[root@CentOS6 ~]# sed -i ‘s#server: 127.0.0.1#server: 172.16.1.101#’ /etc/cobbler/settings    ### 指定 cobbler 服务器地址
2.[root@CentOS6 ~]#sed -i ‘s#yes#no#’ /etc/xinetd.d/rsync 
3.[root@CentOS6 ~]# sed ‘s#manage_dhcp: 0#manage_dhcp: 1#’  /etc/cobbler/settings  ## 用 Cobbler 管理 DHCP
4.[root@CentOS6 ~]# sed -n ‘s/pxe_just_once: 0/ pxe_just_once: 1/’ /etc/cobbler/settings  ## 防止循环装系统,适用于服务器第一启动项是 PXE 启动。务
5.[root@CentOS6 ~]# sed -i ‘s#yes#no#’ /etc/xinetd.d/tftp 
6.[root@CentOS6 ~]# sed -ri “/default_password_crypted/s#(.*:).*#\1\”`openssl passwd -1 -salt ‘oldboy’ ‘123456’`\”#” /etc/cobbler/settings
7.[root@CentOS6 ~]# sed -i ‘s/next_server: 127.0.0.1/next_server: 172.16.1.101/’ /etc/cobbler/settings

问题 4 解决方法

####http://pan.baidu.com/s/1kVqhMT5### 需要从官网下载,我这里已经下载好了。
tar xfP cobbler_load.tar.gz

配置 DHCP
[root@CentOS6 ~] vim /etc/cobbler/dhcp.template
:%s/192.168.1/172.16.1/g

镜像挂载
[root@CentOS6 ~]# mount /dev/cdrom /mnt

rsync 服务是批量增加的

更多详情见请继续阅读下一页的精彩内容:http://www.linuxidc.com/Linux/2017-04/142587p2.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计10597字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中

星哥玩云

星哥玩云
星哥玩云
分享互联网知识
用户数
4
文章数
19350
评论数
4
阅读量
7964513
文章搜索
热门文章
星哥带你玩飞牛NAS-6:抖音视频同步工具,视频下载自动下载保存

星哥带你玩飞牛NAS-6:抖音视频同步工具,视频下载自动下载保存

星哥带你玩飞牛 NAS-6:抖音视频同步工具,视频下载自动下载保存 前言 各位玩 NAS 的朋友好,我是星哥!...
星哥带你玩飞牛NAS-3:安装飞牛NAS后的很有必要的操作

星哥带你玩飞牛NAS-3:安装飞牛NAS后的很有必要的操作

星哥带你玩飞牛 NAS-3:安装飞牛 NAS 后的很有必要的操作 前言 如果你已经有了飞牛 NAS 系统,之前...
我把用了20年的360安全卫士卸载了

我把用了20年的360安全卫士卸载了

我把用了 20 年的 360 安全卫士卸载了 是的,正如标题你看到的。 原因 偷摸安装自家的软件 莫名其妙安装...
再见zabbix!轻量级自建服务器监控神器在Linux 的完整部署指南

再见zabbix!轻量级自建服务器监控神器在Linux 的完整部署指南

再见 zabbix!轻量级自建服务器监控神器在 Linux 的完整部署指南 在日常运维中,服务器监控是绕不开的...
飞牛NAS中安装Navidrome音乐文件中文标签乱码问题解决、安装FntermX终端

飞牛NAS中安装Navidrome音乐文件中文标签乱码问题解决、安装FntermX终端

飞牛 NAS 中安装 Navidrome 音乐文件中文标签乱码问题解决、安装 FntermX 终端 问题背景 ...
阿里云CDN
阿里云CDN-提高用户访问的响应速度和成功率
随机文章
我把用了20年的360安全卫士卸载了

我把用了20年的360安全卫士卸载了

我把用了 20 年的 360 安全卫士卸载了 是的,正如标题你看到的。 原因 偷摸安装自家的软件 莫名其妙安装...
星哥带你玩飞牛NAS-6:抖音视频同步工具,视频下载自动下载保存

星哥带你玩飞牛NAS-6:抖音视频同步工具,视频下载自动下载保存

星哥带你玩飞牛 NAS-6:抖音视频同步工具,视频下载自动下载保存 前言 各位玩 NAS 的朋友好,我是星哥!...
【1024程序员】我劝你赶紧去免费领一个AWS、华为云等的主机

【1024程序员】我劝你赶紧去免费领一个AWS、华为云等的主机

【1024 程序员】我劝你赶紧去免费领一个 AWS、华为云等的主机 每年 10 月 24 日,程序员们都会迎来...
星哥带你玩飞牛NAS-13:自动追番、订阅下载 + 刮削,动漫党彻底解放双手!

星哥带你玩飞牛NAS-13:自动追番、订阅下载 + 刮削,动漫党彻底解放双手!

星哥带你玩飞牛 NAS-13:自动追番、订阅下载 + 刮削,动漫党彻底解放双手! 作为动漫爱好者,你是否还在为...
安装并使用谷歌AI编程工具Antigravity(亲测有效)

安装并使用谷歌AI编程工具Antigravity(亲测有效)

  安装并使用谷歌 AI 编程工具 Antigravity(亲测有效) 引言 Antigravity...

免费图片视频管理工具让灵感库告别混乱

一言一句话
-「
手气不错
星哥带你玩飞牛 NAS-9:全能网盘搜索工具 13 种云盘一键搞定!

星哥带你玩飞牛 NAS-9:全能网盘搜索工具 13 种云盘一键搞定!

星哥带你玩飞牛 NAS-9:全能网盘搜索工具 13 种云盘一键搞定! 前言 作为 NAS 玩家,你是否总被这些...
还在找免费服务器?无广告免费主机,新手也能轻松上手!

还在找免费服务器?无广告免费主机,新手也能轻松上手!

还在找免费服务器?无广告免费主机,新手也能轻松上手! 前言 对于个人开发者、建站新手或是想搭建测试站点的从业者...
每年0.99刀,拿下你的第一个顶级域名,详细注册使用

每年0.99刀,拿下你的第一个顶级域名,详细注册使用

每年 0.99 刀,拿下你的第一个顶级域名,详细注册使用 前言 作为长期折腾云服务、域名建站的老玩家,星哥一直...
星哥带你玩飞牛 NAS-10:备份微信聊天记录、数据到你的NAS中!

星哥带你玩飞牛 NAS-10:备份微信聊天记录、数据到你的NAS中!

星哥带你玩飞牛 NAS-10:备份微信聊天记录、数据到你的 NAS 中! 大家对「数据安全感」的需求越来越高 ...
星哥带你玩飞牛NAS-11:咪咕视频订阅部署全攻略

星哥带你玩飞牛NAS-11:咪咕视频订阅部署全攻略

星哥带你玩飞牛 NAS-11:咪咕视频订阅部署全攻略 前言 在家庭影音系统里,NAS 不仅是存储中心,更是内容...