CentOS8安装Cobbler

dfddf因为我使用KVM虚拟机,虚拟机上ping不通外网,只能使用VSwitch,终于和外界可以通信了,为了安装cobbler,使用aliyun.com

[aliyun]
name=aliyun_centos8
baseurl=https://mirrors.aliyun.com/centos/8-stream/BaseOS/x86_64/os/
enabled=1
gpgcheck=0

参考 2. Install Guide — Cobbler 3.3.2 documentation

使用yum时不认识这一堆域名,无奈只能添加hosts

[root@localhost yum.repos.d]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

150.138.39.188    mirrors.aliyun.com
152.19.134.198    mirrors.fedoraproject.org
134.160.38.1       ftp.riken.jp
118.67.201.33      mirror.sabay.com.kh
101.6.15.130       mirrors.s.tuna.tsinghua.edu.cn
202.201.0.160      mirror.lzu.edu.cn
39.155.141.16      mirrors.bfsu.edu.cn
111.186.58.212     mirror.sjtu.edu.cn
180.209.98.28      mirrors.njupt.edu.cn
101.6.15.130       bfdmirrors.s.tuna.tsinghua.edu.cn

安装依赖的RPM

yum install createrepo_c httpd mod_swgi mod_ssl PyYAML rsync syslinux tftp-server dnf-plugins-core

yum install git make python3-devel python3-Cheetah3 python3-Sphinx python3-coverage openssl apache2 tftp

systemctl enable --now cobblerd tftp dhcpd httpd

修改cobbler的配置 vim /etc/cobbler/settings.yaml 

350 # this is the address of the Cobbler server -- as it is used
351 # by systems during the install process, it must be the address
352 # or hostname of the system as those systems can see the server.
353 # if you have a server that appears differently to different subnets
354 # (dual homed, etc), you need to read the --server-override section
355 # of the manpage for how that works.
356 server: 10.20.10.11        <-------修改成实际的PXE服务器的IP
357 
358 # If set to true, all commands will be forced to use the localhost address
359 # instead of using the above value which can force commands like
360 # cobbler sync to open a connection to a remote address if one is in the
361 # configuration and would traceback.
362 client_use_localhost: false


255 # if using Cobbler with manage_dhcp, put the IP address
256 # of the Cobbler server here so that PXE booting guests can find it
257 # if you do not set this correctly, this will be manifested in TFTP open timeouts.
258 next_server: 10.20.10.11  <----- DHCP服务器也在同一台VM上
259 
260 # settings for power management features.  optional.
261 # see https://github.com/cobbler/cobbler/wiki/Power-management to learn more
262 # choices (refer to codes.py):
263 #    apc_snmp bladecenter bullpap drac ether_wake ilo integrity
264 #    ipmilan lpar rsa virsh wti
265 power_management_default_type: 'ipmilan'

DHCP配置 vim /etc/cobbler/settings.yaml 

218 # set to true to enable Cobbler's DHCP management features.
219 # the choice of DHCP management engine is in /etc/cobbler/modules.conf
220 manage_dhcp: true        <---------设置使用DHCP管理

修改dhcp模板

 23 subnet 10.20.10.0 netmask 255.255.255.0 {
 24      option routers             10.20.10.1;
 25      option domain-name-servers 8.8.8.8;
 26      option subnet-mask         255.255.255.0;
 27      range dynamic-bootp        10.20.10.12 10.20.10.15;
 28      default-lease-time         21600;
 29      max-lease-time             43200;
 30      next-server                $next_server;

重新加载cobbler时依旧出错 cobbler get-recaders

[root@localhost tftpboot]# cobbler get-locaders
cobblerd does not appear to be running/accessible: ConnectionRefusedError(111, 'Connection refused')
Traceback (most recent call last):
  File "/usr/bin/cobbler", line 35, in 
    sys.exit(app.main())
  File "/usr/lib/python3.6/site-packages/cobbler/cli.py", line 851, in main
    rc = cli.run(sys.argv)
  File "/usr/lib/python3.6/site-packages/cobbler/cli.py", line 414, in run
    self.token = self.remote.login("", self.shared_secret)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1452, in __request
    verbose=self.__verbose
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1154, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1187, in single_request
    dict(resp.getheaders())
xmlrpc.client.ProtocolError: 

尽管我已经关闭了防火墙和Selinux, 执行cobbler check依旧出现同样的错误
systemctl stop firewared
setgenforce 0

[root@localhost tftpboot]# cobbler check
cobblerd does not appear to be running/accessible: ConnectionRefusedError(111, 'Connection refused')
Traceback (most recent call last):
  File "/usr/bin/cobbler", line 35, in 
    sys.exit(app.main())
  File "/usr/lib/python3.6/site-packages/cobbler/cli.py", line 851, in main
    rc = cli.run(sys.argv)
  File "/usr/lib/python3.6/site-packages/cobbler/cli.py", line 414, in run
    self.token = self.remote.login("", self.shared_secret)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1452, in __request
    verbose=self.__verbose
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1154, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1187, in single_request
    dict(resp.getheaders())
xmlrpc.client.ProtocolError: 

xmlrpc.client.ProtocolError:

yum install cobbler-web tftp-server dhcp-server httpd xinetd

启动服务

systemctl start httpd cobbler
systemctl enable httpd cobblerd

重新cobbler check

# cobbler check
The following are potential configuration items that you may want to fix:

1: SELinux is enabled. Please review the following wiki page for details on ensuring Cobbler works correctly in your SELinux environment:
    https://github.com/cobbler/cobbler/wiki/Selinux
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: 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
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.

一步一步解决上面这7条问题

你可能感兴趣的:(linux,centos,运维)