cobbler System Automatically Installs Operating and Maintenance Tools

Keywords: Linux CentOS rsync network yum

cobbler System Automatically Installs Operating and Maintenance Tools

1.1 Cobbler Brief Introduction

Cobbler simplifies the system configuration by centralizing the tasks involved in setting up and managing an installation service, which is equivalent to Cobbler encapsulating DHCP, TFTP, XINTED and other services, combining PXE, kickstart and other installation methods, and realizing automatic installation of operating system.
The Cobbler program is written in python language and provides Cli and Web management forms.

1.2 Cobbler Installation Preparation

[root@lab01 ~]# cat /etc/centos-release  #View System Version
CentOS release 6.10 (Final)
[root@lab01 ~]# getenforce               #Close Selinux
Disabled
[root@lab01 ~]# service iptables stop    #Turn off firewall functionality

[root@lab01 ~]# yum -y install cobbler dhcp tftp-server pykickstart httpd  #Installing cobbler and dependency software

Cobbler Software is in epel Provided in the source, here yum Sohu has been configured fedora-epel Warehouse, the rest dhcp,tftp,httpd And so on are dependent software. pykickstart Provide inspection kickstart File grammar error function, these are best installed together.
[root@lab01 ~]# cd /etc/cobbler/        #After installation, the generated configuration file
[root@lab01 cobbler]# ls
auth.conf               iso             reporting           users.digest
cheetah_macros          ldap            rsync.exclude       version
cobbler_bash            modules.conf    rsync.template      zone.template
completions             mongodb.conf    secondary.template  zone_templates
dhcp.template           named.template  settings
dnsmasq.template        power           tftpd.template
import_rsync_whitelist  pxe             users.conf
[root@lab01 cobbler]# service httpd start      #You must start the httpd service first, then start the cobblerd server, or you will report an error.
Starting httpd: 
[root@lab01 cobbler]# service cobblerd start
Starting cobbler daemon:                                   [  OK  ]
[root@lab01 cobbler]# 

[root@lab01 /]# cobbler check                  # The reason for this error is unknown. The solution is to restart the cobblerd service and run the command again.
Traceback (most recent call last):
  File "/usr/bin/cobbler", line 36, in <module>
    sys.exit(app.main())
  File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 657, in main
    rc = cli.run(sys.argv)
  File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 270, in run
    self.token         = self.remote.login("", self.shared_secret)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
[root@lab01 /]# service cobblerd restart       # Restart the cobblerd service and continue to execute the check command.
Stopping cobbler daemon:                                   [  OK  ]
Starting cobbler daemon:                                   [  OK  ]
[root@lab01 /]# cobbler check
[root@lab01 /]# 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 : 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.
4 : change 'disable' to 'no' in /etc/xinetd.d/rsync
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.

According to the above error, modify the configuration file / etc/cobbler/settings to resolve.

[root@lab01 /]# vi /etc/cobbler/settings    #Modify the following fields
1. server 192.168.36.30,Modify the available network card address corresponding to the host. localhost Address other than that.
2. next_server 192.168.36.30,Modify to correspond pxe Server ip Address.
3. Obtain pxelinux.0 and menu.c32 Papers.
4. modify etc/xinetd.d/rsync Document disable The parameter is modified to disable = no. 
5. Annotate/etc/debmirror.conf In the relevant items, the error can be ignored without affecting.
6. Generate a password to replace the default password,openssl passwd -1 Generated passwords to replace default_password_crypted The value of the field.
7. Power management is relevant and negligible.
//Complete the above modifications, restart cobbler, and then run the cobbler sync command.  

[root@lab01 /]# service cobblerd restart
Stopping cobbler daemon:                                   [  OK  ]
Starting cobbler daemon:                                   [  OK  ]
[root@lab01 /]# cobbler check              # The following errors are negligible and do not affect subsequent operations.
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

[root@lab01 /]# cobbler sync               # Configuration of synchronous cobbler.
task started: 2019-04-21_194919_sync
task started (id=Sync, time=Sun Apr 21 19:49:19 2019)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
copying bootloaders
......

So far, the cobbler program has been installed and started normally.

1.3 Configuration of dhcp service and tftp service

[root@lab01 dhcp]# cat dhcpd.conf         # dchp service configuration, if management_dhcp:1 is set in / etc/cobbler/setting s, it means that DHCP is managed by cobbler. By default, 0 is managed manually. Manual management is adopted here.
ddns-update-style none;
ignore client-updates;
subnet 192.168.36.0 netmask 255.255.255.0 {
  range 192.168.36.50 192.168.36.80;
  option routers 192.168.36.60;
  default-lease-time 86400;
  max-lease-time 259200;
  filename "pxelinux.0";                   #/ pxelinux.0 file in var/lib/tftpboot/directory
  next-server 192.168.36.30;               #Address of tftp server
}  

[root@lab01 /]# vi /etc/xinetd.d/tftp      #Open tftp service
service tftp
{
        disable = no
        socket_type             = dgram
        ......

1.4 Mount the system image and import it.

[root@lab01 /]# mount /dev/sr0 /mnt/dvd      #Mounted CD
[root@lab01 /]# cobbler import --path=/mnt/dvd --name=centos6.10 --arch=x86_64          
//Waiting for the import to complete indicates that distro generation is complete.

[root@lab01 /]# cobbler distro list 
CentOS6.10-x86_64

1.5 Provide kickstart files and profile

Provide KS files that match the version of the installation system, and then provide profile s. In the process of generating distro after importing the installation image, Cobbler specifies a default kickstart file for the image and automatically installs sample_end.ks under / var/lib/cobbler/kickstart.

[root@lab01 kickstarts]# cobbler profile edit --name=CentOS-6.10-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-6.10-x86_64.cfg

1.6 Start Automation Installation

After the above steps are completed, confirm the experimental results of each step, and then open another device for network start-up to verify whether the device can be installed automatically.

Posted by jervo on Sun, 21 Apr 2019 21:33:34 -0700