首页 » other » 自动化 » Cobbler部署详细教程基于Centos7.5

Cobbler部署详细教程基于Centos7.5

 

当前环境介绍:

当前系统Centos7.5,关闭selinux,关闭firewalld(或自行设置相应规则),关闭当前路由dhcp功能,如果是虚拟机安装则网络适配器要选择NAT模式(因为同一局域网多个DHCP服务会有冲突),本机IP地址192.168.50.101

前提:cobbler由epel源提供,所以需要事先配置epel的yum源。

一、安装epel源

我这里使用的是阿里的epel源,你也可以直接yum install epel-release

二、安装cobbler

三、启动相关服务并设置开机自启

四、检查cobbler配置

通过cobbler自带的命令检查,而后逐一按提示解决。

正常会看到如下内容:

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

Restart cobblerd and then run 'cobbler sync' to apply changes.

如上各问题的解决方法如下所示:

1、修改/etc/cobbler/settings文件,将默认server的127.0.0.1替换为本机IP地址

2、修改/etc/cobbler/settings文件,将默认next_server的127.0.0.1替换为本机IP地址

3、将/etc/xinetd.d/tftp中disable改为no

4、执行“cobbler get-loaders”命令即可

5、注释/etc/debmirror.conf文件中的@dists="sid";一行

6、注释/etc/debmirror.conf文件中的@arches="i386";一行

7、设置新系统默认的root密码,执行“openssl passwd -1 -salt $(openssl rand -hex 4)”生成密码,并用其替换/etc/cobbler/settings文件中default_password_crypted参数的值;

8、安装相应的程序包

五、重启cobblerd并同步检查

显示No configuration problems found. All systems go.(没有找到配置问题,一切正常)

六、通过cobbler来管理dhcp

七、配置dhcp服务

重启cobbler服务并同步配置

八、挂载导入镜像

我这里已经上传好了一个镜像在root目录下

导入镜像,cobbler会将镜像中所有安装文件拷贝到/var/www/cobbler/ks_mirror/NAME目录下,因此/var/www/cobbler目录必须具有足够的空间

导入镜像完成后,可用下面命令查看到刚才导入的镜像

九、编辑kickstart文件

我这里已经提前准备好了一份kickstart文件,文件内容如下

十、修改kickstart文件为自定义的CentOS-7.5-x86_64.cfg

用cobbler profile report查看,Kickstart已经改变

十一、重启xinetd服务

 

至此为止配置完成,部分参数可根据情况自行进行修改

PS:

后续安装系统时如果提示TFTP timeout,请检查xinetd服务是否启动,netstat -lntpu是否可以看到69端口
如果出现/sbin/dmsquash-live-root: line 286: printf: write error: No space left on device因为内存不足2G的原因

原文链接:Cobbler部署详细教程基于Centos7.5,转载请注明来源!

2