PXE——高效批量网络装机

目录

部署PXE远程安装服务

1.PXE概述

2.实现过程

3.实验操作

3.1安装dhcp、vsftpd、tftp-server.x86_64、syslinux服务

3.2修改配置文件——DHCP

3.3修改配置文件——TFTP

3.4kickstart——无人值守安装

3.4.1选择程序

3.4.2修改基础配置

3.4.3修改安装方法 

3.4.4安装新引导装载程序 

3.4.5配置分区信息 

3.4.5.1配置boot分区

3.4.5.2配置swap分区 

3.4.5.3配置根分区 

3.4.6防火墙配置 

3.4.7显示配置——不安装图形环境 

3.4.8安装后脚本配置 

3.4.9保存配置信息 

3.4.5新建虚拟机配置参数 

3.4.6开启虚拟机——选择网络安装系统 

3.4.7在此界面只需等待即可 

3.4.8测试——登录成功 

4.Cobbler——快速建立Linux网络安装环境

4.1Cobbler工作原理 

4.2实际操作

4.2.1安装epel源

4.2.2安装cobbler软件、dhcp软件和httpd软件

4.2.3设置开机自启

4.2.4检查Cobbler哪些配置需要修改

4.2.5生成新密码

4.2.6修改cobbler配置信息

4.2.7重启服务,查看配置信息

4.2.8配置dhcp文件信息

4.2.9导入Centos系统的安装文件,生成相应的yum源

4.2.10重启客户机,选择网络安装系统 

4.2.11选择内核 

4.2.12在页面等待即可 

4.2.13验证

4.3延伸


系统装机的三种引导方式

  • 硬盘(u盘)
  • 光驱
  • 网络

pe 小型的操作系统  在操作系统中再装操作系统

系统安装过程

  • 加载boot loader

Boot Loader 是在操作系统内核运行之前运行的一段小程序。通过这段小程序,我们可以初始化硬件设备、建立内存空间的映射图,从而将系统的软硬件环境带到一个合适的状态,以便为最终调用操作系统内核准备好正确的环境

  • 加载启动安装菜单

  • 加载内核和initrd系统(文件才能使用文件)

  • 加载根系统()

  • 运行anaconda的安装向导

Linux安装光盘的安装相关文件

在系统光盘的isolinux目录下有和安装相关的文件

  • boot.cat: 相当于grub的第一阶段
  • isolinux.bin:光盘引导程序,在mkisofs的选项中需要明确给出文件路径,这个文件属于SYSLINUX项目
  • isolinux.cfg:启动菜单的配置文件,当光盘启动后(即运行isolinux.bin),会自动去找isolinux.cfg文件
  • vesamenu.c32:是光盘启动后的启动菜单图形界面,也属于SYSLINUX项目,menu.c32提供纯文本的菜单
  • memtest:内存检测程序
  • splash.png:光盘启动菜单界面的背景图
  • vmlinuz:是内核映像
  • initrd.img:ramfs文件(精简版的linux系统,文件系统驱动等)

部署PXE远程安装服务

1.PXE概述

开机自检 ——> MBR引导——>grub2菜单——>内核初始化——>init初始化

PXE 的全称是 preboot execute environment它其实是Intel在很久以前提出来的一项用于通过网络来引导系统的标准。允许客户机通过网络从远程服务器上下载引导镜像,并加载安装文件或者整个操作系统。

PXE(预启动执行环境,在操作系统之前运行)由Intel公司开发的网络引导技术,工作在Client/Server模式, 允许客户机通过网络从远程服务器下载引导镜像,并加载安装文件或者整个操作系统

pxe是通过网卡引导启动

2.实现过程

1.网卡需要查找相关的dhcp服务器(获取地址时间)

2.找到后dhcp服务器提供ip地址,和引导程序(boot loader)的地址 还提供给客户机TFTPserver地址(dhcp本身不提供tftp服务)

3.网卡使用tftp客户端吧引导程序加载到内存中来

4.bios执行引导程序

5.引导程序会去TFTP去查找配置文件

6.根据配置文件去引导安装系统

7.系统安装过程

3.实验操作

3.1安装dhcp、vsftpd、tftp-server.x86_64、syslinux服务

[root@localhost ~]#yum install dhcp vsftpd tftp-server.x86_64 syslinux 
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.bupt.edu.cn
 * epel: mirror.nju.edu.cn
 * extras: mirrors.bupt.edu.cn
 * updates: mirrors.nju.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 dhcp.x86_64.12.4.2.5-83.el7.centos.1 将被 安装
--> 正在处理依赖关系 dhcp-libs(x86-64) = 12:4.2.5-83.el7.centos.1,它被软件包 12:dhcp-4.2.5-83.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 dhcp-common = 12:4.2.5-83.el7.centos.1,它被软件包 12:dhcp-4.2.5-83.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 libisc-export.so.169()(64bit),它被软件包 12:dhcp-4.2.5-83.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 libdns-export.so.1102()(64bit),它被软件包 12:dhcp-4.2.5-83.el7.centos.1.x86_64 需要
---> 软件包 syslinux.x86_64.0.4.05-15.el7 将被 安装
---> 软件包 tftp-server.x86_64.0.5.2-22.el7 将被 安装
---> 软件包 vsftpd.x86_64.0.3.0.2-29.el7_9 将被 安装
--> 正在检查事务
---> 软件包 bind-export-libs.x86_64.32.9.11.4-26.P2.el7_9.15 将被 安装
---> 软件包 dhcp-common.x86_64.12.4.2.5-58.el7.centos 将被 升级
--> 正在处理依赖关系 dhcp-common = 12:4.2.5-58.el7.centos,它被软件包 12:dhclient-4.2.5-58.el7.centos.x86_64 需要
---> 软件包 dhcp-common.x86_64.12.4.2.5-83.el7.centos.1 将被 更新
---> 软件包 dhcp-libs.x86_64.12.4.2.5-58.el7.centos 将被 升级
---> 软件包 dhcp-libs.x86_64.12.4.2.5-83.el7.centos.1 将被 更新
--> 正在检查事务
---> 软件包 dhclient.x86_64.12.4.2.5-58.el7.centos 将被 升级
---> 软件包 dhclient.x86_64.12.4.2.5-83.el7.centos.1 将被 更新
--> 解决依赖关系完成

依赖关系解决

==================================================================================
 Package              架构       版本                           源           大小
==================================================================================
正在安装:
 dhcp                 x86_64     12:4.2.5-83.el7.centos.1       updates     515 k
 syslinux             x86_64     4.05-15.el7                    base        990 k
 tftp-server          x86_64     5.2-22.el7                     base         47 k
 vsftpd               x86_64     3.0.2-29.el7_9                 updates     173 k
为依赖而安装:
 bind-export-libs     x86_64     32:9.11.4-26.P2.el7_9.15       updates     1.1 M
为依赖而更新:
 dhclient             x86_64     12:4.2.5-83.el7.centos.1       updates     286 k
 dhcp-common          x86_64     12:4.2.5-83.el7.centos.1       updates     177 k
 dhcp-libs            x86_64     12:4.2.5-83.el7.centos.1       updates     133 k

事务概要
==================================================================================
安装  4 软件包 (+1 依赖软件包)
升级           ( 3 依赖软件包)

