环境: CentOS 7 VMware Workstation Pro 14

介绍:

Cobbler 的优点:自动管理各个服务器间的配置,更强大的管理功能。而且它还有 Web 管理界面,可以通过点一点鼠标就可以安装一台主机。Kickstart 的模板文件可以配置多个。

Cobbler 运行流程

Server 端: 第一步:启动 Cobbler 服务 第二步:进行 Cobbler 错误检查,执行 Cobbler check 命令 第三步:进行配置同步,执行 Cobbler sync 命令 第四步:复制相关启动文件文件到 TFTP 目录中 第五步:启动 DHCP 服务,提供地址分配 第六步:DHCP 服务分配 IP 地址 第七步:TFTP 传输启动文件 第八步:Server 端接收安装信息 第九步:Server 端发送 ISO 镜像不 Kickstart 文件

Client 端: 第一步:客户端以 PXE 模式启动 第二步:客户端获取 IP 地址 第三步:通过 TFTP 服务器获取启动文件 第四步:进入 Cobbler 安装选择界面 第五步:客户端确定加载信息 第六步:根据配置信息准备安装系统 第七步:加载 Kickstart 文件 第八步:传输系统安装的其它文件 第九步:进行安装系统

实战:

IP地址:192.168.20.104

Cobbler 服务端对内存的要求不高,只要能把Cobbler服务跑起来就行。但是客户端对内存有要求,文章后面会说。

1、关闭selinux和防火墙

systemctl stop firewalld.service && systemctl disable firewalld.service && iptables -F && setenforce 0sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

2、配置好网络源

cat >> /etc/yum.repos.d/CentOS-Base.repo << EOF[aliyun-os]
name=aliyun-os
baseurl=https://mirrors.aliyun.com/centos/7/os/x86_64/
enabled=1
gpgcheck=0[aliyun-epel]
name=aliyun-epel
baseurl=https://mirrors.aliyun.com/epel/7/x86_64/
enabled=1
gpgcheck=0[aliyun-extra]
name=aliyun-extra
baseurl=https://mirrors.aliyun.com/centos/7/extras/x86_64/
enabled=1
gpgcheck=0EOFyum install -y epel-release #Cobbler 和 tftp-server 在 base 源中是没有的yum install -y cobbler cobbler-web dhcp tftp-server pykickstart httpd rsync xinetd

软件作用说明 cobbler #Cobbler 程序包 cobbler-web #Cobbler 的 Web 服务包 pykickstart #Cobbler 检查 kickstart 语法错误 httpd #Apache Web 服务

Cobbler 工作目录介绍

[root@server104 ~]# ls /etc/cobbler/

auth.conf genders.template named.template secondary.template zone.template cheetah_macros import_rsync_whitelist power settings zone_templates cobbler_bash iso pxe tftpd.template completions ldap reporting users.conf dhcp.template modules.conf rsync.exclude users.digest dnsmasq.template mongodb.conf rsync.template version

/etc/cobbler # 配置文件目录

/etc/cobbler/settings # Cobbler 主配置文件,这个文件是 YAML 格式,Cobbler 是 python 写的程序。

/etc/cobbler/dhcp.template # DHCP服务的配置模板

/etc/cobbler/tftpd.template # tftp 服务的配置模板

/etc/cobbler/rsync.template # rsync 服务的配置模板

/etc/Cobbler/iso # iso 模板配置文件目录

/etc/cobbler/pxe # pxe 模板文件目录

/etc/cobbler/power # 电源的配置文件目录

/etc/cobbler/users.conf # Web 服务授权配置文件

/etc/cobbler/users.digest # 用于 Web 访问的用户名密码配置文件 /etc/cobbler/dnsmasq.template # DNS 服务的配置模板

/etc/cobbler/modules.conf # Cobbler 模块配置文件

/var/lib/cobbler # Cobbler 数据目录

/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_mirror # yum 源存储目录

/var/log/cobbler # 日志目录

