我是靠谱客的博主 幸福洋葱,最近开发中收集的这篇文章主要介绍Centos7上cobbler安装,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

主机IP: 192.168.137.210

1.关闭防火墙和SElinux

2.

安装epel源
[root@sky ~] # cd /etc/yum.repos.d/
[root@sky yum.repos.d] # yum -y install epel-release

安装cobbler

[root@sky yum.repos.d] # yum install -y cobbler cobbler-web tftp xinetd dhcp cman pykickstart debmirror syslinux net-tools
安装cobbler依赖包
[root@sky yum.repos.d] # yum install -y ed patch perl perl-Compress-Zlib perl-Digest-SHA1 perl-LockFile-Simple perl-libwww-perl fence-agents

3.设置服务开机启动
[root@sky yum.repos.d] # systemctl enable httpd.service
[root@sky yum.repos.d] systemctl enable dhcpd.service
[root@sky yum.repos.d] # systemctl enable xinetd.service
[root@sky yum.repos.d] systemctl enable cobblerd.service

查看服务开启状态
[root@sky yum.repos.d] # systemctl list-unit-files | grep -E "httpd|dhcpd|xinetd|cobblerd"
cobblerd.service                            enabled 
dhcpd.service                               enabled 
httpd.service                               enabled 
xinetd.service                              enabled 

修改项:

vim /etc/cobbler/settings 
server: 192.168.137.210
next_server: 192.168.137.210
manage_dhcp: 1

vim /etc/xinetd.d/tftp 

disable = no

vi /etc/cobbler/dhcp.template   蓝色为修改部分

subnet 192.168.137.0 netmask 255.255.255.0 {
     option routers             192.168.137.210;
     option domain-name-servers 192.168.137.210;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp         192.168.137.100 192.168.137.200;
     default-lease-time         21600;
     max-lease-time             43200;

     next-server                $next_server;

vi /etc/cobbler/modules.conf 

[dns]

module = manage_bind

[dhcp]

module = manage_isc

[tftpd]

module = manage_in_tftpd


执行检查

[root@my210 ~]#  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, 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.
2 : comment out 'dists' on /etc/debmirror.conf for proper debian support
3 : comment out 'arches' on /etc/debmirror.conf for proper debian support

解决:

第一个报错:

[root@my210 ~]# cobbler get-loaders

报错:

downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
Exception occured: <class 'urlgrabber.grabber.URLGrabError'>
Exception value: [Errno 14] curl#7 - "Failed connect to cobbler.github.io:443; Connection refused"
Exception Info:

  File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 82, in run

    rc = self._run(self)

解决:

配置cobber_web (Web页面默认不允许任何人登录,需要手动修改认证相关配置)

[root@my210 ~]# openssl passwd -1 -salt 'root' '123456'

$1$root$j0bp.KLPyr.u9kgQ428D10

vim /etc/cobbler/settings

default_password_crypted: "$1$root$j0bp.KLPyr.u9kgQ428D10"  --->替换为上面生成的

[root@my210 ~]#useradd admin

[root@my210 ~]#passwd admin

[root@my210 ~]#sed -i 's/admin = ""/admin = "admin"/' /etc/cobbler/users.conf

[root@my210 ~]#sed -i 's/module = authn_configfile/module = authn_pam/' /etc/cobbler/modules.conf

[root@my210 ~]#sed -i '14s/yes/no/' /etc/xinetd.d/tftp 
[root@my210 ~]#  systemctl restart xinetd.service
[root@my210 ~]# systemctl restart rsyncd.service
[root@my210 ~]# systemctl enable rsyncd.service

[root@my210 ~]# systemctl restart cobblerd.service
[root@my210 ~]# systemctl restart xinetd.service
[root@my210 ~]# cobbler sync
task started: 2018-06-30_013820_sync
task started (id=Sync, time=Sat Jun 30 01:38:20 2018)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
trying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
rendering Rsync files
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout: 
received on stderr: 
running: service dhcpd restart
received on stdout: 
received on stderr: Redirecting to /bin/systemctl restart dhcpd.service


running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

然后就不报错了:

[root@my210 ~]# cobbler get-loaders
task started: 2018-06-30_014327_get_loaders
task started (id=Download Bootloader Content, time=Sat Jun 30 01:43:27 2018)
path /var/lib/cobbler/loaders/README already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/COPYING.elilo already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/COPYING.yaboot already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/COPYING.syslinux already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/elilo-ia64.efi already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/yaboot already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/pxelinux.0 already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/menu.c32 already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/grub-x86.efi already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/grub-x86_64.efi already exists, not overwriting existing content, use --force if you wish to update

*** TASK COMPLETE ***

解决后两个报错:

vi /etc/debmirror.conf

注释掉

#@dists="sid";

#@arches="i386";


最后

[root@my210 ~]# cobbler check
No configuration problems found.  All systems go.

已经没有问题了

4.访问网址

https://192.168.137.210/cobbler_web




最后

以上就是幸福洋葱为你收集整理的Centos7上cobbler安装的全部内容,希望文章能够帮你解决Centos7上cobbler安装所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(40)

评论列表共有 0 条评论

立即
投稿
返回
顶部