cobble-安装原理

2021年10月21日

18:10

一、cobbler简介

上一节中的pxe+kickstart已经可以解决网络批量装机的问题了,但是环境配置过于复杂,而且仅针对某一个 版本的操作系统进批量安装则无法满足目前复杂环境的部署需求。

本小节所讲的cobbler则是基于pxe+kickstart技术的二次封装工具,简化了安装部署流程,增加了对多发行版 的支持,并且有独立的web管理页面,极大方便了运维初级人员的学习和使用。

二、cobbler工作原理

pxe+kickstart工作原理:见上一节课件

cobbler二次封装后的工作原理:

cobbler-部署流程

2021年10月21日

18:13

实验环境准备

1.准备工作

硬盘内存:添加一块100G的磁盘

1.1 关闭防火墙和SELinux

systemctl stop firewalld

systemctl disable firewalld

setenforce 0

sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

1.2 配置连接到互联网

vim /etc/sysconfig/network-scripts/ifcfg-ens33

#将网络环境修改为nat,并且可连接外网

测试:

nslookup www.baidu.com

ping 回复的百度地址

1.3 配置基础网络yum源和epel扩展yum源

#无需修改为网络yum源,wget命令能自动切换网络源下载

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

yum clean all

yum makecache

2.安装cobbler和相关软件

2.1 安装软件

yum -y install cobbler cobbler-web tftp-server dhcp httpd xinetd

2.2 启动&设置开机自启动

systemctl start httpd cobblerd

systemctl enable httpd cobblerd

3.配置cobbler

3.1 检查cobbler配置,根据提示完成修改

cobbler check

#检查配置文件,根据问题解决方案完成配置

问题集合如下:

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 : ksvalidator was not found, install pykickstart

8 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one 9 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

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

问题一&问题二:

sed -i 's/allow_dynamic_settings: 0/allow_dynamic_settings: 1/' /etc/cobbler/settings

systemctl restart cobblerd.service

#一定要先重启服务然后执行下面两条命令

cobbler setting edit --name=server --value=IP地址

cobbler setting edit --name=next_server --value=IP地址

cobbler setting edit --name=pxe_just_once --value=1

问题三:

sed -i '14s/yes/no/' /etc/xinetd.d/tftp

#需要提前确定要替换内容的行号{disable = no}

问题四:

#cobbler get-loaders

#这个是原来的解决方案,但是最近官方做了重大更新,不在提供引导程序的下载功能了,so这个会报错

下载大神做好的文件 https://raw.githubusercontent.com/hbokh/cobbler-loaders/main/files/cobbler-loaders.tar.gz

 

yum -y install grub2-efi-x64-modules grub2-pc-modules

#rz所需tar包

tar -xf /root/cobbler-loaders.tar.gz

cd /var/lib/cobbler/loaders/