总计:3.4 M
总下载量:1.7 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): tftp-server-5.2-22.el7.x86_64.rpm                   |  47 kB  00:00:00     
(2/4): dhcp-4.2.5-83.el7.centos.1.x86_64.rpm               | 515 kB  00:00:00     
(3/4): syslinux-4.05-15.el7.x86_64.rpm                     | 990 kB  00:00:00     
(4/4): vsftpd-3.0.2-29.el7_9.x86_64.rpm                    | 173 kB  00:00:05     
----------------------------------------------------------------------------------
总计                                                 295 kB/s | 1.7 MB  00:05     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : 12:dhcp-libs-4.2.5-83.el7.centos.1.x86_64                    1/11 
  正在更新    : 12:dhcp-common-4.2.5-83.el7.centos.1.x86_64                  2/11 
  正在安装    : 32:bind-export-libs-9.11.4-26.P2.el7_9.15.x86_64             3/11 
  正在安装    : 12:dhcp-4.2.5-83.el7.centos.1.x86_64                         4/11 
  正在更新    : 12:dhclient-4.2.5-83.el7.centos.1.x86_64                     5/11 
  正在安装    : tftp-server-5.2-22.el7.x86_64                                6/11 
  正在安装    : syslinux-4.05-15.el7.x86_64                                  7/11 
  正在安装    : vsftpd-3.0.2-29.el7_9.x86_64                                 8/11 
  清理        : 12:dhclient-4.2.5-58.el7.centos.x86_64                       9/11 
  清理        : 12:dhcp-common-4.2.5-58.el7.centos.x86_64                   10/11 
  清理        : 12:dhcp-libs-4.2.5-58.el7.centos.x86_64                     11/11 
  验证中      : 12:dhcp-common-4.2.5-83.el7.centos.1.x86_64                  1/11 
  验证中      : 12:dhcp-4.2.5-83.el7.centos.1.x86_64                         2/11 
  验证中      : 12:dhcp-libs-4.2.5-83.el7.centos.1.x86_64                    3/11 
  验证中      : 12:dhclient-4.2.5-83.el7.centos.1.x86_64                     4/11 
  验证中      : vsftpd-3.0.2-29.el7_9.x86_64                                 5/11 
  验证中      : syslinux-4.05-15.el7.x86_64                                  6/11 
  验证中      : tftp-server-5.2-22.el7.x86_64                                7/11 
  验证中      : 32:bind-export-libs-9.11.4-26.P2.el7_9.15.x86_64             8/11 
  验证中      : 12:dhcp-common-4.2.5-58.el7.centos.x86_64                    9/11 
  验证中      : 12:dhcp-libs-4.2.5-58.el7.centos.x86_64                     10/11 
  验证中      : 12:dhclient-4.2.5-58.el7.centos.x86_64                      11/11 

已安装:
  dhcp.x86_64 12:4.2.5-83.el7.centos.1       syslinux.x86_64 0:4.05-15.el7       
  tftp-server.x86_64 0:5.2-22.el7            vsftpd.x86_64 0:3.0.2-29.el7_9      

作为依赖被安装:
  bind-export-libs.x86_64 32:9.11.4-26.P2.el7_9.15                                

作为依赖被升级:
  dhclient.x86_64 12:4.2.5-83.el7.centos.1                                        
  dhcp-common.x86_64 12:4.2.5-83.el7.centos.1                                     
  dhcp-libs.x86_64 12:4.2.5-83.el7.centos.1                                       

完毕!

3.2修改配置文件——DHCP

[root@localhost ~]#cat /etc/dhcp/dhcpd.conf 
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#
[root@localhost ~]#cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example   /etc/dhcp/dhcpd.conf
#拷贝配置模版 
cp:是否覆盖"/etc/dhcp/dhcpd.conf"? y
[root@localhost ~]#vim /etc/dhcp/dhcpd.conf 
#配置DHCP服务信息

subnet 192.168.241.0 netmask 255.255.255.0 {
  range 192.168.241.30 192.168.241.60;
  option routers 192.168.241.2;
  next-server 192.168.241.11;
#通过192.168.241.11的服务端进行服务
  filename= "pxelinux.0";
#获取引导信息
}

[root@localhost ~]#systemctl start dhcpd
#开启dhcp服务

3.3修改配置文件——TFTP

[root@localhost ~]#rpm -qc tftp-server
#查看tftp服务配置信息位置
/etc/xinetd.d/tftp
[root@localhost ~]#vim /etc/xinetd.d/tftp


disable                 = no
#默认为yes  修改为no


[root@localhost ~]#cd /var/lib/tftpboot/
[root@localhost tftpboot]#mount /dev/sr0 /mnt
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost tftpboot]#cp /mnt/isolinux/initrd.img   /mnt/isolinux/vmlinuz  .
#拷贝提供驱动的initrd程序(小型Linux系统)    vmlinuz内核程序到当前文件夹
[root@localhost tftpboot]#ls
initrd.img  vmlinuz
[root@localhost tftpboot]#rpm -ql syslinux |grep pxelinux.0
/usr/share/syslinux/gpxelinux.0
/usr/share/syslinux/pxelinux.0
[root@localhost tftpboot]#cp /usr/share/syslinux/pxelinux.0 .
#拷贝引导程序pxelinux.0到当前目录
[root@localhost tftpboot]#ls
initrd.img  pxelinux.0  vmlinuz
#目前已具备驱动、引导程序、内核
[root@localhost tftpboot]#mkdir pxelinux.cfg
[root@localhost tftpboot]#cd pxelinux.cfg/
[root@localhost pxelinux.cfg]#ls
[root@localhost pxelinux.cfg]#vim default

default linux
#权限为linux
timeout 600
#超时等待时长为600秒

label linux
  kernel vmlinuz
#内核  核心为vmlinuz
  append initrd=initrd.img  method=ftp://192.168.241.11/centos7
#驱动使用initrd.img   获取方式为ftp协议连接到192.168.241.11/centos7

[root@localhost tftpboot]#mkdir /var/ftp/centos7
[root@localhost tftpboot]#mount /dev/sr0 /var/ftp/centos7/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost pxelinux.cfg]#cd ..
[root@localhost tftpboot]#ls
initrd.img  pxelinux.0  pxelinux.cfg  vmlinuz
[root@localhost tftpboot]#systemctl start tftp
#开启tftp服务


[root@localhost tftpboot]#systemctl start vsftpd
#开启vsftpd服务


[root@localhost tftpboot]#systemctl stop firewalld
#关闭防火墙
[root@localhost tftpboot]#setenforce 0
#关闭防护
setenforce: SELinux is disabled

3.4kickstart——无人值守安装

kickstart文件主要包括三个部分:命令段程序包段脚本段

命令段:指明各种安装前配置,如键盘类型等

命令段中的常见命令

  • keyboard: 设定键盘类型
  • lang: 语言类型
  • zerombr:清除mbr
  • clearpart:清除分区
  • part: 创建分区
  • rootpw: 指明root的密码
  • timezone: 时区
  • text: 文本安装界面
  • network:指定网络设置
  • firewall:设置防火墙设置
  • selinux:设置selinux设置
  • reboot:安装完自动重启
  • user:安装完成后为系统创建新用户
  • url: 指明安装源

程序包段:指明要安装的程序包组或程序包,不安装的程序包等

%packages

@^environment group: 指定环境包组,如:@^minimal-environment

@group_name

package

-package

%end

脚本段

%pre: 安装前脚本