/var/log/cobbler/install.log # 客户端系统安装日志

/var/log/cobbler/cobbler.log # Cobbler 日志

3、启动 Cobbler 和 httpd 服务

systemctl start cobblerd httpd

检查 Cobbler 配置

cobbler check

[root@server104 ~]$ 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.

我们会发现出现了8个问题,需要去逐条解决

问题1:

vim /etc/cobbler/settings

将 390 行的 server 地址改为服务端的 IP (192.168.20.104)

问题2:

vim /etc/cobbler/settings

将 278 行的 next_server 地址改为服务端的 IP (192.168.20.104)

问题3:修改 tftp 服务被 xinetd 服务管理

vim /etc/xinetd.d/tftp

将 14 行的 disable = yes 改为 disable = no

顺便修改 xinetd 和 tftpd 服务开机启动

systemctl start xinetd tftp && systemctl enable xinetd tftp

问题4:下载操作系统引导文件

cobbler get-loaders

我们发现会报错:No such command: get-loaders

还有一个解决方法:即安装syslinux,我们可以直接通过YUM的方式进行安装,安装后,尽管cobbler check命令依然报错,但是我们可以不用理会该报错,直接进行cobbler的下一步配置即可!

问题5:修改 rsyncd 服务为开机自启动状态并启用它。

systemctl start rsyncd && systemctl enable rsyncd

问题6:debmirror package is not installed, it will be required to manage debian deployments and repositories

关于 debian 相关部署管理配置,忽略。

问题7:修改操作系统默认密码

openssl passwd -1 -salt 'root' '7777777'

$1$root$lUk924UEnkkVfR5NXuBYn.

vim /etc/cobbler/settings

将 101 行 单引号里面的一串字符改为上面输出的那一行:$1$root$lUk924UEnkkVfR5NXuBYn.

注:root 为用户描述,7777777 为密码

问题8:fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

电源管理相关服务,忽略

4、接下来检查 DHCP 配置,由于 Cobbler 自动管理 DHCP 服务,我们只需要修改 Cobbler 中的模板配置文件即可。

vim /etc/cobbler/dhcp.template

将 21 行开始的 IP 改为我们自己使用的服务器的实际 IP

参考如下:

