专栏首页运维之美使用 Cobbler 批量自动化部署 CentOS / Ubuntu

使用 Cobbler 批量自动化部署 CentOS / Ubuntu

本文主要讲解通过 CentOS 7.6 Minimal + Cobbler 自动化安装 CentOS / Ubuntu 。

准备

从阿里镜像站,下载 CentOS-7-x86_64-Minimal-1810.iso 和 Ubuntu-16.04.5-desktop-amd64.iso,使用 VMware 创建一台 CentOS 7 的虚拟机。

环境初始化

1. 将软件源改为阿里源

# yum源

# 备份系统默认源
[root@localhost ~]# mkdir /etc/yum.repos.d/old && mv /etc/yum.repos.d/C* /etc/yum.repos.d/old/
[root@localhost ~]# yum clean all

# 设置阿里yum源
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost ~]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

# pip源(2.8.4的bug)
[root@localhost ~]# mkdir ~/.pip
[root@localhost ~]# cat > ~/.pip/pip.conf << EOF
[global]
trusted-host=mirrors.aliyun.com
index-url=https://mirrors.aliyun.com/pypi/simple/
EOF

2. 配置 SSH

默认 ssh_config 启用了 DNS 解析,导致每次远程 SSH 时都特别慢。

[root@localhost ~]# sed -i 's%#UseDNS yes%UseDNS no%' /etc/ssh/sshd_config 
[root@localhost ~]# service sshd restart

3. 禁用 SElinux

如果要在 Centos 上开启 Cobbler 的支持,需要用 root 用户运行 setsebool 配置 SELinux 上下文规则用于提供引导镜像。由于 SElinux 的配置比较复杂,所以这里就直接禁用了 SELinux。

[root@localhost ~]# sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config  
[root@localhost ~]# setenforce 0

4. 配置对应防火墙规则

# TFTP
[root@localhost ~]# firewall-cmd --zone=public --add-port=69/tcp --permanent
[root@localhost ~]# firewall-cmd --zone=public --add-port=69/udp --permanent