%post: 安装后脚本

%post
useradd wang    #执行什么脚本
%end

注意:CentOS 8,7,6 不同版本的kickstart文件格式不尽相同,不可混用

[root@localhost tftpboot]#yum install system-config-kickstart.noarch -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.bupt.edu.cn
 * epel: mirror.nju.edu.cn
 * extras: mirrors.bupt.edu.cn
 * updates: mirrors.nju.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 system-config-kickstart.noarch.0.2.9.7-1.el7 将被 安装
--> 正在处理依赖关系 system-config-keyboard >= 1.3.1,它被软件包 system-config-kickstart-2.9.7-1.el7.noarch 需要
--> 正在处理依赖关系 system-config-language,它被软件包 system-config-kickstart-2.9.7-1.el7.noarch 需要
--> 正在处理依赖关系 system-config-date,它被软件包 system-config-kickstart-2.9.7-1.el7.noarch 需要
--> 正在检查事务
---> 软件包 system-config-date.noarch.0.1.10.6-3.el7.centos 将被 安装
--> 正在处理依赖关系 system-config-date-docs,它被软件包 system-config-date-1.10.6-3.el7.centos.noarch 需要
--> 正在处理依赖关系 gnome-python2-canvas,它被软件包 system-config-date-1.10.6-3.el7.centos.noarch 需要
---> 软件包 system-config-keyboard.noarch.0.1.4.0-5.el7 将被 安装
--> 正在处理依赖关系 system-config-keyboard-base = 1.4.0-5.el7,它被软件包 system-config-keyboard-1.4.0-5.el7.noarch 需要
---> 软件包 system-config-language.noarch.0.1.4.0-9.el7 将被 安装
--> 正在处理依赖关系 usermode-gtk,它被软件包 system-config-language-1.4.0-9.el7.noarch 需要
--> 正在检查事务
---> 软件包 gnome-python2-canvas.x86_64.0.2.28.1-14.el7 将被 安装
--> 正在处理依赖关系 gnome-python2(x86-64) = 2.28.1-14.el7,它被软件包 gnome-python2-canvas-2.28.1-14.el7.x86_64 需要
--> 正在处理依赖关系 libgnomecanvas(x86-64) >= 2.8.0,它被软件包 gnome-python2-canvas-2.28.1-14.el7.x86_64 需要
--> 正在处理依赖关系 libgnomecanvas-2.so.0()(64bit),它被软件包 gnome-python2-canvas-2.28.1-14.el7.x86_64 需要
--> 正在处理依赖关系 libart_lgpl_2.so.2()(64bit),它被软件包 gnome-python2-canvas-2.28.1-14.el7.x86_64 需要
---> 软件包 system-config-date-docs.noarch.0.1.0.11-4.el7 将被 安装
--> 正在处理依赖关系 rarian-compat,它被软件包 system-config-date-docs-1.0.11-4.el7.noarch 需要
---> 软件包 system-config-keyboard-base.noarch.0.1.4.0-5.el7 将被 安装
---> 软件包 usermode-gtk.x86_64.0.1.111-6.el7 将被 安装
--> 正在处理依赖关系 usermode = 1.111-6.el7,它被软件包 usermode-gtk-1.111-6.el7.x86_64 需要
--> 正在检查事务
---> 软件包 gnome-python2.x86_64.0.2.28.1-14.el7 将被 安装
---> 软件包 libart_lgpl.x86_64.0.2.3.21-10.el7 将被 安装
---> 软件包 libgnomecanvas.x86_64.0.2.30.3-8.el7 将被 安装
---> 软件包 rarian-compat.x86_64.0.0.8.1-11.el7 将被 安装
--> 正在处理依赖关系 rarian = 0.8.1-11.el7,它被软件包 rarian-compat-0.8.1-11.el7.x86_64 需要
--> 正在处理依赖关系 rarian,它被软件包 rarian-compat-0.8.1-11.el7.x86_64 需要
--> 正在处理依赖关系 librarian.so.0()(64bit),它被软件包 rarian-compat-0.8.1-11.el7.x86_64 需要
---> 软件包 usermode.x86_64.0.1.111-5.el7 将被 升级
---> 软件包 usermode.x86_64.0.1.111-6.el7 将被 更新
--> 正在检查事务
---> 软件包 rarian.x86_64.0.0.8.1-11.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

==================================================================================
 Package                        架构      版本                      源       大小
==================================================================================
正在安装:
 system-config-kickstart        noarch    2.9.7-1.el7               base    348 k
为依赖而安装:
 gnome-python2                  x86_64    2.28.1-14.el7             base     47 k
 gnome-python2-canvas           x86_64    2.28.1-14.el7             base     34 k
 libart_lgpl                    x86_64    2.3.21-10.el7             base     67 k
 libgnomecanvas                 x86_64    2.30.3-8.el7              base    226 k
 rarian                         x86_64    0.8.1-11.el7              base     98 k
 rarian-compat                  x86_64    0.8.1-11.el7              base     66 k
 system-config-date             noarch    1.10.6-3.el7.centos       base    591 k
 system-config-date-docs        noarch    1.0.11-4.el7              base    527 k
 system-config-keyboard         noarch    1.4.0-5.el7               base     33 k
 system-config-keyboard-base    noarch    1.4.0-5.el7               base    103 k
 system-config-language         noarch    1.4.0-9.el7               base    133 k
 usermode-gtk                   x86_64    1.111-6.el7               base    110 k
为依赖而更新:
 usermode                       x86_64    1.111-6.el7               base    193 k

事务概要
==================================================================================
安装  1 软件包 (+12 依赖软件包)
升级           (  1 依赖软件包)

