Centos7.4 下cobbler安装及配置

1.背景介绍

作为运维,在公司经常遇到一些机械性重复工作要做,例如:为新机器装系统,一台两台机器装系统,可以用光盘、U盘等介质安装,1小时也完成了,但是如果有成百台的服务器还要用光盘、U盘去安装,就显得有些力不从心了。PXE技术就能很好的解决这个问题,本文将会对PXE的工作原理有所介绍,而cobbler则是基于PXE技术的工作原理的二次封装,通过命令的方式简化了PXE配置过程。

2.PXE原理介绍

2.1原理与概念

事实上把PXE称作是一种引导方式而不是安装方式似乎更加准确,PXE(Pre-boot Execution Environment)是由Intel设计的协议,它可以使计算机通过网络启动,但是有一个前提条件是计算机的网卡必须具有引导功能,这个网卡中要有一个PXE客户端。当计算机POST自检成功以后,BIOS把网卡中ROM的PXE客户端调入内存执行,PXE客户端通过网络中的DHCP服务器获取一个IP地址,拿到IP地址以后PXE继续引导计算机与网络中的TFTP客户端建立连接,从而从TFTP服务器中获取开机引导文件之后请求并下载安装需要的文件。在这个过程中需要一台服务器来提供启动文件、安装文件、以及安装过程中的自动应答文件等。

2.2PXE工作步骤如下图:

原理介绍

  • Client向PXE Server上的DHCP发送IP地址请求消息,DHCP检测Client是否合法(主要是检测Client的网卡MAC地址),如果合法则返回Client的IP地址,同时将启动文件pxelinux.0的位置信息一并传送给Client
  • Client向PXE Server上的TFTP发送获取pxelinux.0请求消息,TFTP接收到消息之后再向Client发送pxelinux.0大小信息,试探Client是否满意,当TFTP收到Client发回的同意大小信息之后,正式向Client发送pxelinux.0
  • Client执行接收到的pxelinux.0文件
  • Client向TFTP Server发送针对本机的配置信息文件(在TFTP服务的pxelinux.cfg目录下,这是系统菜单文件,格式和isolinux.cfg格式一样,功能也是类似),TFTP将配置文件发回Client,继而Client根据配置文件执行后续操作。
  • Client向TFTP发送Linux内核请求信息,TFTP接收到消息之后将内核文件发送给Client
  • Client向TFTP发送根文件请求信息,TFTP接收到消息之后返回Linux根文件系统
  • Client启动Linux内核
  • Client下载安装源文件,读取自动化安装脚本

3.Cobbler

鉴于pxe自动装系统网上一搜一大把,我就不详细操作举例了,今天主要讲一讲Cobbler。

3.1Cobbler介绍

Cobbler是一个Linux服务器快速网络安装的服务,由python开发,小巧轻便(15k行python代码),可以通过PXE的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS,TFTP、RSYNC以及yum仓库、构造系统ISO镜像。

Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。

3.2Cobbler工作流程

  • client裸机配置了从网络启动后,开机后会广播包请求DHCP服务器 (cobbler server)发送其分配好的一个IP
  • DHCP服务器(cobbler server)收到请求后发送responese,包括其ip地址
  • client裸机拿到ip后再向cobbler server发送请求OS引导文件的请求
  • cobbler server告诉裸机OS引导文件的名字和TFTP server的ip和 port
  • client裸机通过上面告知的TFTP server地址通信,下载引导文件
  • client裸机执行执行该引导文件,确定加载信息,选择要安装的os, 期间会再向cobbler server请求kickstart文件和os image
  • cobbler server发送请求的kickstart和os iamge
  • client裸机加载kickstart文件
  • client裸机接收os image,安装该os image

 

3.3Cobbler集成的服务

  • PXE服务支持
  • DHCP服务管理
  • DNS服务管理(可选bind,dnsmasq)
  • 电源管理
  • Kickstart服务支持
  • YUM仓库管理
  • TFTP(PXE启动时需要)
  • Apache(提供kickstart的安装源,并提供定制化的kickstart配置)

3.4配置目录

