Centos7.6 next deployment Cobbler

1, Cobbler installation

1.1 basis of preparation environment

Check the current system version

[root@localhost ~]# cat /etc/redhat-release 

CentOS Linux release 7.6.1810 (Core) 

Close selinux firewall 

[root@localhost ~]# vim /etc/sysconfig/selinux 

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing - SELinux security policy is enforced.

# permissive - SELinux prints warnings instead of enforcing.

# disabled - No SELinux policy is loaded.

SELINUX=disabled

[root@localhost ~]# setenforce 0

Close ebtables firewalld firewall

[root@localhost ~]# systemctl stop ebtables firewalld

[root@localhost ~]# systemctl disable ebtables firewalld

Installed base epel source

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

[root@localhost ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

2. Install the cobbler Service

2.1 and various components mounted cobbler

[root@localhost ~]# yum -y install cobbler cobbler-web pykickstart httpd dhcp tftp rsync xinetd

Profile Overview 3. Cobbler installation

/ Etc / cobbler # profile directory

/ Etc / cobbler / sttings #cobbler main configuration file

Configuration template /etc/cobbler/dhcp.template #DHCP services

Configuration template /etc/cobbler/tftpd.template #TFTP services

Configuration template /etc/cobbler/rsync.template #Rsync services

/ Var / lib / cobbler / kickstarts # default file storage ksickstarts

/ Var / lib / cobbler / loaders # boot program stored in various

/ Var / www / cobbler # installation image directory system

/ Var / www / cobbler / images # Import mirror list system

/ Var / www / cobbler / ks_mirror # Import boot file system image

/ Var / www / cobbler / repo_mirror #yum source storage directory

/ Var / log / cobbler # log directory

/var/log/cobbler/install.log # client systems installation log

/var/log/cobbler/cobbler.log #cobbler log

4. Start httpd service and cobbler

[root@localhost ~]# systemctl start httpd cobblerd

[root@localhost ~]# systemctl enable httpd cobblerd

The detection performed cobbler

[root@localhost ~]# 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
 
 
 
 
 
 

                                 [root@localhost ~]# systemctl restart xinetd.service

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 : enable and start rsyncd.service with systemctl
 
 
 
 
 
 
       
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 cmanor fence-agents to use them
 
 
    
 
 
Restart cobblerd and then run 'cobbler sync' to apply changes.

6. Restart cobbler service, and cobbler sync synchronize

[root@localhost ~]# systemctl restart cobblerd
[root@localhost ~]# cobbler sync
 
 

7. Re-detection

[root@localhost ~]# cobbler check
No configuration problems found. All systems go. ## did not find configuration problems. All systems are go.
[root@localhost ~]# 
 
 

8. Using cobbler to manage, configure DHCP service, modify cobbler profile

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

9. The configuration of the DHCP stencil cobbler

[root@localhost ~]# vim /etc/cobbler/dhcp.template
subnet 192.168.1.0 netmask 255.255.255.0 {
     option routers             192.168.1.1;
     option domain-name-servers 192.168.1.1;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.1.100 192.168.1.254;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
 
 

10. restart the cobbler Service

[root@localhost ~]# systemctl restart cobblerd

 
 

11. Add the user management cobbler

[root@localhost ~]# htdigest -c /etc/cobbler/users.digest Cobbler cobbler
Adding password for cobbler in realm Cobbler.
New password: 
Re-type new password: 
[root@localhost ~]# systemctl restart cobblerd httpd
 
 

12. Open a web browser management interface

9532412c-726a-4456-bc56-cee34f3104b5

Solving steps:

1. SSL logs being given as follows:

[root@localhost ~]# tail -f /var/log/httpd/ssl_error_log
[Tue May 28 16:54:16.665181 2019] [:error] [pid 7001] [remote 192.168.1.109:44]     self._setup(name)
[Tue May 28 16:54:16.665190 2019] [:error] [pid 7001] [remote 192.168.1.109:44]   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup[Tue May 28 16:54:16.665205 2019] [:error] [pid 7001] [remote 192.168.1.109:44]     self._wrapped = Settings(settings_module)
[Tue May 28 16:54:16.665209 2019] [:error] [pid 7001] [remote 192.168.1.109:44]   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 110, in __init__[Tue May 28 16:54:16.665217 2019] [:error] [pid 7001] [remote 192.168.1.109:44]     mod = importlib.import_module(self.SETTINGS_MODULE)
[Tue May 28 16:54:16.665223 2019] [:error] [pid 7001] [remote 192.168.1.109:44]   File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module[Tue May 28 16:54:16.665445 2019] [:error] [pid 7001] [remote 192.168.1.109:44]     __import__(name)
[Tue May 28 16:54:16.665455 2019] [:error] [pid 7001] [remote 192.168.1.109:44]   File "/usr/share/cobbler/web/settings.py", line 89, in <module>
[Tue May 28 16:54:16.665500 2019] [:error] [pid 7001] [remote 192.168.1.109:44]     from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
[Tue May 28 16:54:16.665516 2019] [:error] [pid 7001] [remote 192.168.1.109:44] ImportError: cannot import name TEMPLATE_CONTEXT_PROCESSORS
 
 

2. Check the cobbler's configuration file py

[root@localhost ~]# sed -n '38,41p' /usr/share/cobbler/web/settings.py
if django.VERSION[0] == 1 and django.VERSION[1] < 4:
    ADMIN_MEDIA_PREFIX = '/media/'
else:
    STATIC_URL = '/media/'
[root@localhost ~]# sed -n '89p' /usr/share/cobbler/web/settings.py
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
 
 

3. The initial judgment should be pythone-django version of the problem

## download get-pip.py
[root@localhost ~]# wget http://bootstrap.pypa.io/get-pip.py
--2019-05-28 16:59:57--  http://bootstrap.pypa.io/get-pip.py
Resolving host bootstrap.pypa.io (bootstrap.pypa.io) ... 151.101.76.175, 2a04: 4e42: 12 :: 175
Connecting bootstrap.pypa.io (bootstrap.pypa.io) | 151.101.76.175 |: 80 ... connected.
HTTP request has been issued, awaiting response ... 301 Moved Permanently
Location: https: //bootstrap.pypa.io/get-pip.py [to follow the new URL]
--2019-05-28 16:59:58--  https://bootstrap.pypa.io/get-pip.py
Connecting bootstrap.pypa.io (bootstrap.pypa.io) | 151.101.76.175 |: 443 ... connected.
HTTP request has been issued, awaiting response ... 200 OK
Length: 1709825 (1.6M) [text / x-python]
Saving to: "get-pip.py"
 
 
100% [=============================================== ================================================== ========>] 1,709,825 84.2KB time / s with 22s   
 
 
2019-05-28 17:00:21 (76.6 KB / s) - Saved "get-pip.py" [1709825/1709825])
 
 
## calling a local python script run pip.py
[root@localhost ~]# python get-pip.py 
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after t
t date. A future version of pip will drop support for Python 2.7.Collecting pip
  Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-
y.whl (1.4MB)     |████████████████████████████████| 1.4MB 134kB/s 
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-non
any.whlInstalling collected packages: pip, wheel
Successfully installed pip-19.1.1 wheel-0.33.4
 
 
## pip installation
[root@localhost ~]# pip install Django==1.8.9
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after t
t date. A future version of pip will drop support for Python 2.7.Collecting Django==1.8.9
  Downloading https://files.pythonhosted.org/packages/a7/a2/f4e7926062f5c61d98e87b9d0365ca1a0fab6be599dbea90ce2fab27f395/Django-1.8.9-py2.py3-non
any.whl (6.2MB)     |████████████████████████████████| 6.2MB 65kB/s 
Installing collected packages: Django
  Found existing installation: Django 1.11.20
    Uninstalling Django-1.11.20:
      Successfully uninstalled Django-1.11.20
Successfully installed Django-1.8.9
 
 
Check the version number ## pip
[root@localhost ~]# python -c "import django; print(django.get_version())"
1.8.9

4. Restart the HTTP service

[root@localhost ~]# systemctl restart httpd
 
 

The browser interface can refresh

0ec1ee39-efb4-4751-8269-304391710a6c

79946132-7bde-453e-aeab-910eb8d3a128

Guess you like

Origin blog.51cto.com/10802692/2401660