总计:2.5 M
总下载量:2.3 M
Downloading packages:
(1/13): gnome-python2-canvas-2.28.1-14.el7.x86_64.rpm      |  34 kB  00:00:00     
(2/13): gnome-python2-2.28.1-14.el7.x86_64.rpm             |  47 kB  00:00:00     
(3/13): libart_lgpl-2.3.21-10.el7.x86_64.rpm               |  67 kB  00:00:00     
(4/13): libgnomecanvas-2.30.3-8.el7.x86_64.rpm             | 226 kB  00:00:00     
(5/13): rarian-0.8.1-11.el7.x86_64.rpm                     |  98 kB  00:00:00     
(6/13): rarian-compat-0.8.1-11.el7.x86_64.rpm              |  66 kB  00:00:00     
(7/13): system-config-date-1.10.6-3.el7.centos.noarch.rpm  | 591 kB  00:00:00     
(8/13): system-config-keyboard-1.4.0-5.el7.noarch.rpm      |  33 kB  00:00:00     
(9/13): system-config-date-docs-1.0.11-4.el7.noarch.rpm    | 527 kB  00:00:00     
(10/13): system-config-keyboard-base-1.4.0-5.el7.noarch.rp | 103 kB  00:00:00     
(11/13): system-config-language-1.4.0-9.el7.noarch.rpm     | 133 kB  00:00:00     
(12/13): usermode-gtk-1.111-6.el7.x86_64.rpm               | 110 kB  00:00:00     
(13/13): system-config-kickstart-2.9.7-1.el7.noarch.rpm    | 348 kB  00:00:00     
----------------------------------------------------------------------------------
总计                                                 2.1 MB/s | 2.3 MB  00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : usermode-1.111-6.el7.x86_64                                  1/15 
  正在安装    : libart_lgpl-2.3.21-10.el7.x86_64                             2/15 
  正在安装    : libgnomecanvas-2.30.3-8.el7.x86_64                           3/15 
  正在安装    : usermode-gtk-1.111-6.el7.x86_64                              4/15 
  正在安装    : system-config-language-1.4.0-9.el7.noarch                    5/15 
  正在安装    : gnome-python2-2.28.1-14.el7.x86_64                           6/15 
  正在安装    : gnome-python2-canvas-2.28.1-14.el7.x86_64                    7/15 
  正在安装    : rarian-0.8.1-11.el7.x86_64                                   8/15 
  正在安装    : rarian-compat-0.8.1-11.el7.x86_64                            9/15 
  正在安装    : system-config-date-docs-1.0.11-4.el7.noarch                 10/15 
  正在安装    : system-config-date-1.10.6-3.el7.centos.noarch               11/15 
  正在安装    : system-config-keyboard-base-1.4.0-5.el7.noarch              12/15 
  正在安装    : system-config-keyboard-1.4.0-5.el7.noarch                   13/15 
  正在安装    : system-config-kickstart-2.9.7-1.el7.noarch                  14/15 
  清理        : usermode-1.111-5.el7.x86_64                                 15/15 
  验证中      : libgnomecanvas-2.30.3-8.el7.x86_64                           1/15 
  验证中      : system-config-keyboard-base-1.4.0-5.el7.noarch               2/15 
  验证中      : system-config-date-docs-1.0.11-4.el7.noarch                  3/15 
  验证中      : system-config-language-1.4.0-9.el7.noarch                    4/15 
  验证中      : system-config-date-1.10.6-3.el7.centos.noarch                5/15 
  验证中      : system-config-keyboard-1.4.0-5.el7.noarch                    6/15 
  验证中      : system-config-kickstart-2.9.7-1.el7.noarch                   7/15 
  验证中      : gnome-python2-canvas-2.28.1-14.el7.x86_64                    8/15 
  验证中      : rarian-compat-0.8.1-11.el7.x86_64                            9/15 
  验证中      : rarian-0.8.1-11.el7.x86_64                                  10/15 
  验证中      : usermode-gtk-1.111-6.el7.x86_64                             11/15 
  验证中      : libart_lgpl-2.3.21-10.el7.x86_64                            12/15 
  验证中      : usermode-1.111-6.el7.x86_64                                 13/15 
  验证中      : gnome-python2-2.28.1-14.el7.x86_64                          14/15 
  验证中      : usermode-1.111-5.el7.x86_64                                 15/15 

已安装:
  system-config-kickstart.noarch 0:2.9.7-1.el7                                    

作为依赖被安装:
  gnome-python2.x86_64 0:2.28.1-14.el7                                            
  gnome-python2-canvas.x86_64 0:2.28.1-14.el7                                     
  libart_lgpl.x86_64 0:2.3.21-10.el7                                              
  libgnomecanvas.x86_64 0:2.30.3-8.el7                                            
  rarian.x86_64 0:0.8.1-11.el7                                                    
  rarian-compat.x86_64 0:0.8.1-11.el7                                             
  system-config-date.noarch 0:1.10.6-3.el7.centos                                 
  system-config-date-docs.noarch 0:1.0.11-4.el7                                   
  system-config-keyboard.noarch 0:1.4.0-5.el7                                     
  system-config-keyboard-base.noarch 0:1.4.0-5.el7                                
  system-config-language.noarch 0:1.4.0-9.el7                                     
  usermode-gtk.x86_64 0:1.111-6.el7                                               

作为依赖被升级:
  usermode.x86_64 0:1.111-6.el7                                                   

完毕!



[root@localhost tftpboot]#vim anaconda-ks.cfg


%post
useradd cxk

%end
3.4.1选择程序

3.4.2修改基础配置

3.4.3修改安装方法 

3.4.4安装新引导装载程序 

3.4.5配置分区信息 

3.4.5.1配置boot分区

3.4.5.2配置swap分区 

3.4.5.3配置根分区 

3.4.6防火墙配置 

3.4.7显示配置——不安装图形环境 

3.4.8安装后脚本配置 

3.4.9保存配置信息 

[root@localhost ~]#cd /var/ftp/
[root@localhost ftp]#ls
centos7  ks.cfg  pub
[root@localhost ftp]#vim ks.cfg
#ks.cfg是在kickstart程序配置好的相关信息

[root@localhost ftp]#cd /var/lib/tftpboot/
[root@localhost tftpboot]#ls
anaconda-ks.cfg  initrd.img  pxelinux.0    pxelinux.cfg  vmlinuz
#安装后脚本信息    驱动信息    引导程序信息  linux程序信息  内核信息
[root@localhost tftpboot]#vim pxelinux.cfg/default 


default linux
timeout 600


label linux
  kernel vmlinuz
  append initrd=initrd.img  method=ftp://192.168.241.11/centos7 
                            ks=ftp://192.168.241.11/ks.cfg
3.4.5新建虚拟机配置参数 

3.4.6开启虚拟机——选择网络安装系统 

3.4.7在此界面只需等待即可 

3.4.8测试——登录成功 

4.Cobbler——快速建立Linux网络安装环境

Cobbler可以用来快速建立Linux网络安装环境

  • Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等
  • Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用
  • Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理
  • Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet

4.1Cobbler工作原理 

  • 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

4.2实际操作

4.2.1安装epel源
[root@localhost ~]#yum install epel-release.noarch -y
已加载插件:fastestmirror, langpacks
base                                                       | 3.6 kB  00:00:00     
epel/x86_64/metalink                                       | 7.8 kB  00:00:00     
epel                                                       | 4.7 kB  00:00:00     
extras                                                     | 2.9 kB  00:00:00     
updates                                                    | 2.9 kB  00:00:00     
(1/2): epel/x86_64/updateinfo                              | 1.0 MB  00:00:10     
(2/2): epel/x86_64/primary_db                              | 7.0 MB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: mirrors.bfsu.edu.cn
 * epel: mirror.nju.edu.cn
 * extras: mirrors.bupt.edu.cn
 * updates: mirrors.bupt.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-11 将被 升级
---> 软件包 epel-release.noarch.0.7-14 将被 更新
--> 解决依赖关系完成

依赖关系解决

==================================================================================
 Package                 架构              版本             源               大小
==================================================================================
正在更新:
 epel-release            noarch            7-14             epel             15 k

事务概要
==================================================================================
升级  1 软件包

总计:15 k
Downloading packages:
警告:/var/cache/yum/x86_64/7/epel/packages/epel-release-7-14.noarch.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 检索密钥
导入 GPG key 0x352C64E5:
 用户ID     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 指纹       : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 软件包     : epel-release-7-11.noarch (@extras)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : epel-release-7-14.noarch                                      1/2 
  清理        : epel-release-7-11.noarch                                      2/2 
  验证中      : epel-release-7-14.noarch                                      1/2 
  验证中      : epel-release-7-11.noarch                                      2/2 

更新完毕:
  epel-release.noarch 0:7-14                                                      

完毕!
4.2.2安装cobbler软件、dhcp软件和httpd软件
[root@localhost ~]#yum install cobbler dhcp httpd -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.bfsu.edu.cn
 * epel: mirrors.bfsu.edu.cn
 * extras: mirrors.bupt.edu.cn
 * updates: mirrors.bupt.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 cobbler.x86_64.0.2.8.5-6.el7 将被 安装