配置文件目录:
/etc/cobbler
/etc/cobbler/settings : cobbler 主配置文件
/etc/cobbler/iso/: iso模板配置文件
/etc/cobbler/pxe: pxe模板文件
/etc/cobbler/power: 电源配置文件
/etc/cobbler/user.conf: web服务授权配置文件
/etc/cobbler/users.digest: web访问的用户名密码配置文件
/etc/cobbler/dhcp.template : dhcp服务器的的配置末班
/etc/cobbler/dnsmasq.template : dns服务器的配置模板
/etc/cobbler/tftpd.template : tftp服务的配置模板
/etc/cobbler/modules.conf : 模块的配置文件
数据目录:
/var/lib/cobbler/config/: 用于存放distros,system,profiles 等信 息配置文件
/var/lib/cobbler/triggers/: 用于存放用户定义的cobbler命令
/var/lib/cobbler/kickstart/: 默认存放kickstart文件
/var/lib/cobbler/loaders/: 存放各种引导程序  镜像目录
/var/www/cobbler/ks_mirror/: 导入的发行版系统的所有数据
/var/www/cobbler/images/ : 导入发行版的kernel和initrd镜像用于 远程网络启动
/var/www/cobbler/repo_mirror/: yum 仓库存储目录
日志目录:
/var/log/cobbler/installing: 客户端安装日志
/var/log/cobbler/cobbler.log : cobbler日志

3.5命令介绍

cobbler commands介绍
cobbler check 核对当前设置是否有问题
cobbler list 列出所有的cobbler元素
cobbler report 列出元素的详细信息
cobbler sync 同步配置到数据目录,更改配置最好都要执行下
cobbler reposync 同步yum仓库
cobbler distro 查看导入的发行版系统信息
cobbler system 查看添加的系统信息
cobbler profile 查看配置信息

3.6  /etc/cobbler/settings中重要的参数设置

default_password_crypted: "$1$gEc7ilpP$pg5iSOj/mlxTxEslhRvyp/"
manage_dhcp:1
manage_tftpd:1
pxe_just_once:1
next_server:< tftp服务器的 IP 地址>
server:

4.Cobbler安装

4.1系统信息

[root@xuegod74 ~]#  cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 
[root@xuegod74 ~]#  uname -r
3.10.0-693.el7.x86_64
[root@xuegod74 ~]#  getenforce 
Disabled
[root@xuegod74 ~]#  systemctl status firewalld.service 
● 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@xuegod74 ~]#  ifconfig ens36 |awk -F "[ :]+" 'NR==2 {print $3}'
192.168.20.128
[root@xuegod74 ~]#  hostname
xuegod74.cn

4.2开始安装Cobbler

4.2.1安装cobbler以及相关的软件

[root@xuegod74 ~]# yum -y install httpd dhcp tftp python-ctypes cobbler  xinetd cobbler-web

4.2.2启动相关服务

[root@xuegod74 ~]# systemctl start httpd
[root@xuegod74 ~]# systemctl enable httpd
[root@xuegod74 ~]# systemctl start cobblerd
[root@xuegod74 ~]# systemct1 enable cobblerd

4.2.3通过cobbler check 核对当前设置是否有问题

[root@xuegod74 ~]# 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 : change 'disable' to 'no' in /etc/xinetd.d/tftp
4 : 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.
5 : enable and start rsyncd.service with systemctl
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:

[root@xuegod74 ~]# sed -i 's/^server: 127.0.0.1/server: 192.168.20.128/' /etc/cobbler/settings  # 修改server的ip地址为本机ip

问题2:

[root@xuegod74 ~]# sed -i 's/^next_server: 127.0.0.1/next_server: 192.168.20.128/' /etc/cobbler/settings # TFTP Server 的IP地址

问题3:

[root@xuegod74 ~]#vim /etc/xinetd.d/tftp
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot
        disable                 = no  # 修改为no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

问题4:

[root@xuegod74 ~]# cobbler get-loaders  # 下载缺失的文件
task started: 2018-06-26_224927_get_loaders
task started (id=Download Bootloader Content, time=Tue Jun 26 22:49:27 2018)
downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
downloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***

问题5:

# 添加rsync到自启动并启动rsync
[root@xuegod74 ~]# systemctl enable rsyncd 
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.
[root@xuegod74 ~]# systemctl start rsyncd 

 问题6:

      跟debian 相关,可以忽略

问题7:

# 修改密码为123456 ,salt后面是常用的加盐方式加密
[root@xuegod74 ~]# openssl passwd -1 -salt '123456' '123456' 
$1$123456$wOSEtcyiP2N/IfIl15W6Z0
[root@xuegod74 ~]# vim /etc/cobbler/settings # 修改settings配置文件中下面位置,把新生成的密码加进去
default_password_crypted: "$1$123456$wOSEtcyiP2N/IfIl15W6Z0"

需要再次重启cobblerd然后再次执行cobbler check

[root@xuegod74 ~]# systemctl restart cobblerd
[root@xuegod74 ~]# cobbler check
The following are potential configuration items that you may want to fix:
: debmirror package is not installed, it will be required to manage debian deployments and repositories # debian相关
: fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them # fence设备相关,不需要

Restart cobblerd and then run 'cobbler sync' to apply changes.

以上两个问题暂时可以忽略

4.2.4配置cobbler-DHCP

修改cobbler配置

[root@xuegod74 ~]# vim /etc/cobbler/settings # 修改settings中参数,由cobbler控制dhcp
manage_dhcp: 1

修改dhcp.templates配置文件(仅列出修改部分)

[root@xuegod74 ~]# vim /etc/cobbler/dhcp.template
option pxe-system-type code 93 = unsigned integer 16;