# HTTPD
[root@localhost ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
[root@localhost ~]# firewall-cmd --zone=public --add-port=443/tcp --permanent

# Cobbler
[root@localhost ~]# firewall-cmd --zone=public --add-port=25150/tcp --permanent
[root@localhost ~]# firewall-cmd --zone=public --add-port=25150/udp --permanent

# Koan 如果未用到,可以不开放
[root@localhost ~]# firewall-cmd --zone=public --add-port=25151/tcp --permanent

# Samba Window 安装需要用到 Samba,否则可以不开放
[root@localhost ~]# firewall-cmd --zone=public --add-port=139/tcp --permanent
[root@localhost ~]# firewall-cmd --zone=public --add-port=445/tcp --permanent
[root@localhost ~]# firewall-cmd --zone=public --add-port=137/udp --permanent
[root@localhost ~]# firewall-cmd --zone=public --add-port=138/udp --permanent

# 更新防火墙规则
[root@localhost ~]# firewall-cmd --reload

# 查看所有打开的端口
[root@localhost ~]# firewall-cmd --zone=public --list-ports

安装 Cobbler

  • 安装依赖软件
[root@localhost ~]# yum install -y cobbler cobbler-web dhcp tftp-server pykickstart httpd xinetd
  • 设置开机自启动
[root@localhost ~]# systemctl enable httpd
[root@localhost ~]# systemctl enable xinetd
[root@localhost ~]# systemctl enable rsyncd
[root@localhost ~]# systemctl enable tftp
[root@localhost ~]# systemctl enable cobblerd
  • 启动服务
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl start xinetd
[root@localhost ~]# systemctl start tftp
[root@localhost ~]# systemctl start cobblerd
  • 检查配置
[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
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 : debmirror package is not installed, it will be required to manage debian deployments and repositories
7 : 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
8 : 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.

下面简单对检查的结果中的问题做一个说明:

1. 第一、二项:设置 cobbler_ip 和 next_server

cobbler_ip 为 cobbler 主机 IP。

next_server 是 DHCP 主机 IP,本次实验 DHCP 和 Cobbler 是同一台主机。

[root@localhost ~]# export cobbler_ip=192.168.0.12
[root@localhost ~]# sed -i "s%^server: 127.0.0.1%server: ${cobbler_ip}%g" /etc/cobbler/settings
[root@localhost ~]# sed -i "s%^next_server: 127.0.0.1%next_server: ${cobbler_ip}%g" /etc/cobbler/settings

2. 第三项:配置 SELinux 和防火墙

可以忽略,因为已经关闭 SELinux 和配置防火墙了。

3. 第四项:开启 tftp 功能

[root@localhost ~]# sed -i '/disable\>/s/\<yes\>/no/' /etc/xinetd.d/tftp

4. 第五项:下载 bootload

[root@localhost ~]# cobbler get-loaders

5. 第六项:下载 Ubuntu 本地包镜像

如果不需安装 Ubuntu 的,可以修改。

[root@localhost ~]# yum install -y debmirror
[root@localhost ~]# sed -i 's%^@dists="sid"%#@dists="sid"%g;s%@arches="i386"%#@arches="i386"%g' /etc/debmirror.conf

6. 第七项:设置安装系统后的 root 密码

[root@localhost ~]# export root_pwd=$(openssl passwd -1 -salt `openssl rand 15 -base64` 'Abcd1234!@#$')
[root@localhost ~]# sed -i "s%^default_password_crypted.*%default_password_crypted: \"${root_pwd}\"%g" /etc/cobbler/settings

7. 第八项:安装电源管理模块(非必选)

cman 和 ence-agents 二选一即可,此处忽略。

8. 其余相关部分的修改

# 修改相应配置文件
[root@localhost ~]# sed -i "s%manage_dhcp: 0%manage_dhcp: 1%g" /etc/cobbler/settings
[root@localhost ~]# sed -i "s%pxe_just_once: 0%pxe_just_once: 1%g" /etc/cobbler/settings

# 修改 DHCP
[root@localhost ~]# vi /etc/cobbler/dhcp.template
\#仅列出修改过的部分
\......
subnet 192.168.0.0 netmask 255.255.255.0 {
     option routers             192.168.0.1;
     option domain-name-servers 192.168.0.1;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.0.100 192.168.0.200;
\......

9. 重启相关服务

[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# systemctl restart xinetd
[root@localhost ~]# systemctl restart tftp
[root@localhost ~]# systemctl restart cobblerd

10. 再次校验,发现只有两条信息了,忽略即可。

[root@localhost ~]# 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 : 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.
  • 执行 cobbler sync 同步信息
[root@localhost ~]# cobbler sync
task started: 2019-02-22_184309_sync
task started (id=Sync, time=Fri Feb 22 18:43:09 2019)
running pre-sync triggers
# ....忽略
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
  • 解决 Cobbler-Web 中的 Bug

打开 https://${cobbler_ip}/cobbler_web 会导致打开后报500 Internal Server Error 错误。

这是 2.8.4 的一个bug,是因为 Django 版本过高了,不兼容。解决方法:

[root@localhost ~]# yum install -y python-pip
[root@localhost ~]# pip2.7 install -U django==1.9.13
[root@localhost ~]# systemctl restart cobblerd
  • 设置用户名密码

默认用户名密码是 cobbler/cobbler。

[root@localhost ~]# htdigest -c /etc/cobbler/users.digest Cobbler cobbler # 后边这个是用户名
[root@localhost ~]# systemctl restart cobblerd

再次访问 https://${cobbler_ip}/cobbler_web

挂载镜像

通过 Winscp,Mobaxterm 等将 Ubuntu 和 Centos 镜像上传到 Cobbler 服务器上的 /tmp/ 目录下,其中 net.ifnames=0 biosdevname=0 noipv6 是让网卡统一命名成 eth0。

[root@localhost ~]# mount -t iso9660 -o loop /tmp/CentOS-7-x86_64-Minimal-1810.iso /mnt/
[root@localhost ~]# cobbler import --name=CentOS-7.6.1810-x86_64 --path=/mnt/ --arch=x86_64
[root@localhost ~]# cobbler profile edit --name=CentOS-7.6.1810-x86_64 --kopts='net.ifnames=0 biosdevname=0'
[root@localhost ~]# mount -t iso9660 -o loop /tmp/ubuntu-16.04.5-server-amd64.iso /mnt/
[root@localhost ~]# cobbler import --name=ubuntu-16.04.5-server-x86_64 --path=/mnt/ --arch=x86_64

测试 PXE 安装系统

在 Vmware 创建两个虚拟机 (选择空白盘),内存2G、CPU 2核、磁盘 20G。创建完后,记得打个快照,后边做实验失败后,直接恢复即可。

选择 CentOS,然后回车,系统将自动安装。

优化配置

  • CentOS 的 KS 配置文件
[root@localhost ~]# cobbler profile report --name CentOS-7.6.1810-x86_64
Name                           : CentOS-7.6.1810-x86_64
#//...忽略
Kickstart                      : /var/lib/cobbler/kickstarts/sample_end.ks
#//...忽略
#//复制一份ks,并且进行修改
[root@localhost ~]# cp /var/lib/cobbler/kickstarts/sample_end.ks /var/lib/cobbler/kickstarts/centos-7-6.ks
[root@localhost ~]# cobbler profile edit --name CentOS-7.6.1810-x86_64  --kickstart=/var/lib/cobbler/kickstarts/centos-7-6.ks
[root@localhost ~]# cp /var/lib/cobbler/kickstarts/sample.seed /var/lib/cobbler/kickstarts/ubuntu-16-4-5.seed
[root@localhost ~]# cobbler profile edit --name ubuntu-16.04.5-server-x86_64  --kickstart=/var/lib/cobbler/kickstarts/ubuntu-16-4-5.seed

CentOS 的 KS 语法可以参考这里: a.) KICKSTART 语法参考 ( https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-syntax)

b.) 运维工作笔记-Cobbler 配置文件 (https://www.kancloud.cn/devops-centos/centos-linux-devops/392369)

  • Ubuntu 的 Preseed 配置文件

Cobbler 代码中检测到是 Ubuntu 时,会自动将 KS 换成 URL (强制走 Preseed )。

Ubuntu 的 Preseed 可以参考这里:

a.) Preseed 语法参考 (https://www.debian.org/releases/stable/amd64/apbs04.html.zh-cn)

下面是一个 Preseed 文件的示例:

$ cat /var/lib/cobbler/kickstarts/ubuntu-16-4-5.seed

# Mostly based on the Ubuntu installation guide
# https://help.ubuntu.com/16.04/installation-guide/
# Debian sample
# https://www.debian.org/releases/stable/example-preseed.txt
## Part 1. Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US
# Keyboard selection.
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/toggle select No toggling
d-i keyboard-configuration/layoutcode string us
d-i keyboard-configuration/variantcode string

## Part 2. Network configuration
# netcfg will choose an interface that has link if possible. This makes it
# skip displaying a list if there is more than one interface.
#set $myhostname = $getVar('hostname',$getVar('name','cobbler')).replace("_","-")
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string $myhostname
# If non-free firmware is needed for the network or other hardware, you can
# configure the installer to always try to load it, without prompting. Or
# change to false to disable asking.
# d-i hw-detect/load_firmware boolean true
## Part 3 NTP/Time
# NTP/Time Setup
d-i time/zone string Asia/Shanghai
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server  string ntp1.aliyun.com

## Part 4. Mirror settings
# Setup the installation source
d-i mirror/country string manual
d-i mirror/http/hostname string $http_server
d-i mirror/http/directory string $install_source_directory
d-i mirror/http/proxy string
#set $os_v = $getVar('os_version','')
#if $breed == "ubuntu" and $os_v and ($os_v.lower()[0] > 'p' or $os_v.lower()[0] < 'd')
# Required at least for ubuntu 12.10+ , so test os_v is higher than precise and lower than drapper
d-i live-installer/net-image string http://$http_server/cobbler/links/$distro_name/install/filesystem.squashfs
#end if
# Suite to install.
# d-i mirror/suite string precise
# d-i mirror/udeb/suite string precise
# Components to use for loading installer components (optional).
#d-i mirror/udeb/components multiselect main, restricted
## Part 4. Partitioning
# Disk Partitioning
# Use LVM, and wipe out anything that already exists
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
# You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home:   separate /home partition
# - multi:  separate /home, /usr, /var, and /tmp partitions
d-i partman-auto/choose_recipe select atomic
# If you just want to change the default filesystem from ext3 to something
# else, you can do that without providing a full recipe.
# d-i partman/default_filesystem string ext4
## Part 5. Account setup
# root account and password
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password $default_password_crypted
# skip creation of a normal user account.
d-i passwd/make-user boolean true
d-i passwd/user-fullname  string anjia
d-i passwd/username       string anjia
d-i passwd/user-password-crypted password $default_password_crypted

## Part 6. Apt setup
# You can choose to install restricted and universe software, or to install
# software from the backports repository.
# d-i apt-setup/restricted boolean true
# d-i apt-setup/universe boolean true
# d-i apt-setup/backports boolean true
# Uncomment this if you don't want to use a network mirror.
# d-i apt-setup/use_mirror boolean true
# Select which update services to use; define the mirrors to be used.
# Values shown below are the normal defaults.
# d-i apt-setup/services-select multiselect security
# d-i apt-setup/security_host string mirrors.aliyun.com
# d-i apt-setup/security_path string /ubuntu

$SNIPPET('preseed_apt_repo_config')

# Enable deb-src lines
# d-i apt-setup/local0/source boolean true
# URL to the public key of the local repository; you must provide a key or
# apt will complain about the unauthenticated repository and so the
# sources.list line will be left commented out
# d-i apt-setup/local0/key string http://local.server/key
# By default the installer requires that repositories be authenticated
# using a known gpg key. This setting can be used to disable that
# authentication. Warning: Insecure, not recommended.
# d-i debian-installer/allow_unauthenticated boolean true
## Part 7. Package selection
# Default for minimal
tasksel tasksel/first multiselect standard
# Default for server
# tasksel tasksel/first multiselect standard, web-server
# Default for gnome-desktop
# tasksel tasksel/first multiselect standard, gnome-desktop
# Individual additional packages to install
# wget is REQUIRED otherwise quite a few things won't work
# later in the build (like late-command scripts)
d-i pkgsel/include string ntp ssh wget 
# Debian needs this for the installer to avoid any question for grub
# Please verify that it suit your needs as it may overwrite any usb stick
#if $breed == "debian"
d-i grub-installer/grub2_instead_of_grub_legacy boolean true
d-i grub-installer/bootdev string default
#end if
# Use the following option to add additional boot parameters for the
# installed system (if supported by the bootloader installer).
# Note: options passed to the installer will be added automatically.
d-i debian-installer/add-kernel-opts string $kernel_options_post
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
## Figure out if we're kickstarting a system or a profile
#if $getVar('system_name','') != ''
#set $what = "system"
#else
#set $what = "profile"
#end if
# This first command is run as early as possible, just after preseeding is read.
# d-i preseed/early_command string [command]
d-i preseed/early_command string wget -O- \
   http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_early_default | \
   /bin/sh -s
# This command is run immediately before the partitioner starts. It may be
# useful to apply dynamic partitioner preseeding that depends on the state
# of the disks (which may not be visible when preseed/early_command runs).
# d-i partman/early_command \
#       string debconf-set partman-auto/disk "\$(list-devices disk | head -n1)"

# This command is run just before the install finishes, but when there is
# still a usable /target directory. You can chroot to /target and use it
# directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system.
# d-i preseed/late_command string [command]
d-i preseed/late_command string wget -O- \
   http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_late_default | \
   chroot /target /bin/sh -s
  • 创建 Snippets

安装完后,可使用 Snippets 自动安装软件。具体可参考 : Using template scripts for Debian and Ubuntu seeds (http://t.cn/EXd30sU)

[root@localhost ~]# tee /var/lib/cobbler/snippets/ubuntu_apt_install_soft <<-'EOF'
apt-get update
apt-get install -y language-pack-zh-hans apt-transport-https ca-certificates software-properties-common  git ansible openssh-server vim curl htop iotop iftop ncdu

curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
apt-get update

apt-get install -y docker-ce=18.06.2~ce~3-0~ubuntu
apt-mark hold docker-ce
systemctl enable docker
EOF

## // d-i preseed/late_command 阶段执行
[root@localhost ~]# echo '$SNIPPET("ubuntu_apt_install_soft") >> /var/lib/cobbler/snippets/late_apt_repo_config
  • 设置 Ubuntu Package Repo
[root@localhost ~]# cobbler repo edit --name=ubuntu-16.04.5-server-x86_64 --arch=x86_64 --breed=apt --mirror=http://mirrors.aliyun.com/ubuntu --owners=admin --mirror-locally=False --apt-components='main universe' --apt-dists='xenial xenial-updates xenial-security'
[root@localhost ~]# cobbler profile edit --name=ubuntu-16.04.5-server-x86_64 --repos=ubuntu-16.04.5-server-x86_64

常见错误

  • 原因:未启动相关服务
[root@localhost ~]# cobbler check
cobblerd does not appear to be running/accessible: error(111, 'Connection refused')
  • 原因:未关闭防火墙
[root@localhost ~]# cobbler check
httpd does not appear to be running and proxying cobbler, or SELinux is in the way. Original traceback:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cobbler/cli.py", line 251, in check_setup
    s.ping()
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1233, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1591, in __request
    verbose=self.__verbose
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1273, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1321, in single_request
    response.msg,
ProtocolError: <ProtocolError for 127.0.0.1:80/cobbler_api: 503 Service Unavailable>
  • 没改 DHCP 模板,导致 Sync 同步出问题。
[root@localhost ~]# cobbler sync
received on stderr: Redirecting to /bin/systemctl restart dhcpd.service
Job for dhcpd.service failed because the control process exited with error code. See "systemctl status dhcpd.service" and "journalctl -xe" for details.

Exception occured: <class 'cobbler.cexceptions.CX'>
Exception value: 'cobbler trigger failed: cobbler.modules.sync_post_restart_services'
Exception Info:
  File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 82, in run
    rc = self._run(self)
   File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 181, in runner
    return self.remote.api.sync(self.options.get("verbose",False),logger=self.logger)
   File "/usr/lib/python2.7/site-packages/cobbler/api.py", line 763, in sync
    return sync.run()
   File "/usr/lib/python2.7/site-packages/cobbler/action_sync.py", line 144, in run
    utils.run_triggers(self.api, None, "/var/lib/cobbler/triggers/sync/post/*", logger=self.logger)
   File "/usr/lib/python2.7/site-packages/cobbler/utils.py", line 928, in run_triggers
    raise CX("cobbler trigger failed: %s" % m.__name__)

!!! TASK FAILED !!!
  • Django 版本不对,安装指定版本即可。

pip2.7 install -U django==1.9.13

[root@localhost ~]# cat /var/log/httpd/ssl_error_log
[Fri Feb 22 20:07:49.460442 2019] [:error] [pid 6910] [remote 127.0.0.1:204] mod_wsgi (pid=6910): Exception occurred processing WSGI script '/usr/share/cobbler/web/cobbler.wsgi'.
[Fri Feb 22 20:07:49.460559 2019] [:error] [pid 6910] [remote 127.0.0.1:204] Traceback (most recent call last):
[Fri Feb 22 20:07:49.460605 2019] [:error] [pid 6910] [remote 127.0.0.1:204]   File "/usr/share/cobbler/web/cobbler.wsgi", line 26, in application
[Fri Feb 22 20:07:49.460668 2019] [:error] [pid 6910] [remote 127.0.0.1:204]     _application = get_wsgi_application()
[Fri Feb 22 20:07:49.460684 2019] [:error] [pid 6910] [remote 127.0.0.1:204]   File "/usr/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Fri Feb 22 20:07:49.460723 2019] [:error] [pid 6910] [remote 127.0.0.1:204]     django.setup(set_prefix=False)
[Fri Feb 22 20:07:49.460737 2019] [:error] [pid 6910] [remote 127.0.0.1:204]   File "/usr/lib/python2.7/site-packages/django/__init__.py", line 22, in setup
[Fri Feb 22 20:07:49.460768 2019] [:error] [pid 6910] [remote 127.0.0.1:204]     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Fri Feb 22 20:07:49.460781 2019] [:error] [pid 6910] [remote 127.0.0.1:204]   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 56, in __getattr__
[Fri Feb 22 20:07:49.460812 2019] [:error] [pid 6910] [remote 127.0.0.1:204]     self._setup(name)
[Fri Feb 22 20:07:49.460824 2019] [:error] [pid 6910] [remote 127.0.0.1:204]   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup
[Fri Feb 22 20:07:49.460852 2019] [:error] [pid 6910] [remote 127.0.0.1:204]     self._wrapped = Settings(settings_module)
[Fri Feb 22 20:07:49.460871 2019] [:error] [pid 6910] [remote 127.0.0.1:204]   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 110, in __init__
[Fri Feb 22 20:07:49.460900 2019] [:error] [pid 6910] [remote 127.0.0.1:204]     mod = importlib.import_module(self.SETTINGS_MODULE)
[Fri Feb 22 20:07:49.460911 2019] [:error] [pid 6910] [remote 127.0.0.1:204]   File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
[Fri Feb 22 20:07:49.460953 2019] [:error] [pid 6910] [remote 127.0.0.1:204]     __import__(name)
[Fri Feb 22 20:07:49.460973 2019] [:error] [pid 6910] [remote 127.0.0.1:204]   File "/usr/share/cobbler/web/settings.py", line 89, in <module>
[Fri Feb 22 20:07:49.460995 2019] [:error] [pid 6910] [remote 127.0.0.1:204]     from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
[Fri Feb 22 20:07:49.461043 2019] [:error] [pid 6910] [remote 127.0.0.1:204] ImportError: cannot import name TEMPLATE_CONTEXT_PROCESSORS

来源:家的博客 原文:http://t.cn/EXdBkDt 题图:来自谷歌图片搜索 版权:本文版权归原作者所有 投稿:欢迎投稿,投稿邮箱: editor@hi-linux.com

今日思想

我希望自己也是一颗星星:如果我会发光,就不必害怕黑暗。如果我自己是那么美好,那么一切恐惧就可以烟消云散。

—— 王小波「我在荒岛上迎接黎明」

本文分享自微信公众号 - 运维之美(Hi-Linux),作者:anjia0532

原文出处及转载信息见文内详细说明,如有侵权,请联系 yunjia_community@tencent.com 删除。

原始发表时间:2019-04-22

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 天天都在用的 Nginx,可你知道如何用一个反向代理实现多个不同类型的后端网站访问吗?

    为了安全,现在不再开放非 80 之外的公网端口。由于机器少了,80 端口不够,这些可视化 UI 不再能直接访问到了。所以需另寻其他出路。

    iMike
  • 再见 XShell 和 ITerm 2,是时候拥抱全平台高颜值终端工具 Hyper 了!

    不论是 macOS 还是 Windows 下,我们都不推荐使用系统自带终端。无论是可拓展性还是可编程性都被「系统自带」这样的特点限制。特别是 Windows 下...

    iMike
  • 关于高性能负载均衡架构,这些知识点大多数人不知道!

    单服务器无论如何优化,无论采用多好的硬件,总会有一个性能天花板,当单服务器的性能无法满足业务需求时,就需要设计高性能集群来提升系统整体的处理性能。

    iMike
  • 搞它!!!2020年了你还不会Cobbler自动装机么(装机步骤,优化内容详解,导入系统镜像步骤,cobbler-web管理认证方式

    Cobbler是一个使用Python开发的开源项目,通过将部署系统所涉及的所有服务集中在一起,来提供一个全自动批量快速建立Linux系统的网络安装环境 Cob...

    不吃小白菜
  • ASP.NET Core的配置(2):配置模型详解

    在上面一章我们以实例演示的方式介绍了几种读取配置的几种方式,其中涉及到三个重要的对象,它们分别是承载结构化配置信息的Configuration,提供原始配置源数...

    蒋金楠
  • Openstack平台搭建之第三天

    Openstack平台搭建之第三天 If you have any question ,please contact me by weichuangxxb@si...

    BGBiao
  • Redis学习笔记04-集合对象

    使用字典作为底层实现,字典的每个键都是一个字符串对象,每个字符串对象包含了一个集合元素,而字典的值则全部被设置为Null

    汐楓
  • 如何用Python抓取最便宜的机票信息(下)

    到目前为止,我们有一个函数来加载更多的结果,还有一个函数来抓取这些结果。我可以在这里结束这篇文章,您仍然可以手动使用这些工具,并在您自己浏览的页面上使用抓取功能...

    AiTechYun
  • awk详解 数组

    第1章 awk命令基础 1.1 awk命令执行过程 1、如果BEGIN 区块存在,awk执行它指定的动作。 2、awk从输入文件中读取一行,称为一条输入记录。如...

    惨绿少年
  • 疫情背后是两个世界的对决

    昨天,微信上一个朋友忧心忡忡的问了我一个问题,“凯哥,这次疫情对传统企业影响巨大,好多企业迟迟不能复工,面临生死存亡的挑战。你觉得这对于我们这样的数字化...

    凯哥

扫码关注云+社区

领取腾讯云代金券