--> 正在处理依赖关系 mod_wsgi,它被软件包 cobbler-2.8.5-6.el7.x86_64 需要
--> 正在处理依赖关系 python2-cheetah,它被软件包 cobbler-2.8.5-6.el7.x86_64 需要
--> 正在处理依赖关系 python2-pyyaml,它被软件包 cobbler-2.8.5-6.el7.x86_64 需要
--> 正在处理依赖关系 python2-simplejson,它被软件包 cobbler-2.8.5-6.el7.x86_64 需要
--> 正在处理依赖关系 syslinux,它被软件包 cobbler-2.8.5-6.el7.x86_64 需要
--> 正在处理依赖关系 tftp-server,它被软件包 cobbler-2.8.5-6.el7.x86_64 需要
---> 软件包 dhcp.x86_64.12.4.2.5-83.el7.centos.1 将被 安装
--> 正在处理依赖关系 dhcp-libs(x86-64) = 12:4.2.5-83.el7.centos.1,它被软件包 12:dhcp-4.2.5-83.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 dhcp-common = 12:4.2.5-83.el7.centos.1,它被软件包 12:dhcp-4.2.5-83.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 libisc-export.so.169()(64bit),它被软件包 12:dhcp-4.2.5-83.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 libdns-export.so.1102()(64bit),它被软件包 12:dhcp-4.2.5-83.el7.centos.1.x86_64 需要
---> 软件包 httpd.x86_64.0.2.4.6-99.el7.centos.1 将被 安装
--> 正在处理依赖关系 httpd-tools = 2.4.6-99.el7.centos.1,它被软件包 httpd-2.4.6-99.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 /etc/mime.types,它被软件包 httpd-2.4.6-99.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 libaprutil-1.so.0()(64bit),它被软件包 httpd-2.4.6-99.el7.centos.1.x86_64 需要
--> 正在处理依赖关系 libapr-1.so.0()(64bit),它被软件包 httpd-2.4.6-99.el7.centos.1.x86_64 需要
--> 正在检查事务
---> 软件包 apr.x86_64.0.1.4.8-7.el7 将被 安装
---> 软件包 apr-util.x86_64.0.1.5.2-6.el7_9.1 将被 安装
---> 软件包 bind-export-libs.x86_64.32.9.11.4-26.P2.el7_9.15 将被 安装
---> 软件包 dhcp-common.x86_64.12.4.2.5-58.el7.centos 将被 升级
--> 正在处理依赖关系 dhcp-common = 12:4.2.5-58.el7.centos,它被软件包 12:dhclient-4.2.5-58.el7.centos.x86_64 需要
---> 软件包 dhcp-common.x86_64.12.4.2.5-83.el7.centos.1 将被 更新
---> 软件包 dhcp-libs.x86_64.12.4.2.5-58.el7.centos 将被 升级
---> 软件包 dhcp-libs.x86_64.12.4.2.5-83.el7.centos.1 将被 更新
---> 软件包 httpd-tools.x86_64.0.2.4.6-99.el7.centos.1 将被 安装
---> 软件包 mailcap.noarch.0.2.1.41-2.el7 将被 安装
---> 软件包 mod_wsgi.x86_64.0.3.4-18.el7 将被 安装
---> 软件包 python2-cheetah.x86_64.0.2.4.4-6.el7 将被 安装
--> 正在处理依赖关系 python-pygments,它被软件包 python2-cheetah-2.4.4-6.el7.x86_64 需要
--> 正在处理依赖关系 python2-markdown,它被软件包 python2-cheetah-2.4.4-6.el7.x86_64 需要
---> 软件包 python2-pyyaml.noarch.0.3.10-0.el7 将被 安装
--> 正在处理依赖关系 PyYAML >= 3.10,它被软件包 python2-pyyaml-3.10-0.el7.noarch 需要
---> 软件包 python2-simplejson.x86_64.0.3.11.1-1.el7 将被 安装
---> 软件包 syslinux.x86_64.0.4.05-15.el7 将被 安装
---> 软件包 tftp-server.x86_64.0.5.2-22.el7 将被 安装
--> 正在检查事务
---> 软件包 PyYAML.x86_64.0.3.10-11.el7 将被 安装
--> 正在处理依赖关系 libyaml-0.so.2()(64bit),它被软件包 PyYAML-3.10-11.el7.x86_64 需要
---> 软件包 dhclient.x86_64.12.4.2.5-58.el7.centos 将被 升级
---> 软件包 dhclient.x86_64.12.4.2.5-83.el7.centos.1 将被 更新
---> 软件包 python-pygments.noarch.0.1.4-10.el7 将被 安装
--> 正在处理依赖关系 python-imaging,它被软件包 python-pygments-1.4-10.el7.noarch 需要
---> 软件包 python2-markdown.noarch.0.2.4.1-4.el7 将被 安装
--> 正在检查事务
---> 软件包 libyaml.x86_64.0.0.1.4-11.el7_0 将被 安装
---> 软件包 python-pillow.x86_64.0.2.0.0-23.gitd1c6db8.el7_9 将被 安装
--> 解决依赖关系完成

依赖关系解决

==================================================================================
 Package               架构      版本                            源          大小
==================================================================================
正在安装:
 cobbler               x86_64    2.8.5-6.el7                     epel       580 k
 dhcp                  x86_64    12:4.2.5-83.el7.centos.1        updates    515 k
 httpd                 x86_64    2.4.6-99.el7.centos.1           updates    2.7 M
为依赖而安装:
 PyYAML                x86_64    3.10-11.el7                     base       153 k
 apr                   x86_64    1.4.8-7.el7                     base       104 k
 apr-util              x86_64    1.5.2-6.el7_9.1                 updates     92 k
 bind-export-libs      x86_64    32:9.11.4-26.P2.el7_9.15        updates    1.1 M
 httpd-tools           x86_64    2.4.6-99.el7.centos.1           updates     94 k
 libyaml               x86_64    0.1.4-11.el7_0                  base        55 k
 mailcap               noarch    2.1.41-2.el7                    base        31 k
 mod_wsgi              x86_64    3.4-18.el7                      base        77 k
 python-pillow         x86_64    2.0.0-23.gitd1c6db8.el7_9       updates    439 k
 python-pygments       noarch    1.4-10.el7                      base       599 k
 python2-cheetah       x86_64    2.4.4-6.el7                     epel       342 k
 python2-markdown      noarch    2.4.1-4.el7                     epel       250 k
 python2-pyyaml        noarch    3.10-0.el7                      epel       3.0 k
 python2-simplejson    x86_64    3.11.1-1.el7                    epel       188 k
 syslinux              x86_64    4.05-15.el7                     base       990 k
 tftp-server           x86_64    5.2-22.el7                      base        47 k
为依赖而更新:
 dhclient              x86_64    12:4.2.5-83.el7.centos.1        updates    286 k
 dhcp-common           x86_64    12:4.2.5-83.el7.centos.1        updates    177 k
 dhcp-libs             x86_64    12:4.2.5-83.el7.centos.1        updates    133 k

事务概要
==================================================================================
安装  3 软件包 (+16 依赖软件包)
升级           (  3 依赖软件包)