cp -a /root/var/lib/cobbler/loaders/* ./

问题五:

systemctl enable rsyncd

systemctl start rsyncd

问题六:忽略即可,debian相关配置

#该条问题忽略:debmirror package is not installed, it will be required to manage debian deployments and repositories

问题七:

yum -y install pykickstart

问题八:

openssl passwd -1 -salt 'root' '123456'

#生成用户为root,密码为123456的秘钥

vim /etc/cobbler/settings

default_password_crypted: 生成的秘钥

问题九:

yum -y install fence-agents

cobbler check

检查是否只保留debmirror一个问题

3.3 配置cobbler-dhcp

cobbler setting edit --name=manage_dhcp --value=1

vim /etc/cobbler/dhcp.template

subnet 192.168.117.0 netmask 255.255.255.0 {

option routers             192.168.117.2;

option domain-name-servers 8.8.8.8;

option subnet-mask         255.255.255.0;

range dynamic-bootp        192.168.117.200 192.168.117.254;

systemctl restart cobblerd

3.4 将cobbler控制的各个服务和文件复制到指定位置

cobbler sync

如果报错:dhcpd -t failed

原因:python文件内命令错误

解决:

cp -a /usr/lib/python2.7/site-packages/cobbler/modules/sync_post_restart_services.py /tmp

cd /tmp

vim sync_post_restart_services.py

#修改前dhcp_restart_command = "service %s restart" % dhcp_service_name

#修改后dhcp_restart_command = "/usr/bin/systemctl restart %s " % dhcp_service_name python -m compileall sync_post_restart_services.py

python -O -m compileall sync_post_restart_services.py

#重新编译

cp -a * /usr/lib/python2.7/site-packages/cobbler/modules/

#复制粘贴回去 systemctl restart cobbler cobbler sync

3.5 将所有服务全部重启一遍

systemctl restart httpd rsyncd dhcpd xinetd cobblerd

导入镜像绑定ks文件

1.导入镜像

在新建的sdb磁盘上创建/iso目录存放镜像文件

gdisk /dev/sr0

mkfs.xfs /dev/sdb1

mkdir /iso

vim /etc/fstab

/dev/sdb1 /iso xfs defaults 0 0

mount -a

mkdir /iso/centos7.6/

mount -r /dev/sr0 /iso/centos7.6/

cobbler import --name="CentOS-7.6-x86_64" --path=/iso/centos7.6

#注意:如果需要使用多个镜像文件,先将镜像文件上传至/iso目录,然后通过mount -o loop挂载在对应目录中

cobbler profile list #查看可用的镜像

2.生成ks模板文件

cd /var/lib/cobbler/kickstarts/

vim centos7.cfg

#可以直接导入之前pxe用的文件 vim centos7.cfg

auth --enableshadow --passalgo=sha512

url --url=http://IP地址/centos7/

graphical

firstboot --enable

ignoredisk --only-use=sda

keyboard --vckeymap=us --xlayouts='us'

lang en_US.UTF-8

network --bootproto=dhcp --device=ens33 --onboot=on --ipv6=auto --no-activate

network --hostname=localhost.localdomain

rootpw --iscrypted $6$LO0oxqvmJfQOFW7p$cgV.4sVUp7UgEDSwUToHSIhRCmX4ETF2S/CoRmhnf.NHkCJvS1.Or8HENDSPkCrfnCgUlnVdxNWR0iK20GZF70

firewall --disabled

selinux --disabled

services --disabled="chronyd"

timezone Asia/Shanghai --isUtc --nontp

bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda

clearpart --none --initlabel

part /boot --fstype="xfs" --ondisk=sda --size=1024

part swap --fstype="swap" --ondisk=sda --size=2048

part / --fstype="xfs" --ondisk=sda --size=17407

%packages

@^web-server-environment

@base

@core

@web-server

kexec-tools

%end

reboot

#注意使用生成模板会报错

#url --url=http://IP地址/cobbler/ks_mirror/CentOS-7.6-x86_64/

#修改为指定目录

install

keyboard 'us'

rootpw --iscrypted $1$HD6uBs4I$H07T23/rHG7.jggmTrtiI/

url --url="http://192.168.85.132/cobbler/ks_mirror/CentOS-7.6-x86_64"

graphical

lang zh_CN.UTF-8

auth  --useshadow  --passalgo=sha512

graphical

firstboot --disable

selinux --disabled

firewall --disabled

reboot

timezone Asia/Shanghai

bootloader --location=mbr

zerombr

clearpart --all --initlabel

part /boot --fstype="xfs" --size=1024

part swap --fstype="swap" --size=2048

part / --fstype="xfs" --grow --size=1

%packages

@^gnome-desktop-environment

@base

@core

@desktop-debugging

@dial-up

@directory-client

@fonts

@gnome-desktop

@guest-agents

@guest-desktop-agents

@input-methods

@internet-browser

@java-platform

@multimedia

@network-file-system-client

@networkmanager-submodules

@print-client

@x11

chrony

kexec-tools

%end

#图形化引导脚本

3.查看指定镜像的profile配置文件,将ks文件绑定到指定镜像

#查看绑定文件的路径是否为生成的路径

cobbler profile report --name=CentOS-7.6-x86_64

#根据提示修改内容,将自定义ks文件绑定到该镜像上

cobbler profile edit --name=CentOS-7.6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7.cfg

4.创建测试虚拟机进行验证

注意:将虚拟机设置为nat模式,虚拟机的内存必须大于2G,否则会出现无法安装的情况

问题解决1:

未进入选择界面

解决方案:

cobbler sync

cobbler-网络部署

2021年10月24日

16:29

设置web管理终端

1、修改cobbler的web验证模式

grep -A 1 "\[authentication\]" /etc/cobbler/modules.conf

设置密码:统一默认为123456

htdigest -c /etc/cobbler/users.digest Cobbler admin

使用浏览器登陆cobbler_web管理终端

https://192.168.117.102/cobbler_web

#此处必须使用https协议进行登陆

2、进入web管理首页

3、导入镜像文件

导入镜像文件有个前置条件,需要创建目录,并将光盘文件进行挂载

mount -o loop /root/CentOS6.8-xxxxx.iso /iso/centos

4、添加ks模板文件

5、将ks文件和指定的镜像绑定在一起

6、最后执行配置同步(找到sync)

cobble批量装机原理与部署相关推荐

  1. 详述PXE批量装机环境

    部署PXE批量装机环境 DHCP概述及原理 • Dynamic Host Configuration Protocol – 动态主机配置协议,由 IETF(Internet 网络工程师任务小组)组织制 ...

  2. etcd工作原理和部署指南

    etcd工作原理和部署指南 jianweixs https://www.jianshu.com/p/8d22ad512a78 etcd-logo.png ​ etcd是由CoreOS团队发的一个分布式 ...

  3. 基于CentOS7操作cobbler批量装机-(centos7和redhat8)

    基于CentOS7操作cobbler批量装机-centos7和redhat8 1. cobbler简介 2. cobbler服务端部署 3. 客户端安装 4. 定制安装 5.命令方式和定制安装Cent ...

  4. cobbler批量装机系统centos 6.4下安装配置

    最近笔者研究cobbler批量装机系统. cobbler装机系统是较早前kickstart的升级版,优点比较容易配置,还自带web界面比较易于管理,不足在于中文资料较少. 这里就详细的介绍下笔者亲自经 ...

  5. 计算机硬盘对考,台式机怎样让进行硬盘对拷(快速批量装机) 台式机让进行硬盘对拷(快速批量装机)的方法...

    今天给大家带来台式机怎样让进行硬盘对拷(快速批量装机),台式机让进行硬盘对拷(快速批量装机)的方法,让您轻松解决问题.硬盘对拷适用于台式机,因为要把硬盘拆下来两个硬盘连在一起放在一起,在实验室可以使用 ...

  6. 企业实战案例-- LNMP基础架构的原理及部署以及wordpress论坛的安装

    企业实战案例-- LNMP基础架构的原理及部署以及wordpress论坛的安装 LNMP架构原理 一.源码安装mysql 二.源码安装php 三.源码安装nginx 四.安装wordpress论坛 L ...

  7. 【教程】【图文】使用 CCPE 批量装机、网络克隆

    CCPE下载地址:ccpe.net 下载了ISO并且安装到U盘后,可以用它来实现批量装机,主要原理是PXE启动+Ghost网络克隆. 先假设一个应用场景:某教室,有50台同配置的PC(主要是硬盘参数需 ...

  8. 第12节 DNS服务器基本概念、解析原理及部署——以win2003为例

    DNS服务器基本概念.解析原理及部署 1 DNS概述 1.1 基本概念 1.2 域名的结构--树形结构 2 DNS解析分类及过程 2.1 按查询方式分类: 2.2 按查询的内容分类 2.3 普通用户机 ...

  9. Linux批量装机PXE+Kickstart

    文章目录 一.什么是PXE 二.图解PXE装机过程 三.实验 一.什么是PXE PXE,全称 Preboot eXecution Environment,预启动执行环境. PXE是由Inter公司开发 ...

最新文章

  1. Leangoo项目管理软件管理 传统硬件产品开发全流程
  2. python电脑配置大概要多少钱-学python最电脑配置有要求么
  3. 【c++】0.C++笔记
  4. sort函数_MATLAB--数字图像处理 sort()函数
  5. .Net Core----关于MVC中TempData持久化问题
  6. SqlServer2008修改编辑前200行
  7. Linux-sys文件系统
  8. CSS实现水平垂直居中的1010种方式
  9. 【Unity3D插件】Highlighting System插件分享《物体高亮插件》
  10. android webview 刷新当前页面,android webview肿么刷新网页
  11. 学生信息管理系统—流程图
  12. 苹果电脑安装windows双系统
  13. 公众号平台域名配置规则
  14. 分享视频剪辑必备的三个素材软件(配音/文案/图片)
  15. php压缩中文文件,phpzip压缩中文文件时候出现压缩无大小或无法压缩
  16. 如何基于Arduino开发板使用BH1750环境光传感器
  17. UG数控编程3种螺旋刀路,可用于各种2d和3d加工过程
  18. Office 2008 for Macintosh: The Missing Manual
  19. uber幽灵车_Uber&Careem合并:新兴的出租车服务将在中东和北非地区产生影响?...
  20. MySQL 调用 Java 程序

热门文章

  1. Python函数初始
  2. 微信公众号(服务号)接入开发之微信授权登陆
  3. UVM中uvm_sequencer的方法总结
  4. 三战南京大学计算机学硕上岸,初试403经验贴
  5. 洛谷 P1757 通天之分组背包 C++ dp
  6. (PTA)数据结构(作业)4、链表
  7. (深度学习评估指标)——MS COCO detection evaluation metrics
  8. 开源代码学习之persepolis【二】
  9. Win11查找我的设备功能的方法
  10. 安川伺服总线通讯方式_plc通讯方式有哪三种?plc常见的三种通讯方式