centos8安装cobbler3.2
系统环境 centos8 stream
官方最新文档:1. Quickstart — Cobbler 3.4.0 documentation
cobbler代码仓库:GitHub - cobbler/cobbler: Cobbler is a versatile Linux deployment server
ip地址
[root@localhost ~]# cat /etc/redhat-release
CentOS Stream release 8
[root@localhost ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:46:cb:7b brd ff:ff:ff:ff:ff:ff
altname enp3s0
inet 10.66.8.111/16 brd 10.66.255.255 scope global noprefixroute ens160
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe46:cb7b/64 scope link noprefixroute
valid_lft forever preferred_lft forever
安装
dnf install epel-release -y
dnf module enable cobbler:3 -y
dnf install cobbler -y
cobbler配置
1.设置新系统默认密码
[root@localhost ~]# openssl passwd -1
Password:
Verifying - Password:
$1$NBSwa0Xy$VweeQYaNbeBlNNZyW5ztb/
修改配置文件 /etc/cobbler/settings.yaml
default_password_crypted: "$1$NBSwa0Xy$VweeQYaNbeBlNNZyW5ztb/"
2.1配置server,该配置为cobbler服务器的ip
server: 10.66.8.111
2.2配置next_server,该配置为dhcp/pxe作为下载网络引导文件的tftp服务器的ip,通常和cobbler服务器设置相同的ip
next_server: 10.66.8.111
3.配置dhcp管理
manage_dhcp: true
修改dhcp模板文件
vim /etc/cobbler/dhcp.template
修改内容如下
subnet 10.66.8.0 netmask 255.255.255.0 {
option routers 10.66.0.1;
option domain-name-servers 10.66.0.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 10.66.8.220 10.66.8.254;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server_v4;
}
4.启动cobbler服务
[root@localhost ~]# systemctl start cobblerd
[root@localhost ~]# systemctl status cobblerd
● cobblerd.service - Cobbler Helper Daemon
Loaded: loaded (/usr/lib/systemd/system/cobblerd.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2022-08-29 22:52:53 EDT; 3s ago
Process: 2441 ExecStartPost=/usr/bin/touch /usr/share/cobbler/web/cobbler.wsgi (code=exited, status=1/FAILURE)
Main PID: 2440 (cobblerd)
Tasks: 1 (limit: 25313)
Memory: 32.2M
CGroup: /system.slice/cobblerd.service
└─2440 /usr/bin/python3.6 -s /usr/bin/cobblerd -F
Aug 29 22:52:53 localhost.localdomain systemd[1]: Starting Cobbler Helper Daemon...
Aug 29 22:52:53 localhost.localdomain touch[2441]: /usr/bin/touch: cannot touch '/usr/share/cobbler/web/cobbler.wsgi': No such file or directory
Aug 29 22:52:53 localhost.localdomain systemd[1]: Started Cobbler Helper Daemon.
5.检查问题,并且进行同步
[root@localhost ~]# cobbler check
The following are potential configuration items that you may want to fix:
1: dhcpd is not installed
2: some network boot-loaders are missing from /var/lib/cobbler/loaders. 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, and yaboot.
3: reposync is not installed, install yum-utils or dnf-plugins-core
4: yumdownloader is not installed, install yum-utils or dnf-plugins-core
5: debmirror package is not installed, it will be required to manage debian deployments and repositories
6: ksvalidator was not found, install pykickstart
7: 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: dhcpd is not installed
dnf install dhcp-server -y
#问题2
dnf install syslinux -y
cp /usr/share/syslinux/{pxelinux.0,menu.c32} /var/lib/cobbler/loaders/
# 问题3,4: reposync is not installed, install yum-utils or dnf-plugins-core
dnf install yum-utils -y
#问题5可以忽略
# 问题6,7: ksvalidator was not found, install pykickstart
dnf install pykickstart fence-agents -y
同步并再次测试
cobbler sync
cobbler check
第一个已经配置过了,不知道为啥还提示,第二个可以忽略
[root@localhost ~]# cobbler check
The following are potential configuration items that you may want to fix:
1: some network boot-loaders are missing from /var/lib/cobbler/loaders. 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, and yaboot.
2: debmirror package is not installed, it will be required to manage debian deployments and repositories
Restart cobblerd and then run 'cobbler sync' to apply changes.
导入镜像
# root目录下有个centos7的镜像,挂载
mount -t iso9660 -o loop,ro /root/CentOS-7-x86_64-Minimal-2009.iso /mnt
[root@localhost ~]# cobbler import --name=centos7 --arch=x86_64 --path=/mnt
task started: 2022-08-29_230935_import
task started (id=Media import, time=Mon Aug 29 23:09:35 2022)
running python triggers from /var/lib/cobbler/triggers/task/import/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/import/pre/*
shell triggers finished successfully
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path /var/www/cobbler/distro_mirror/centos7-x86_64:
creating new distro: centos7-x86_64
trying symlink: /var/www/cobbler/distro_mirror/centos7-x86_64 -> /var/www/cobbler/links/centos7-x86_64
creating new profile: centos7-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/distro_mirror/centos7-x86_64 for centos7-x86_64
processing repo at : /var/www/cobbler/distro_mirror/centos7-x86_64
need to process repo/comps: /var/www/cobbler/distro_mirror/centos7-x86_64
looking for /var/www/cobbler/distro_mirror/centos7-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/distro_mirror/centos7-x86_64/repodata
*** TASK COMPLETE ***
测试安装系统
[root@localhost ~]# systemctl start tftp
[root@localhost ~]# systemctl status tftp
● tftp.service - Tftp Server
Loaded: loaded (/usr/lib/systemd/system/tftp.service; indirect; vendor preset: disabled)
Active: active (running) since Mon 2022-08-29 23:11:21 EDT; 9s ago
Docs: man:in.tftpd
Main PID: 5155 (in.tftpd)
Tasks: 1 (limit: 25313)
Memory: 204.0K
CGroup: /system.slice/tftp.service
└─5155 /usr/sbin/in.tftpd -s /var/lib/tftpboot
Aug 29 23:11:21 localhost.localdomain systemd[1]: Started Tftp Server.
重启客户机,看是否正常
sh /usr/share/cobbler/bin/mkgrub.sh
重启,重新进入引导,就可以发现菜单已经存在
手动选择进行操作
自动操作,根据mac地址,自动安装
cobbler system add --name=c7test --profile=centos7-X86_64 --interface=eth0 --mac=00:50:56:34:62:CD --ip-address=10.66.8.234 --netmask=255.255.0.0 --static=1 --gateway=10.66.0.1
[root@localhost cobbler]# cobbler system add --name=c7test --profile=centos7-X86_64 --interface=eth0 --mac=00:50:56:34:62:CD --ip-address=10.66.8.234 --netmask=255.255.0.0 --static=1 --gateway=10.66.0.1
[root@localhost cobbler]# cobbler system report --name=c7test
Name : c7test
Automatic Installation Template : <<inherit>>
Automatic Installation Template Metadata : {}
TFTP Boot Files : {}
Boot loader : <<inherit>>
Comment :
Enable gPXE? : <<inherit>>
Fetchable Files : {}
DHCP Filename Override : <<inherit>>
Gateway : 10.66.0.1
Hostname :
Image :
IPv6 Autoconfiguration : False
IPv6 Default Device :
Kernel Options : {}
Kernel Options (Post Install) : {}
Management Classes : <<inherit>>
Management Parameters : <<inherit>>
Name Servers : []
Name Servers Search Path : []
Netboot Enabled : True
Next Server Override : <<inherit>>
Owners : <<inherit>>
Power Management Address :
Power Management ID :
Power Identity File :
Power Management Options :
Power Management Password :
Power Management Type : ipmilan
Power Management Username :
Profile : centos7-X86_64
Internal Proxy : <<inherit>>
Redhat Management Key : <<inherit>>
Repos Enabled : False
Serial Baud Rate :
Serial Device # :
Server Override : <<inherit>>
Status : production
Template Files : {}
Virt Auto Boot : <<inherit>>
Virt CPUs : <<inherit>>
Virt Disk Driver Type : <<inherit>>
Virt File Size(GB) : <<inherit>>
Virt Path : <<inherit>>
Virt PXE Boot : 0
Virt RAM (MB) : <<inherit>>
Virt Type : <<inherit>>
Interface ===== : eth0
Bonding Opts :
Bridge Opts :
CNAMES : []
InfiniBand Connected Mode : False
DHCP Tag :
DNS Name :
Per-Interface Gateway :
Master Interface :
Interface Type : na
IP Address : 10.66.8.234
IPv6 Address :
IPv6 Default Gateway :
IPv6 MTU :
IPv6 Prefix :
IPv6 Secondaries : []
IPv6 Static Routes : []
MAC Address : 00:50:56:34:62:cd
Management Interface : False
MTU :
Subnet Mask : 255.255.0.0
Static : True
Static Routes : []
Virt Bridge :
ip正好是自己设定的信息
cobbler3.3测试安装成功,但是不知怎么回事,无法出现菜单