总计:8.8 M
总下载量:7.2 M
Downloading packages:
(1/18): apr-1.4.8-7.el7.x86_64.rpm                         | 104 kB  00:00:00     
(2/18): apr-util-1.5.2-6.el7_9.1.x86_64.rpm                |  92 kB  00:00:00     
(3/18): httpd-tools-2.4.6-99.el7.centos.1.x86_64.rpm       |  94 kB  00:00:00     
(4/18): cobbler-2.8.5-6.el7.x86_64.rpm                     | 580 kB  00:00:00     
(5/18): libyaml-0.1.4-11.el7_0.x86_64.rpm                  |  55 kB  00:00:00     
(6/18): mailcap-2.1.41-2.el7.noarch.rpm                    |  31 kB  00:00:00     
(7/18): mod_wsgi-3.4-18.el7.x86_64.rpm                     |  77 kB  00:00:00     
(8/18): httpd-2.4.6-99.el7.centos.1.x86_64.rpm             | 2.7 MB  00:00:00     
(9/18): python2-cheetah-2.4.4-6.el7.x86_64.rpm             | 342 kB  00:00:00     
(10/18): python-pygments-1.4-10.el7.noarch.rpm             | 599 kB  00:00:00     
(11/18): python2-markdown-2.4.1-4.el7.noarch.rpm           | 250 kB  00:00:00     
(12/18): dhcp-4.2.5-83.el7.centos.1.x86_64.rpm             | 515 kB  00:00:00     
(13/18): python2-pyyaml-3.10-0.el7.noarch.rpm              | 3.0 kB  00:00:00     
(14/18): python2-simplejson-3.11.1-1.el7.x86_64.rpm        | 188 kB  00:00:00     
(15/18): python-pillow-2.0.0-23.gitd1c6db8.el7_9.x86_64.rp | 439 kB  00:00:00     
(16/18): syslinux-4.05-15.el7.x86_64.rpm                   | 990 kB  00:00:00     
(17/18): tftp-server-5.2-22.el7.x86_64.rpm                 |  47 kB  00:00:00     
(18/18): PyYAML-3.10-11.el7.x86_64.rpm                     | 153 kB  00:00:05     
----------------------------------------------------------------------------------
总计                                                 1.2 MB/s | 7.2 MB  00:05     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : 12:dhcp-libs-4.2.5-83.el7.centos.1.x86_64                    1/25 
  正在安装    : apr-1.4.8-7.el7.x86_64                                       2/25 
  正在安装    : apr-util-1.5.2-6.el7_9.1.x86_64                              3/25 
  正在更新    : 12:dhcp-common-4.2.5-83.el7.centos.1.x86_64                  4/25 
  正在安装    : 32:bind-export-libs-9.11.4-26.P2.el7_9.15.x86_64             5/25 
  正在安装    : httpd-tools-2.4.6-99.el7.centos.1.x86_64                     6/25 
  正在安装    : python-pillow-2.0.0-23.gitd1c6db8.el7_9.x86_64               7/25 
  正在安装    : python-pygments-1.4-10.el7.noarch                            8/25 
  正在安装    : python2-markdown-2.4.1-4.el7.noarch                          9/25 
  正在安装    : python2-cheetah-2.4.4-6.el7.x86_64                          10/25 
  正在安装    : libyaml-0.1.4-11.el7_0.x86_64                               11/25 
  正在安装    : PyYAML-3.10-11.el7.x86_64                                   12/25 
  正在安装    : python2-pyyaml-3.10-0.el7.noarch                            13/25 
  正在安装    : tftp-server-5.2-22.el7.x86_64                               14/25 
  正在安装    : syslinux-4.05-15.el7.x86_64                                 15/25 
  正在安装    : python2-simplejson-3.11.1-1.el7.x86_64                      16/25 
  正在安装    : mailcap-2.1.41-2.el7.noarch                                 17/25 
  正在安装    : httpd-2.4.6-99.el7.centos.1.x86_64                          18/25 
  正在安装    : mod_wsgi-3.4-18.el7.x86_64                                  19/25 
  正在安装    : cobbler-2.8.5-6.el7.x86_64                                  20/25 
  正在更新    : 12:dhclient-4.2.5-83.el7.centos.1.x86_64                    21/25 
  正在安装    : 12:dhcp-4.2.5-83.el7.centos.1.x86_64                        22/25 
  清理        : 12:dhclient-4.2.5-58.el7.centos.x86_64                      23/25 
  清理        : 12:dhcp-common-4.2.5-58.el7.centos.x86_64                   24/25 
  清理        : 12:dhcp-libs-4.2.5-58.el7.centos.x86_64                     25/25 
  验证中      : cobbler-2.8.5-6.el7.x86_64                                   1/25 
  验证中      : mailcap-2.1.41-2.el7.noarch                                  2/25 
  验证中      : 12:dhclient-4.2.5-83.el7.centos.1.x86_64                     3/25 
  验证中      : httpd-2.4.6-99.el7.centos.1.x86_64                           4/25 
  验证中      : python2-cheetah-2.4.4-6.el7.x86_64                           5/25 
  验证中      : python2-pyyaml-3.10-0.el7.noarch                             6/25 
  验证中      : python2-simplejson-3.11.1-1.el7.x86_64                       7/25 
  验证中      : python-pygments-1.4-10.el7.noarch                            8/25 
  验证中      : apr-util-1.5.2-6.el7_9.1.x86_64                              9/25 
  验证中      : apr-1.4.8-7.el7.x86_64                                      10/25 
  验证中      : mod_wsgi-3.4-18.el7.x86_64                                  11/25 
  验证中      : 12:dhcp-common-4.2.5-83.el7.centos.1.x86_64                 12/25 
  验证中      : 12:dhcp-4.2.5-83.el7.centos.1.x86_64                        13/25 
  验证中      : 12:dhcp-libs-4.2.5-83.el7.centos.1.x86_64                   14/25 
  验证中      : syslinux-4.05-15.el7.x86_64                                 15/25 
  验证中      : tftp-server-5.2-22.el7.x86_64                               16/25 
  验证中      : libyaml-0.1.4-11.el7_0.x86_64                               17/25 
  验证中      : httpd-tools-2.4.6-99.el7.centos.1.x86_64                    18/25 
  验证中      : python2-markdown-2.4.1-4.el7.noarch                         19/25 
  验证中      : 32:bind-export-libs-9.11.4-26.P2.el7_9.15.x86_64            20/25 
  验证中      : PyYAML-3.10-11.el7.x86_64                                   21/25 
  验证中      : python-pillow-2.0.0-23.gitd1c6db8.el7_9.x86_64              22/25 
  验证中      : 12:dhcp-libs-4.2.5-58.el7.centos.x86_64                     23/25 
  验证中      : 12:dhclient-4.2.5-58.el7.centos.x86_64                      24/25 
  验证中      : 12:dhcp-common-4.2.5-58.el7.centos.x86_64                   25/25 

已安装:
  cobbler.x86_64 0:2.8.5-6.el7            dhcp.x86_64 12:4.2.5-83.el7.centos.1   
  httpd.x86_64 0:2.4.6-99.el7.centos.1   

