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

Linux 运维自动化之Cobbler安装与配置

499次阅读
没有评论

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

大纲
一、前言
二、环境配置
三、Cobbler 安装
四、Cobbler 配置详解
注,操作系统 CentOS 6.4 x86_64,软件版本 Cobbler-2.4.0-1。(目前最新版)

一、前言
在上一篇博客中(http://www.linuxidc.com/Linux/2013-11/92302.htm)我们主要讲解与 Cobbler 相关的基础知识,在一篇博客中我们主要中大家来说一下 Cobbler 安装与配置,并且详细说一下 Cobbler 命令的使用。好了,废话不多说下面直接上干货。

二、环境配置
1. 实验拓扑

Linux 运维自动化之 Cobbler 安装与配置

2. 安装 yum 源
[root@node2 ~]# rpm -ivh http://download.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.z0cbxV: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing…        ########################################### [100%]
  1:epel-release      ########################################### [100%]

3. 同步系统时间
[root@node2 ~]# yum install -y ntp
[root@node2 ~]# ntpdate 202.120.2.101
 4 Nov 13:49:41 ntpdate[1190]: step time server 202.120.2.101 offset 388653.714776 sec
[root@node2 ~]# hwclock -w

4. 关闭防火墙与 SELinux
[root@node2 ~]# service iptables stop
[root@node2 ~]# chkconfig iptables off
[root@node2 ~]# getenforce
Disabled

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

相关阅读

Linux 运维工程师笔试题 http://www.linuxidc.com/Linux/2013-09/90621.htm

运维自动化之 Cobbler 安装配置 http://www.linuxidc.com/Linux/2013-03/81575.htm

RHEL5.5 下 Cobbler 的配置 http://www.linuxidc.com/Linux/2013-06/86115.htm

运维自动化部署 Cobbler 之服务安装篇 http://www.linuxidc.com/Linux/2013-02/80133.htm

利用 Cobbler 批量快速网络安装 CentOS http://www.linuxidc.com/Linux/2012-12/75838.htm

CentOS 6.3 上安装部署 Cobbler http://www.linuxidc.com/Linux/2012-10/72094.htm

三、Cobbler 安装
1.Cobbler 运行所需基础包
[root@node2 ~]# yum install -y cobbler tftp dhcp httpd cman pykickstart debmirror

2.Cobblerf 所需环境支持包
[root@node2 ~]# yum install -y ed patch perl perl-Compress-Zlib perl-Digest-SHA1 perl-LockFile-Simple perl-libwww-perl

3. 将所有服务加入开机自启动并启动相关服务
[root@node2 ~]# chkconfig httpd on
[root@node2 ~]# chkconfig dhcpd on
[root@node2 ~]# chkconfig xinetd on
[root@node2 ~]# chkconfig cobblerd on
[root@node2 ~]#
[root@node2 ~]# service httpd start
正在启动 httpd:httpd: Could not reliably determine the server’s fully qualified domain name, using node2.test.com for ServerName
                              [确定]
[root@node2 ~]# service cobblerd start
Starting cobbler daemon:                  [确定]

4. 修改 apache 相关配置并重新启动
注,从上面的启动信息可以看出 apache 启动有点小错误,我们来修正一下。
[root@node2 ~]# vim /etc/httpd/conf/httpd.conf
# 增加一行
ServerName localhost:80
[root@node2 ~]# service httpd restart
停止 httpd:[确定]
正在启动 httpd:[确定]

5. 运行 Cobbler 检查命令
[root@node2 ~]# 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
Restart cobblerd and then run ‘cobbler sync’ to apply changes.

注,从上面的执行结果来看上面有 7 处错误,下面我们来解决一下。
(1). 错误 1,修改 /etc/cobbler/settings 里面的 server 为 Cobbler Server 的 IP 地址;
[root@node2 ~]# vim /etc/cobbler/settings
server: 192.168.18.202

(2). 错误 2,修改 /etc/cobbler/settings 里面的 next_serverw 为本机的 ip;
[root@node2 ~]# vim /etc/cobbler/settings
next_server: 192.168.18.202

(3). 错误 3,据说这个错误可以忽略,有强迫完美运行症的人士可以运行以下命令来解决;
[root@node2 ~]# cobbler get-loaders
task started: 2013-11-04_143149_get_loaders
task started (id=Download Bootloader Content, time=Mon Nov 4 14:31:49 2013)
downloading http://www.cobblerd.org/loaders/README to /var/lib/cobbler/loaders/README
downloading http://www.cobblerd.org/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading http://www.cobblerd.org/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading http://www.cobblerd.org/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading http://www.cobblerd.org/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading http://www.cobblerd.org/loaders/yaboot-1.3.14-12 to /var/lib/cobbler/loaders/yaboot
downloading http://www.cobblerd.org/loaders/pxelinux.0-3.61 to /var/lib/cobbler/loaders/pxelinux.0
downloading http://www.cobblerd.org/loaders/menu.c32-3.61 to /var/lib/cobbler/loaders/menu.c32
downloading http://www.cobblerd.org/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading http://www.cobblerd.org/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***

(4). 错误 4,修改 /etc/xinetd.d/tftp 把 ’disable’ 修改为 ’no’;修改 /etc/xinetd.d/rsync 把 ’disable’ 修改为 ’no’;
[root@node2 ~]# vim /etc/xinetd.d/tftp
disable        = no
[root@node2 ~]# vim /etc/xinetd.d/rsync
disable = no

注,启动 xinetd 服务。
12 [root@node2 ~]# service xinetd start
正在启动 xinetd:[确定]

(5). 错误 5 与错误 6,debmmirror 有错误;
[root@node2 ~]# vim /etc/debmirror.conf
# 注释掉 @dists=”sid” 与 @arches=”i386 即可
#@dists=”sid”;
#@arches=”i386″;

(6). 错误 7,设置默认 root 密码;
注,刚接触 Cobbler 的博友会问,这个密码是什么密码。有的博友系统安装好了会问,root 密码是什么。这里设置的就是客户端安装好系统的 root 密码。
# 生成你想要的密码的加密字符串, 然后复制运行命令之后的加密代码;
12 [root@node2 ~]# openssl passwd -1 -salt ‘hahaha’ ‘123456’
$1$hahaha$hSxFjZSHRoiEn4DYrrGUI.

# 然后替换 /etc/cobbler/settings 中选项双引号中的加密代码;
[root@node2 ~]# vim /etc/cobbler/settings
default_password_crypted: “$1$hahaha$hSxFjZSHRoiEn4DYrrGUI.”

6. 重新启动 Cobbler 并运行检查命令
[root@node2 ~]# service cobblerd restart
Stopping cobbler daemon:                  [确定]
Starting cobbler daemon:                  [确定]
[root@node2 ~]# cobbler check
No configuration problems found. All systems go.

好了,到这里我们 Cobbler 安装就全部完成了,最后我们来查看一下启动的端口。
[root@node2 ~]# netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address        Foreign Address      State    PID/Program name
tcp    0  0 0.0.0.0:22        0.0.0.0:*          LISTEN  1011/sshd 
tcp    0  0 127.0.0.1:25        0.0.0.0:*          LISTEN  1087/master 
tcp    0  0 127.0.0.1:6010      0.0.0.0:*          LISTEN  1126/sshd 
tcp    0  0 127.0.0.1:6011      0.0.0.0:*          LISTEN  1607/sshd 
tcp    0  0 127.0.0.1:25151      0.0.0.0:*          LISTEN  12677/Python
tcp    0  0 :::80            :::*            LISTEN  1696/httpd 
tcp    0  0 :::22            :::*            LISTEN  1011/sshd 
tcp    0  0 ::1:25          :::*            LISTEN  1087/master 
tcp    0  0 ::1:6010          :::*            LISTEN  1126/sshd 
tcp    0  0 ::1:6011          :::*            LISTEN  1607/sshd 
tcp    0  0 :::873          :::*            LISTEN  12747/xinetd
udp    0  0 0.0.0.0:69        0.0.0.0:*                12747/xinetd

大纲
一、前言
二、环境配置
三、Cobbler 安装
四、Cobbler 配置详解
注,操作系统 CentOS 6.4 x86_64,软件版本 Cobbler-2.4.0-1。(目前最新版)

一、前言
在上一篇博客中(http://www.linuxidc.com/Linux/2013-11/92302.htm)我们主要讲解与 Cobbler 相关的基础知识,在一篇博客中我们主要中大家来说一下 Cobbler 安装与配置,并且详细说一下 Cobbler 命令的使用。好了,废话不多说下面直接上干货。

二、环境配置
1. 实验拓扑

Linux 运维自动化之 Cobbler 安装与配置

2. 安装 yum 源
[root@node2 ~]# rpm -ivh http://download.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.z0cbxV: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing…        ########################################### [100%]
  1:epel-release      ########################################### [100%]

3. 同步系统时间
[root@node2 ~]# yum install -y ntp
[root@node2 ~]# ntpdate 202.120.2.101
 4 Nov 13:49:41 ntpdate[1190]: step time server 202.120.2.101 offset 388653.714776 sec
[root@node2 ~]# hwclock -w

4. 关闭防火墙与 SELinux
[root@node2 ~]# service iptables stop
[root@node2 ~]# chkconfig iptables off
[root@node2 ~]# getenforce
Disabled

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

相关阅读

Linux 运维工程师笔试题 http://www.linuxidc.com/Linux/2013-09/90621.htm

运维自动化之 Cobbler 安装配置 http://www.linuxidc.com/Linux/2013-03/81575.htm

RHEL5.5 下 Cobbler 的配置 http://www.linuxidc.com/Linux/2013-06/86115.htm

运维自动化部署 Cobbler 之服务安装篇 http://www.linuxidc.com/Linux/2013-02/80133.htm

利用 Cobbler 批量快速网络安装 CentOS http://www.linuxidc.com/Linux/2012-12/75838.htm

CentOS 6.3 上安装部署 Cobbler http://www.linuxidc.com/Linux/2012-10/72094.htm

四、Cobbler 配置详解
主要的 Cobbler 配置文件是 /etc/cobbler/settings。使用文本编辑器打开这个文件,并设置以下选项:
manage_dhcp:1

manage_dns:1

manage_tftpd:1

restart_dhcp:1

restart_dns:1

pxe_just_once:1

next_server:< 服务器的 IP 地址 >

server:< 服务器的 IP 地址 >

选项 manage_* 和 restart_* 无需加以说明。选项 next_server 用在 DHCP 配置文件中,向客户端告知提供引导文件的服务器地址。选项 server 在客户端安装期间用于引用 Cobbler 服务器地址。最后,选项 pxe_just_once 预防将机器中的安装循环配置为始终从网络引导。激活此选项时,机器告诉 Cobbler 安装已完成。Cobbler 将系统对象的 netboot 标志更改为 false,这会强制机器从本地磁盘引导。好了,下面我们配置并管理 dhcp 服务与 http 服务。

1. 让 Cobbler 来管理 DHCP 服务器
[root@node2 ~]# vim /etc/cobbler/settings
manage_dhcp: 1

2. 修改 DHCP 模板
[root@node2 ~]# vim /etc/cobbler/dhcp.template
subnet 192.168.18.0 netmask 255.255.255.0 {
option routers 192.168.18.254;
option domain-name-servers 8.8.8.8;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.18.221 192.168.18.225;
filename “/pxelinux.0”;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}

3. 重新启动 Cobbler 服务
[root@node2 ~]# service cobblerd restart
Stopping cobbler daemon:                  [确定]
Starting cobbler daemon:                  [确定]

4. 编辑 /etc/httpd/conf.d/wsgi.conf 去掉注释
[root@node2 ~]# vim /etc/httpd/conf.d/wsgi.conf
LoadModule wsgi_module modules/mod_wsgi.so

5. 完成后一定要运行 cobbler sync 命令让配置生效,使 dhcp、http 被 cobbler 接管,不然会报错。
[root@node2 ~]# cobbler sync
task started: 2013-11-04_164727_sync
task started (id=Sync, time=Mon Nov 4 16:47:27 2013)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
running post-sync triggers
running Python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout:
received on stderr:
running: service dhcpd restart
received on stdout: 关闭 dhcpd:[确定]
正在启动 dhcpd:[确定]
received on stderr:
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

好了,到这里我们的 Cobbler 安装与配置就讲解完成了,我们在下一篇博客中将讲解 Cobbler 管理与使用详解。最后,希望大家有所收获 ^_^……

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

星哥玩云

星哥玩云
星哥玩云
分享互联网知识
用户数
4
文章数
19351
评论数
4
阅读量
7984676
文章搜索
热门文章
星哥带你玩飞牛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-提高用户访问的响应速度和成功率
随机文章
每天一个好玩的网站-手机博物馆-CHAZ 3D Experience

每天一个好玩的网站-手机博物馆-CHAZ 3D Experience

每天一个好玩的网站 - 手机博物馆 -CHAZ 3D Experience 一句话介绍:一个用 3D 方式重温...
亚马逊云崩完,微软云崩!当全球第二大云“摔了一跤”:Azure 宕机背后的配置风险与警示

亚马逊云崩完,微软云崩!当全球第二大云“摔了一跤”:Azure 宕机背后的配置风险与警示

亚马逊云崩完,微软云崩!当全球第二大云“摔了一跤”:Azure 宕机背后的配置风险与警示 首先来回顾一下 10...
240 元左右!五盘位 NAS主机,7 代U硬解4K稳如狗,拓展性碾压同价位

240 元左右!五盘位 NAS主机,7 代U硬解4K稳如狗,拓展性碾压同价位

  240 元左右!五盘位 NAS 主机,7 代 U 硬解 4K 稳如狗,拓展性碾压同价位 在 NA...
星哥带你玩飞牛NAS-3:安装飞牛NAS后的很有必要的操作

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

星哥带你玩飞牛 NAS-3:安装飞牛 NAS 后的很有必要的操作 前言 如果你已经有了飞牛 NAS 系统,之前...
星哥带你玩飞牛NAS-4:飞牛NAS安装istore旁路由,家庭网络升级的最佳实践

星哥带你玩飞牛NAS-4:飞牛NAS安装istore旁路由,家庭网络升级的最佳实践

星哥带你玩飞牛 NAS-4:飞牛 NAS 安装 istore 旁路由,家庭网络升级的最佳实践 开始 大家好我是...

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

一言一句话
-「
手气不错
12.2K Star 爆火!开源免费的 FileConverter:右键一键搞定音视频 / 图片 / 文档转换,告别多工具切换

12.2K Star 爆火!开源免费的 FileConverter:右键一键搞定音视频 / 图片 / 文档转换,告别多工具切换

12.2K Star 爆火!开源免费的 FileConverter:右键一键搞定音视频 / 图片 / 文档转换...
星哥带你玩飞牛NAS-12:开源笔记的进化之路,效率玩家的新选择

星哥带你玩飞牛NAS-12:开源笔记的进化之路,效率玩家的新选择

星哥带你玩飞牛 NAS-12:开源笔记的进化之路,效率玩家的新选择 前言 如何高效管理知识与笔记,已经成为技术...
支付宝、淘宝、闲鱼又双叕崩了,Cloudflare也瘫了连监控都挂,根因藏在哪?

支付宝、淘宝、闲鱼又双叕崩了,Cloudflare也瘫了连监控都挂,根因藏在哪?

支付宝、淘宝、闲鱼又双叕崩了,Cloudflare 也瘫了连监控都挂,根因藏在哪? 最近两天的互联网堪称“故障...
一句话生成拓扑图!AI+Draw.io 封神开源组合,工具让你的效率爆炸

一句话生成拓扑图!AI+Draw.io 封神开源组合,工具让你的效率爆炸

一句话生成拓扑图!AI+Draw.io 封神开源组合,工具让你的效率爆炸 前言 作为天天跟架构图、拓扑图死磕的...
让微信公众号成为 AI 智能体:从内容沉淀到智能问答的一次升级

让微信公众号成为 AI 智能体:从内容沉淀到智能问答的一次升级

让微信公众号成为 AI 智能体:从内容沉淀到智能问答的一次升级 大家好,我是星哥,之前写了一篇文章 自己手撸一...