Rhel7.4系统部署cobbler

cobbler安装

一、系统信息:

[root@openstack ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.4 (Maipo)

[root@openstack ~]# uname -r
3.10.0-693.el7.x86_64

 [root@openstack ~]# ifconfig ens33 |awk -F "[ :]+" 'NR==2 {print $3}'
192.168.209.7
[root@openstack ~]# systemctl stop firewalld
[root@openstack ~]# systemctl disable firewalld
[root@openstack ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@openstack ~]# getenforce
Disabled
二、开始安装cobbler

1、安装依赖包
[root@openstack ~]# yum -y install epel-release
[root@openstack ~]# yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd

2、启动相关服务
[root@openstack ~]# systemctl start cobblerd
[root@openstack ~]# systemctl enable cobblerd
[root@openstack ~]# systemctl enable httpd
[root@openstack ~]# systemctl start httpd

3、检查配置是否有问题
[root@openstack ~]# cobbler check
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 : 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
4 : change 'disable' to 'no' in /etc/xinetd.d/tftp
5 : 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.
6 : change 'disable' to 'no' in /etc/xinetd.d/rsync
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : 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
9 : 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.
按照提示解决问题:
问题一:

[root@openstack ~]# sed -i 's/^server: 127.0.0.1/server: 192.168.209.7/' /etc/cobbler/settings  # 修改server的ip地址为本机ip
问题二:
[root@openstack ~]# sed -i 's/^next_server: 127.0.0.1/next_server: 192.168.209.7/' /etc/cobbler/settings # TFTP Server 的IP地址
问题四:
[root@openstack ~]# vim /etc/xinetd.d/tftp

# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        disable                 = no
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -B 1380 -v -s /var/lib/tftpboot
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
问题5:
[root@openstack ~]# cobbler get-loaders  # 下载缺失的文件
问题6:
[root@openstack ~]# systemctl enable rsyncd
[root@openstack ~]# systemctl start rsyncd
问题8:
[root@tiandong68 ~]# openssl passwd -1 -salt thunder thunder  8
$1$thunder$XsMPVXOj.YfZ3A66jbr5a1

[root@openstack ~]# vim /etc/cobbler/settings
101 default_password_crypted: "$1$123456$wOSEtcyiP2N/IfIl15W6Z0"
问题7和9不用处理,问题三把selinux设置为disable就可以了。

重启cobbler然后再次check

[root@openstack ~]# systemctl restart cobblerd.service
[root@openstack ~]# cobbler check    这两个问题可以暂时忽略
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
2 : 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.

4、配置cobbler dhcp

修改cobbler配置

[root@openstack ~]# vim /etc/cobbler/settings
242 manage_dhcp: 1

修改/etc/cobbler/dhcp.template文件
subnet 192.168.209.0 netmask 255.255.255.0 {
     option routers             192.168.209.254 ;
     option domain-name-servers 119.29.29.29;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.209.100 192.168.209.254;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
重启cobbler并同步配置,修改完dhcp必须sync同步配置
[root@openstack ~]# systemctl restart cobblerd.service
[root@openstack ~]# cobbler sync
task started: 2019-01-10_101902_sync
task started (id=Sync, time=Thu Jan 10 10:19:02 2019)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/test
removing: /var/www/cobbler/images/Centos-7.4-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/images/test
removing: /var/lib/tftpboot/images/Centos-7.4-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
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 files for distro: test
trying hardlink /var/www/cobbler/ks_mirror/Centos-7.4-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/test/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/Centos-7.4-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/test/initrd.img
copying files for distro: Centos-7.4-x86_64
trying hardlink /var/www/cobbler/ks_mirror/Centos-7.4-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/Centos-7.4-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/Centos-7.4-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/Centos-7.4-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: test
trying hardlink /var/www/cobbler/ks_mirror/Centos-7.4-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/test/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/Centos-7.4-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/test/initrd.img
Writing template files for test
copying files for distro: Centos-7.4-x86_64
trying hardlink /var/www/cobbler/ks_mirror/Centos-7.4-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/Centos-7.4-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/Centos-7.4-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/Centos-7.4-x86_64/initrd.img
Writing template files for Centos-7.4-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
processing boot_files for distro: test
processing boot_files for distro: Centos-7.4-x86_64
cleaning link caches
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.manage_genders
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
[root@openstack ~]# netstat -lnup|grep dhcp
udp        0      0 0.0.0.0:67              0.0.0.0:*                           4665/dhcpd



猜你喜欢

转载自www.cnblogs.com/winter1519/p/10248351.html
今日推荐