作为依赖被安装:
  PyYAML.x86_64 0:3.10-11.el7                                                     
  apr.x86_64 0:1.4.8-7.el7                                                        
  apr-util.x86_64 0:1.5.2-6.el7_9.1                                               
  bind-export-libs.x86_64 32:9.11.4-26.P2.el7_9.15                                
  httpd-tools.x86_64 0:2.4.6-99.el7.centos.1                                      
  libyaml.x86_64 0:0.1.4-11.el7_0                                                 
  mailcap.noarch 0:2.1.41-2.el7                                                   
  mod_wsgi.x86_64 0:3.4-18.el7                                                    
  python-pillow.x86_64 0:2.0.0-23.gitd1c6db8.el7_9                                
  python-pygments.noarch 0:1.4-10.el7                                             
  python2-cheetah.x86_64 0:2.4.4-6.el7                                            
  python2-markdown.noarch 0:2.4.1-4.el7                                           
  python2-pyyaml.noarch 0:3.10-0.el7                                              
  python2-simplejson.x86_64 0:3.11.1-1.el7                                        
  syslinux.x86_64 0:4.05-15.el7                                                   
  tftp-server.x86_64 0:5.2-22.el7                                                 

作为依赖被升级:
  dhclient.x86_64 12:4.2.5-83.el7.centos.1                                        
  dhcp-common.x86_64 12:4.2.5-83.el7.centos.1                                     
  dhcp-libs.x86_64 12:4.2.5-83.el7.centos.1                                       

完毕!
4.2.3设置开机自启
[root@localhost ~]#systemctl enable --now cobblerd.service  httpd.service tftp.socket dhcpd
Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
Created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.
Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/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.
4.2.4检查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 : change 'disable' to 'no' in /etc/xinetd.d/tftp
4 : Some network boot-loaders are missing from /var/lib/cobbler/loaders.  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.
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.2.8的服务即可
4.2.5生成新密码
#需要设置新密码  默认安装好的root用户的密码是cobbler  该项不设置也可以

[root@localhost ~]#openssl passwd -1 '123123'
$1$UXvic1Mh$JnZrF61ogglkIYZXuL1H..


#生成123123密码的加密格式
4.2.6修改cobbler配置信息
[root@localhost ~]#vim /etc/cobbler/settings 
#配置cobbler文件信息

101 default_password_crypted: "$1$UXvic1Mh$JnZrF61ogglkIYZXuL1H.."   #登录密码123123
242 manage_dhcp: 1                  #默认为0,设置为1,通过cobbler生成dhcpd.conf配置文件
278 next_server: 192.168.241.11     #tftp服务器的IP地址
298 pxe_just_once: 1                #默认为0,设置为1,防止重复安装系统
390 server: 192.168.241.11          #cobbler服务器的IP地址
4.2.7重启服务,查看配置信息
[root@localhost ~]#systemctl restart cobblerd.service
[root@localhost ~]#cobbler check
The following are potential configuration items that you may want to fix:

1 : change 'disable' to 'no' in /etc/xinetd.d/tftp
2 : Some network boot-loaders are missing from /var/lib/cobbler/loaders.  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.
3 : enable and start rsyncd.service with systemctl
4 : debmirror package is not installed, it will be required to manage debian deployments and repositories
5 : 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.2.8配置dhcp文件信息
[root@localhost ~]#vim /etc/cobbler/dhcp.template 



subnet 192.168.241.0 netmask 255.255.255.0 {
     option routers             192.168.241.2;
     option domain-name-servers 8.8.8.8;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.241.30 192.168.241.60;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;



[root@localhost ~]#cobbler sync
#自动生成dhcp配置文件并启动
task started: 2024-01-17_141426_sync
task started (id=Sync, time=Wed Jan 17 14:14:26 2024)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
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.manage_genders
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
#任务完成

4.2.9导入Centos系统的安装文件,生成相应的yum源
[root@localhost ~]#mount /dev/sr0 /mnt
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]#cobbler import --name=centos-7-x86_64 --path=/mnt --arch=x86_64task started: 2024-01-17_141704_import
task started (id=Media import, time=Wed Jan 17 14:17:04 2024)
Found a candidate signature: breed=suse, version=opensuse15.0
Found a candidate signature: breed=suse, version=opensuse15.1
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-x86_64:
creating new distro: centos-7-x86_64
trying symlink: /var/www/cobbler/ks_mirror/centos-7-x86_64 -> /var/www/cobbler/links/centos-7-x86_64
creating new profile: centos-7-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-x86_64 for centos-7-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos-7-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/centos-7-x86_64
looking for /var/www/cobbler/ks_mirror/centos-7-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos-7-x86_64/repodata
*** TASK COMPLETE ***
4.2.10重启客户机,选择网络安装系统 

4.2.11选择内核 

4.2.12在页面等待即可 

4.2.13验证

4.3延伸

#下载启动的相关文件
[root@centos7 ~]#cobbler get-loaders
[root@centos7 ~]#ls /var/lib/cobbler/loaders

[root@centos7 ~]#tree /var/lib/tftpboot/

[root@centos7 ~]#cobbler sync


#也可以在导入yum源的同时进行关联自定义的kickstart文件
[root@centos7 ~]#cobbler import --name=centos-7.7-x86_64 --path=/mnt --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7.cfg


[root@centos7 ~]#du -sh /var/www/cobbler/ks_mirror/*


#设置默认安装菜单, 这样未装系统的设备会自动从pxe引导启动你需要安装的系统, 不需要再手动接显示器选了

[root@centos7 ~]#cobbler system add --name=default --profile=centos-7-x86_64
配置文件作用
/etc/cobbler配置文件目录
/etc/cobbler/settingscobbler主配置文件,这个文件是YAML格式,Cobbler是python写的程序
/etc/cobbler/dhcp.templateDHCP服务的配置模版
/etc/cobbler/tftpd.templatetftp服务的配置模板
/etc/cobbler/rsync.templatersync服务的配置模板
/etc/cobbler/isoiso服务的配置模板
/etc/cobbler/pxepxe模板文件目录
/etc/cobbler/poewer电源的配置文件目录
/etc/cobbler/users.confWeb服务授权配置文件
/etc/cobbler/users.digest用于web访问的用户名密码配置文件
/etc/cobbler/dnsmasq.templateDNS服务的配置模板
/etc/cobbler/modules.confCobbler模块配置文件
/var/lib/cobblerCobbler数据目录
/var/lib/cobbler/config配置文件
/var/lib/cobbler/kickstarts默认存放kickstart文件
/var/lib/cobbler/loaders存放的各种引导程序
/var/www/cobbler系统安装镜像目录
/var/www/cobbler/ks_mirror导入的系统镜像列表
/var/www/cobbler/images导入的系统镜像启动文件
/var/www/cobbler/repo_mirroryum源存储目录
/var/log/cobbler日志目录
/var/log/cobbler/install.log客户端系统安装日志
/var/log/cobbler/cobbler.logcobbler日志
Cobbler命令帮助
命令说明
cobbler check核对当前设置是否有问题
cobbler list列出所有的cobbler元素
cobbler report列出元素的详细信息
cobbler sync同步配置到数据目录,更改配置最好都执行一下
cobbler reposync同步yum仓库
cobbler distro查看导入的发行版系统信息
cobbler system查看添加的系统信息
cobbler profile查看配置信息

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/331387.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

C++核心编程之通过类和对象的思想对文件进行操作

目录 ​​​​​​​一、文件操作 1. 文件类型分类&#xff1a; 2. 操作文件的三大类 二、文本文件 1.写文件 2.读文件 三、二进制文件 1.写二进制文件 2.读二进制文件 一、文件操作 程序运行时产生的数据都属于临时数据,程序一旦运行结束都会被释放 通过文件可以将…