21 subnet 192.168.20.0 netmask 255.255.255.0 {

22 option routers 192.168.20.2;

23 option domain-name-servers 114.114.114.114;

24 option subnet-mask 255.255.255.0;

25 range dynamic-bootp 192.168.20.100 192.168.20.254;

26 default-lease-time 21600; 27 max-lease-time 43200; 28 next-server $next_server;

修改 Cobbler 管理 dhcp 服务

vim /etc/cobbler/settings

将 242 行的 manage_dhcp: 0 改为 manage_dhcp: 1

同步配置文件,需要先重启 Cobblerd

systemctl restart cobblerdcobbler sync

task started: 2023-01-02_033213_sync
task started (id=Sync, time=Mon Jan  2 03:32:13 2023)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink /usr/share/syslinux/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
trying hardlink /usr/share/syslinux/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
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 ***

如果出现上面这样的输出,那么表明这一步就成功了

重新检查一下 Cobbler

cobbler check

The following are potential configuration items that you may want to fix:

1 : 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.

2 : debmirror package is not installed, it will be required to manage debian deployments and repositories

3 : 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 服务配置完成。

技术交流:

搭建 Cobbler 无人值守安装服务器相关推荐

  1. 搭建Cobbler无人值守安装服务器

    Cobbler 介绍 Cobbler是一个Linux服务器快速网络安装的服务,而且在经过调整也可以支持网络安装windows. 该工具使用python开发,小巧轻便(才15k行python代码),可以 ...

  2. 搭建无人值守安装服务器(CentOS)

    使用PXE+DHCP+TFTP+Kickstart+FTP搭建无人值守安装服务器.一般只有频繁安装系统才会搭建无人值守安装服务器. 虚拟机环境:youxi1,CentOS7系统双网卡,一个网卡桥接模式 ...

  3. 搭建无人值守安装服务器

    搭建无人值守安装服务器 方法:FTP+TFTP+DHCP+Kickstart+PXE 一.原理和概念 1.PXE PXE并不是一种安装方式,而是一种引导方式.进行PXE安装的必要条件是要安装的计算机中 ...

  4. 搭建pxe远程安装服务器

    目录 一.PXE概述 二.PXE批量部署的优点 三.搭建PXE网络体系所需条件 四.搭建PXE远程安装服务器 1.安装DHCP服务 2.安装tftp 3.准备pxe引导程序 4.安装ftp源 5.配置 ...

  5. Cobbler无人值守安装

    一.Cobbler 与 PXE 的不同点 1.Cobbler 是什么? Cobbler 是红帽公司研发的基于 PXE 技术的装机服务,可以选着性安装多个不同的操作系统 2.Cobbler 与 PXE ...

  6. Cobbler无人值守安装系统史上最细实践文档

    本文档来自老男孩教育VIP课程 内部学员总结笔记文档笔记内容,和大家分享! 老男孩教育2016年全干货博客,http://blog.oldboyedu.com Cobbler无人值守安装系统史上最细实 ...

  7. COBBLER无人值守安装-----已用真实服务器测试

    已用真实服务器测试安装,只要按照步骤做就可以正常使用. 后面主要是KS文件的编写.centos7默认是xfs系统,默认的ks文件,安装包是292个,用ISO装系统,选最小化安装是297个,基本一致. ...

  8. cobbler 无人值守-安装

    环境准备 准备两台主机,如centos6和centos7 centos7当作server服务器 关闭selinux 关闭防火墙 安装 cobbler包光盘里是没有的,要配置epel源,这里就说怎么配置 ...

  9. Centos7.x实现Cobbler无人值守安装

    Cobbler 技术原理解析: Client向PXE Server上的DHCP发送IP地址请求消息,DHCP检测Client是否合法(主要是检测Client的网卡MAC地址),如果合法则返回Clien ...

最新文章

  1. Xamarin iOS开发实战上册-----2.2.2 使用代码添加视图
  2. 陈中华:李彦宏候选工程院院士,是全中国人民的大耻辱
  3. 开发一个爆款 VS Code 插件这么简单!
  4. ajax实现滚动刷新,jquery如何实现滚动自动加载
  5. php输出分组,ThinkPHP 项目分组中的模板输出
  6. Java 12 将于3月19日发布,8 个最终 JEP 一览
  7. 配置jupyter-pytorch深度学习环境
  8. 在window打包war
  9. cpu开机就是60℃_注意,制冷机组开机前这些检查很重要
  10. python资源库——socket网络编程
  11. JS+PHP实现登录后自动执行之前的操作
  12. simpson积分模板
  13. 如何从0到1进行电商平台订单系统的搭建?
  14. SpringBoot中配置文件
  15. 2015腾讯校园招聘(菜鸟逆袭腾讯,offer get)
  16. AllenNLP—笔记—json
  17. 数据报表常用excel公式
  18. 终于可以舒服的看电子书了
  19. .NetCore Mediator的简单使用
  20. FTDI 2232H GPIO设置 NAND Read

热门文章

  1. 【Todo】【读书笔记】机器学习实战(Python版)
  2. 计算机体系结构的庖丁解牛
  3. html 设置元素向左浮动
  4. 通过Kali Linux暴力破解WiFi密码
  5. python安装需要什么电脑配置_自学python用什么配置电脑?
  6. cd linux 新增分区,目前国内最完整详细的 CDlinux 硬盘安装手册
  7. 广交投集团领导莅临星舆科技参观交流
  8. android平板能玩吃鸡吗,吃鸡不卡的安卓平板
  9. Hive面试题系列第三题-用户留存问题
  10. Python-维度dim的定义及其理解使用