Cobbler自动化部署-Cobbler基础配置三

今天我们来看一下Cobbler的基础配置,当我们无论使用在线安装方式还是离线安装方式安装完成后,都需要做下面的配置才可以使用Cobbler进行Linux系统的分发工作。

检查服务状态

检查相关服务的状态并将服务设置成开机启动

systemctl enable xinetd && systemctl start xinetd
systemctl enable httpd.service && systemctl start httpd.service
systemctl enable cobblerd.service && systemctl start cobblerd.service
systemctl enable rsyncd && systemctl start rsyncd

检查服务启动状态

<code>systemctl status httpd cobblerd</code>
Cobbler自动化部署-Cobbler基础配置三
服务成功启动

Cobbler检查

cobbler check

当我们服务状态都没问题后,我们要来检查Cobbler的状态了,Cobbler提供了一个命令用来检查环境的健康状态,哪里有问题会有相应的提示,这个还是很人性化的。如果你是按照我们的文章一步一步来安装的话,那么我们遇到的提示应该是一样的。下面我们就逐一的解决每个问题。

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 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.


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

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.

我们需要修改/etc/cobbler/settings文件中server的IP不能使用本地IP地址。此时我们打开settings文件找到390行,将默认的Server:127.0.0.1修改为Server:192.168.31.89(此IP为你的cobbler IP)

Cobbler自动化部署-Cobbler基础配置三
修改配置文件

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.

此问题一样需要修改Setting文件,将next_server:127.0.0.1修改成next_server:192.168.31.89,此参数在278行

Cobbler自动化部署-Cobbler基础配置三
修改配置文件

此时我们先不要关闭Setting文件,我们还需要修改一下dhcp、rsync参数。

将默认的manage_dhcp:0修改成manage_dhcp:1 使用cobbler来管理dhcp服务

Cobbler自动化部署-Cobbler基础配置三
修改配置文件
Cobbler自动化部署-Cobbler基础配置三
修改配置文件

3 : change ‘disable’ to ‘no’ in /etc/xinetd.d/tftp

打开/etc/xinetd.d/tftp,将配置文件中的disable = yes 修改成disable = no

Cobbler自动化部署-Cobbler基础配置三
修改配置文件

4 : 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服务器上执行cobbler get-loaders,如果你是离线安装的可以在文末关注公众号进行下载对应文件,将文件上传到cobbler服务器的/var/lib/cobbler/loaders目录下即可。

Cobbler自动化部署-Cobbler基础配置三
cobbler get-loaders

5 : comment out ‘dists’ on /etc/debmirror.conf for proper debian support
6 : comment out ‘arches’ on /etc/debmirror.conf for proper debian support

这两个问题我们一起处理,需要打开/etc/debmirror.conf文件将@dists=”sid”;、@arches=”i386″;注释掉

Cobbler自动化部署-Cobbler基础配置三
修改配置文件

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

设置我们的默认密码,此密码是加密的需要将生成出来的密码填写到/etc/cobbler/settings文件中

openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'
openssl passwd -1 -salt '123456' 'pangshare.com'

将default_password_crypted:参数修改成刚刚生成的密码

Cobbler自动化部署-Cobbler基础配置三
修改配置文件

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相关配置

修改dhcp.template

打开/etc/cobbler/dhcp.template,根据实际网络情况修改此处的配置。

Cobbler自动化部署-Cobbler基础配置三
修改配置文件

把我们修改的配置文件保存好后,我们需要同步一下cobbler配置。执行cobbler sync,对于这个命令我们每次修改完cobbler的配置文件都需要同步一下。

Cobbler自动化部署-Cobbler基础配置三
修改配置文件

挂载iso镜像

我们将CentOS-7-x86_64-Minimal-1908.iso上传至/opt路径下并挂载到/mnt路径下

Cobbler自动化部署-Cobbler基础配置三
挂载iso镜像

导入iso镜像

将挂载上的iso导入到cobbler中

cobbler import --path=/mnt/ --name=Centos7 --arch=x86_64

执行cobbler list查看导入内容

Cobbler自动化部署-Cobbler基础配置三
cobbler list

此时Cobbler都是默认的配置,我们就可以进行测试了,创建一台VM,通过PXE启动我们就会看到启动菜单了,选择我们刚刚创建的Centos7-x86_64进行系统安装。

Cobbler自动化部署-Cobbler基础配置三
PXE启动菜单

获取cobbler get-loaders,回复 cobbler 获取

Cobbler自动化部署-Cobbler基础配置三
关注公众号:胖哥叨逼叨

此文章为原创文章,作者:胖哥叨逼叨,如若转载,请与我联系并注明出处:https://www.pangshare.com/2485.htm

(1)
打赏 微信扫一扫 微信扫一扫
上一篇 2020年9月3日 下午5:10
下一篇 2020年9月7日 下午10:17

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注