XXL-Job的搭建接入Springboot项目(详细)

一、XXL-Job介绍 XXL-Job 是一款开源的分布式任务调度平台&#xff0c;由 Xuxueli&#xff08;徐雪里&#xff09;开发。它基于 Java 技术栈&#xff0c;提供了一套简单易用、高可靠性的任务调度解决方案。 XXL-Job 的主要作用是帮助开发者实现定时任务的调度和执行。它可以用…

一、VTK 9.0.0 编译安装步骤 VS2019 CMake3.26.0

零基础开始学习VTK &#xff0c;请跟我进行第一步&#xff0c;配置好开放环境&#xff01; 首先&#xff0c;你时间比较紧急&#xff0c;想直接使用VTK &#xff0c;而无需编译、那么请使用 PCL-1.12.0-AllInOne-msvc2019-win64.exe 它已经帮你编译好VTK 9 了&#xff0c;直…

Defi安全--Orion Protocol攻击事件分析

其它相关文章可见个人主页 1. Orion Protocol攻击事件相关信息 2023年2月2日&#xff0c;在ETH和BSC上的Orion Protocol项目被攻击&#xff0c;这里以ETH上攻击为例&#xff1a; 攻击合约地址&#xff1a;Attacker Contract Address | Etherscan攻击者地址&#xff1a;Orion…

合并K个升序链表(LeetCode 23)

文章目录 1.问题描述2.难度等级3.热门指数4.解题思路方法一&#xff1a;顺序合并方法二&#xff1a;分治合并方法三&#xff1a;使用优先队列合并 参考文献 1.问题描述 给你一个链表数组&#xff0c;每个链表都已经按升序排列。 请你将所有链表合并到一个升序链表中&#xff…

GNSS数据下载软件 -- 武汉大学 Fast软件(体验感极佳~)

目录 一、简介与下载地址 1.介绍 2.软件特点 3.下载地址 4.以github下载链接为例 二、下载方法(三种方法&#xff0c;以windows系统为例) 1.双击"Fast.exe"根据提示引导下载 2.手动输入"cmd"进入命令行界面&#xff0c;通过输入相关命令进行下载 …

【GAMES101】Lecture 07 着色(shading)

目录 着色 Blinn-Phong反射模型 漫反射 光衰减 着色 这个着色&#xff08;shading&#xff09;就是将不同的材质应用到不同的物体上&#xff0c;像一个物体&#xff0c;它可以是木头的、金属的、塑料的…… Blinn-Phong反射模型 我们来看一个简单的着色模型&#xff0c;…

机器学习--人工智能概述

人工智能概述 入门人工智能&#xff0c;了解人工智能是什么。为啥发展起来&#xff0c;用途是什么&#xff0c;是最重要也是最关键的事情。大致有以下思路。 人工智能发展历程机器学习定义以及应用场景监督学习&#xff0c;无监督学习监督学习中的分类、回归特点知道机器学习…

NoClassDefFoundError: org/mybatis/logging/LoggerFactory

NoClassDefFoundError: org/mybatis/logging/LoggerFactory 问题描述问题分析问题解决 问题描述 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name userServiceImpl: Unsatisfied dependency expressed through field baseM…

QT 绘图与重绘事件

代码实现仪表盘 .cpp #include "widget.h" #include "ui_widget.h"#include <QPainter> #include <QPen> #include <QBrush>#include <QDebug> Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget) {ui->…

【网站项目】基于springboot与vue的电子商城项目

&#x1f64a;作者简介&#xff1a;多年一线开发工作经验&#xff0c;分享技术代码帮助学生学习&#xff0c;独立完成自己的项目或者毕业设计。 代码可以私聊博主获取。&#x1f339;赠送计算机毕业设计600个选题excel文件&#xff0c;帮助大学选题。赠送开题报告模板&#xff…

C++设计模式(李建忠)笔记3

C设计模式&#xff08;李建忠&#xff09; 本文是学习笔记&#xff0c;如有侵权&#xff0c;请联系删除。 参考链接 Youtube: C设计模式 Gtihub源码与PPT&#xff1a;https://github.com/ZachL1/Bilibili-plus 豆瓣: 设计模式–可复用面向对象软件的基础 文章目录 C设计模…

STL常用容器—vector容器

STL常用容器—vector容器 vector基本概念容器的基本操作容器的常见方法容器迭代器&#xff08;遍历&#xff09;容器的插入与删除容器的嵌套及存放自定义数据容器的嵌套容器存放自定义数据 vector基本概念 功能&#xff1a; vector数据结构和数组非常相似&#xff0c;也称为单…

Chrome 开发者工具

Chrome 开发者工具 介绍控制面板时间线下载信息概要请求列表单个请求时间线优化时间线上耗时项 lighthouse 插件Performance&#xff08;性能指标&#xff09;Accessibility&#xff08;可访问性&#xff09;Best Practices&#xff08;最佳实践&#xff09;SEO&#xff08;搜索…

Iris微服务框架_golang web框架_完整示例Demo

Iris简介 Iris是一款Go语言中用来开发web应用的框架&#xff0c;该框架支持编写一次并在任何地方以最小的机器功率运行&#xff0c;如Android、ios、Linux和Windows等。该框架只需要一个可执行的服务就可以在平台上运行了。 Iris框架以简单而强大的api而被开发者所熟悉。iris…

寒武纪显卡实现softmax的pingpong流水并行

在上一篇文章添加链接描述中我们介绍了寒武纪显卡实现基本的softmax代码&#xff0c;这里我们借助于寒武纪的流水并行来编写进一步的策略。 pingpongGDRAM2NRAM流水 仅仅计算max和sum使用流水 我们先考虑不使用SRAM的流水&#xff0c;我们设置两个NRAM上的长度为maxNum上的数…

STM32标准库开发——USART串口外设

USART外设介绍 USART (Universal Synchronous/AsynchronousReceiver/Transmitter&#xff09;通用同步/异步收发器USART是STM32内部集成的硬件外设&#xff0c;可根据数据寄存器的一个字节数据自动生成数据帧时序&#xff0c;从TX引脚发送出去&#xff0c;也可自动接收RX引脚的…

WebGL中开发AR应用

WebGL在本质上是用于在浏览器中进行3D和2D图形渲染的技术&#xff0c;而增强现实&#xff08;AR&#xff09;通常需要与现实世界的环境进行交互。要在WebGL中开发AR应用&#xff0c;您可以采取以下步骤&#xff0c;希望对大家有所帮助。北京木奇移动技术有限公司&#xff0c;专…

Arm Generic Interrupt Controller v3 and v4(GICv3v4)学习(一)

提示 该博客主要为个人学习&#xff0c;通过阅读官网手册整理而来&#xff08;个人觉得阅读官网的英文文档非常有助于理解各个IP特性&#xff09;。若有不对之处请参考参考文档&#xff0c;以官网参考文档为准。 Arm Generic Interrupt Controller v3 and v4学习一共分为三章&…

RHEL8 Samba服务器详细配置用户模式

任务&#xff1a; 配置server01为samba服务器&#xff0c;samba服务器的/companydata/sales为共享目录&#xff0c;共享名为sales&#xff0c;里面创建测试文件test_share.tar&#xff0c;创建用户组sales&#xff0c;创建组内用户sale1&#xff0c;要求配置用户模式访问&#…
最新文章