系统相关
首页 > 系统相关> > cobbler批量搭建CentOS 7.6

cobbler批量搭建CentOS 7.6

作者:互联网

现场环境


操作系统:CentOS 7.6_1810 64位  桌面环境:gonme

centos 6和7模板同时使用搭建步骤一样,centos7默认anaconda-ks.cfg简单配置就可以使用。centos6需要自行修改ks.cfg文件。

以下安装的模板也是gonme环境,网上太多的最小化ks.cfg模板可以自行去找

在虚拟机上bios和uefi可以正常安装。cobbler批量安装RH2288V5_uefi模式安装失败,原因cobbler默认下载的grub-x86_64.uefi(大小242k)适用于Fedora 15系统 也可以正常安装centos7.6
但无法安装uefi,需下载最新版grub-x86_64.uefi(大小为252k)https://github.com/cobbler/cobbler-loaders/tree/master/grub-0.97-99.el6下载网址


一、添加第三方源,仅为安装cobbler cobbler-web

[root@vip ~]# rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm

[root@vip ~]# yum makecache //元数据缓存已建立

二、安装cobbler以及相关的软件

[root@vip ~]# yum -y install httpd tftp dhcp cobbler cobbler-web pykickstart xinetd fence-agents

三、启动相关服务

[root@vip ~]# systemctl start httpd
[root@vip ~]# systemctl enable httpd

[root@vip ~]# netstat -luntp |grep httpd

tcp6 0 0 :::80 :::* LISTEN 12330/httpd
tcp6 0 0 :::443 :::* LISTEN 12330/httpd

[root@vip ~]# systemctl start cobblerd
[root@vip ~]# systemctl enable cobblerd

[root@vip ~]# cobbler check                    //查看需要处理的问题
The following are potential configuration items that you may want to fix:

//解决以下7个问题,其中6可以不需处理

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 : enable and start rsyncd.service with systemctl
6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
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.

四、处理以上报错问题

[root@vip ~]# cp /etc/cobbler/settings /etc/cobbler/settings.bak
[root@vip ~]# vim /etc/cobbler/settings
(处理1、2、7报错)
101行 default_password_crypted: "$6$u6GCUj1UI9Qisqzx$sciSIcF1HIBlgFzqrx56hio9KiCh8fO3ytyxRJnG3hWKfSwSlLkPpw8nSuI9pRHOeJFXV4LlQxE9MfPWyvSan1"
242行 manage_dhcp: 0 //默认0修改为1
278行 next_server: 172.118.0.18 //填写本机IP
390行 server: 172.118.0.18 //填写本机IP

(处理3报错)
[root@vip ~]# vim /etc/xinetd.d/tftp
disable = yes改为no
[root@vip ~]# systemctl start tftp
[root@vip ~]# systemctl enable tftp

(处理4报错)
[root@vip ~]# cobbler get-loaders
task started: 2019-11-26_230905_get_loaders
task started (id=Download Bootloader Content, time=Tue Nov 26 23:09:05 2019)
downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
downloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE *** //提示为此行为正常

(处理5报错)

[root@vip ~]# systemctl start rsyncd.service
[root@vip ~]# systemctl enable rsyncd.service

五、配置cobbler_DHCP

[root@vip ~]# cp /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.bak
[root@vip ~]# vim /etc/cobbler/dhcp.template
//只需要修改此处即可
subnet 172.118.0.0 netmask 255.255.255.0 {
option routers 172.118.0.2;
option domain-name-servers 172.118.0.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 172.118.0.100 172.118.0.254;

六、重启cobblerd

[root@vip ~]# systemctl restart cobblerd.service


*** TASK COMPLETE *** //结尾为此行为正常

[root@vip ~]# cobbler check //检查cobbler
The following are potential configuration items that you may want to fix:

//仅出现如下可以不用管

1 : debmirror package is not installed, it will be required to manage debian deployments and repositories

七、挂载光驱,

[root@vip ~]# mount /dev/sr0 /mnt

[root@vip ~]# cobbler import --path=/mnt --name=Centos7.6 --arch=x86_64            //cobbler导入镜像

*** TASK COMPLETE *** //此行为正常

八、导入自定义kickstarts

[root@vip ~]# cp /root/anaconda-ks.cfg /var/lib/cobbler/kickstarts/centos7.6.cfg

[root@vip ~]# vim /var/lib/cobbler/kickstarts/centos7.6.cfg


# Use CDROM installation media
#cdrom
install
url --url=$tree
# License agreement
eula --agreed
selinux --disabled
firewall --disabled
reboot
[root@vip ~]# chmod 644 /var/lib/cobbler/kickstarts/centos7.6.cfg
[root@vip ~]# cobbler profile edit --name=Centos7.6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7.6.cfg //导入自定义ks


[root@vip ~]# cobbler sync        //同步cobbler,cobbler sync 每次执行同步命令需要修改efidefault 等待时间

九、检查

[root@vip ~]# cobbler report
distros:
==========
Name : Centos7.6-x86_64
Architecture : x86_64
TFTP Boot Files : {}
Breed : redhat
Comment :
Fetchable Files : {}
Initrd : /var/www/cobbler/ks_mirror/Centos7.6-x86_64/images/pxeboot/initrd.img
Kernel : /var/www/cobbler/ks_mirror/Centos7.6-x86_64/images/pxeboot/vmlinuz
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/Centos7.6-x86_64'}
Management Classes : []
OS Version : rhel6
Owners : ['admin']
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Template Files : {}


profiles:
==========
Name : Centos7.6-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : Centos7.6-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/centos7.cfg
Kickstart Metadata : {}
Management Classes : []
Management Parameters : <<inherit>>
Name Servers : []
Name Servers Search Path : []
Owners : ['admin']
Parent Profile :
Internal proxy :
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Repos : []
Server Override : <<inherit>>
Template Files : {}
Virt Auto Boot : 1
Virt Bridge : xenbr0
Virt CPUs : 1
Virt Disk Driver Type : raw
Virt File Size(GB) : 5
Virt Path :
Virt RAM (MB) : 512
Virt Type : kvm


systems:
==========

repos:
==========

images:
==========

mgmtclasses:
==========

packages:
==========

files:
==========
[root@vip ~]# cobbler report | grep "^Kickstart.*cfg$"
Kickstart : /var/lib/cobbler/kickstarts/centos7.6.cfg

十、自定设置等待时间

[root@vip ~]# cd /var/lib/tftpboot/grub/
[root@vip grub]# vim efidefault
timeout=30

标签:lib,CentOS,loaders,vip,cobbler,var,7.6,root
来源: https://www.cnblogs.com/tkgglong/p/12357242.html