subnet 192.168.20.0 netmask 255.255.255.0 {
     option routers             192.168.20.5;
     option domain-name-servers 192.168.20.1;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.20.100 192.168.20.254;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;

重启服务并同步配置,改完dhcp必须要sync同步配置

[root@xuegod74 ~]# systemctl restart cobblerd
[root@xuegod74 ~]# cobbler sync
task started: 2018-06-26_231434_sync
task started (id=Sync, time=Tue Jun 26 23:14:34 2018)
running pre-sync triggers
cleaning trees
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/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 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
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 ***

检查dhcp

[root@xuegod74 ~]# netstat -lnup|grep dhcp
udp        0      0 0.0.0.0:67              0.0.0.0:*                           15932/dhcpd

4.2.5导入CentOs-7的镜像

[root@xuegod74 ~]# mount /dev/cdrom  /mnt # 挂载光盘镜像
mount: /dev/sr0 is write-protected, mounting read-only
[root@xuegod74 ~]# cobbler import --path=/mnt --name=Centos-7.4 --arch=x86_64 # cobbler导入镜像
task started: 2018-06-26_231725_import
task started (id=Media import, time=Tue Jun 26 23:17:25 2018)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path /var/www/cobbler/ks_mirror/Centos-7.4-x86_64: # 导入镜像的位置
creating new distro: Centos-7.4-x86_64
trying symlink: /var/www/cobbler/ks_mirror/Centos-7.4-x86_64 -> /var/www/cobbler/links/Centos-7.4-x86_64
creating new profile: Centos-7.4-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/Centos-7.4-x86_64 for Centos-7.4-x86_64
processing repo at : /var/www/cobbler/ks_mirror/Centos-7.4-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/Centos-7.4-x86_64
looking for /var/www/cobbler/ks_mirror/Centos-7.4-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/Centos-7.4-x86_64/repodata
*** TASK COMPLETE ***

# --path 镜像路径
# --name 为安装源定义一个名字
# --arch 指定安装源是32位、64位、ia64, 目前支持的选项有: x86│x86_64│ia64
# 安装源的唯一标示就是根据name参数来定义,本例导入成功后,安装源的唯一标示就是:CentOS-7.4-x86_64,如果重复,系统会提示导入失败

导入完镜像以后,那么就使查看下cobbler

[root@xuegod74 ~]# cobbler list
distros:
   Centos-7.4-x86_64

profiles:
   Centos-7.4-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

4.2.6导入kickstarts配置文件

[root@xuegod74 ~]# cd /var/lib/cobbler/kickstarts/
[root@xuegod74 kickstarts]# ls
default.ks    install_profiles  sample_autoyast.xml  sample_esxi4.ks  sample.ks
esxi4-ks.cfg  legacy.ks         sample_end.ks        sample_esxi5.ks  sample_old.seed
esxi5-ks.cfg  pxerescue.ks      sample_esx4.ks       sample_esxi6.ks  sample.seed
[root@xuegod74 kickstarts]# rz

查看导入信息及默认ks文件

[root@xuegod74 kickstarts]# cobbler report
distros:
==========
Name                           : Centos-7.4-x86_64
Architecture                   : x86_64
TFTP Boot Files                : {}
Breed                          : redhat
Comment                        : 
Fetchable Files                : {}
Initrd                         : /var/www/cobbler/ks_mirror/Centos-7.4-x86_64/images/pxeboot/initrd.img
Kernel                         : /var/www/cobbler/ks_mirror/Centos-7.4-x86_64/images/pxeboot/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : {'tree': 'http://@@http_server@@/cblr/links/Centos-7.4-x86_64'}
Management Classes             : []
OS Version                     : rhel7
Owners                         : ['admin']
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Template Files                 : {}


profiles:
==========
Name                           : Centos-7.4-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : Centos-7.4-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/sample_end.ks
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm


systems:
==========

repos:
==========

images:
==========

mgmtclasses:
==========

packages:
==========

files:
==========

我ks文件(只是简单配置的,具体可以按自己业务来)

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
#rootpw --iscrypted $1$m1pE0DG6$vALBphGGynqvUzfJaWZ6U1
# Use network installation
url --url="$tree"
# System language
lang en_US
# Firewall configuration
firewall --disabled
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# SELinux configuration
selinux --disabled

# Network information
network  --bootproto=dhcp --device=eth0
network  --bootproto=dhcp --device=eth1
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel

#Disk partitioning information
part /boot --fstype xfs --size 1024 --ondisk sda
#Oracle:part swap --size 16384 --ondisk sda
part swap --size 2048 --ondisk sda
part / --fstype xfs --size 1 --grow --ondisk sda


%packages
@base
@core
@compat-libraries
@debugging
@development
@gnome-desktop
@X Window System
%end

检查ks命令

# 写完 ks 文件之后,先通过 validateks 测试一下有没有语法错误
# cobbler validateks
# 通过下面这个命令查看 ks 文件,发现一些逻辑上的问题
# cobbler system getks --name=test

编辑修改指定ks文件为我们刚刚上传的ks

[root@xuegod74 kickstarts]# cobbler profile list
   Centos-7.4-x86_64
[root@xuegod74 kickstarts]# cobbler profile edit --name Centos-7.4-x86_64 --kickstart=/var/lib/cobbler/kickstarts/Centos7.4-x86_64.cfg   # 编辑profile,修改ks文件为我们刚刚上传的Centos7.2-x86_64.cfg
[root@xuegod74 kickstarts]# cobbler profile edit --name Centos-7.4-x86_64 --kopts='net.ifnames=0 biosdevname=0' 
   # 修改安装系统的内核参数,在CentOS7系统有一个地方变了,就是网卡名变成eno16777736这种形式,但是为了运维标准化,我们需要将它变成我们常用的eth0,因此使用上面的参数。但要注意是CentOS7才需要上面的步骤,CentOS6不需要。
[root@xuegod74 kickstarts]# cobbler profile report
Name                           : Centos-7.4-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : Centos-7.4-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/Centos7.4-x86_64.cfg
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm

4.3.7同步cobbler

[root@xuegod74 kickstarts]# cobbler sync
task started: 2018-06-26_233407_sync
task started (id=Sync, time=Tue Jun 26 23:34:07 2018)
running pre-sync triggers
cleaning trees
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/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: 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: 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: 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.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

4.新建一个虚拟机测试

为避免发生未知问题,先把服务端所有服务重启

[root@xuegod74 ~]# systemctl restart xinetd
[root@xuegod74 ~]# systemctl restart cobblerd
[root@xuegod74 ~]# systemctl restart httpd

新建虚拟机从pxe启动,如果出现下面图形,则说明已经成功了

上图中网址也可以定制为我们自己的

[root@xuegod74 cobbler]# vim /etc/cobbler/pxe/pxedefault.template
MENU TITLE Cobbler | I'm here # 修改这里为你想修改的内容
[root@xuegod74 cobbler]# cobbler sync # 同步之后就可以看到效果了

cobbler-web相关配置,后续文章再更。。。

参考文章:

http://www.cnblogs.com/linuxliu/p/7668048.html

http://www.cnblogs.com/liaojiafa/p/6445759.html

http://www.voidcn.com/article/p-dwdfkmfh-boa.html

http://werewolftj.blog.51cto.com/1606482/1673779

http://www.cnblogs.com/qige2017/p/7545812.html

 

posted @ 2018-06-27 09:39  走天涯  阅读(719)  评论(0编辑  收藏  举报