基于Cobbler实现多版本系统批量部署

一、实验题目

基于Cobbler实现多版本系统批量部署

二、实验目的

通过Cobbler,实验旨在实现无需人工干预即可自动安装多个版本的操作系统。这可以大大提高机房设备或服务器集群的部署效率,减少人力成本和操作错误。

三、实验环境

centos7.9并安装Cobbler及其依赖服务(如DHCP、TFTP、HTTP等)。

配置EPEL源(如果系统默认源中没有Cobbler),因为Cobbler可能依赖于EPEL源中的某些包。

四、实验内容

  1. 安装Proxmox VE。
  2. 创建 Proxmox VE 集群。
  3. 添加共享存储(NFS)
  4. 上次rocky linux 8.x镜像,创建主机vm1。
  5. 下载CT模板 ubuntu-22.04,创建CT名称为vm2。
  6. vm1迁移。
  7. vm1克隆和快照。

五、实验步骤

第一步:

#centos7 换阿里yum源

cd /etc/yum.repos.d/

mkdir bak_repo

mv *.repo bak_repo/

curl -O https://mirrors.aliyun.com/repo/Centos-7.repo

第二步:

# 关闭防火墙、禁用SELinux

systemctl disable --now firewalld

sed -i '/^SELINUX=/ c SELINUX=disabled' /etc/selinux/config

第三步:

# 配置epel源

yum install

http://ftp.situ.edu.cn/fedora/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm -y

第四步:

安装dhcp httpd xinetd
yum install -y httpd dhcp xinetd tftp-server

安装cobbler
yum install -y cobbler cobbler-web

第五步:

[root@cobbler ~]# 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.  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.
6 : enable and start rsyncd.service with systemctl
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : ksvalidator was not found, install pykickstart
9 : 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
10 : 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.

首先改成自己的IP地址

[root@cobbler ~]# sed -i 's#server: 127.0.0.1#server: 192.168.121.8#g' /etc/cobbler/settings #192.168.121.8写成自己的ip地址
[root@cobbler ~]# sed -i 's#next_server: 127.0.0.1#next_server: 192.168.121.8#g' /etc/cobbler/settings #192.168.121.8写成自己的ip地址

然后进入到

[root@cobbler ~]# vim /etc/xinetd.d/tftp
把disable改为no

然后需要loaders.tar.gz文件导入到centos7.9里面

执行 yum install lrzsz -y

tar xf loaders.tar.gz -C /var/lib/cobbler/loaders/
systemctl enable --now rsyncd.service
yum install pykickstart

执行:

[root@cobbler ~]# openssl passwd -1 -salt `openssl rand -hex 8` '123456'
$1$b03d519c$/I0WqBte6biWEoZL3G0LO.
把这个值复制下来粘贴到vim /etc/cobbler/settings

default_password_crypted: "$1$b03d519c$/I0WqBte6biWEoZL3G0LO."
再执行:

[root@cobbler ~]# yum install cman fence-agents -y
完成之后重启一下

[root@cobbler ~]# 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 : debmirror package is not installed, it will be required to manage debian deployments and repositories

Restart cobblerd and then run 'cobbler sync' to apply changes.
上述两个不用管开始下一步

[root@cobbler ~]# cobbler get-loaders

改dhcp(写自己的):
[root@cobbler cobbler]# vim /etc/cobbler/dhcp.template 

#manage_dhcp: 0	#设置为1时,开启cobbler的dhcp管理器
subnet 192.168.121.0 netmask 255.255.255.0 {
     option routers             192.168.121.2;
     option domain-name-servers 223.5.5.5;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.121.100 192.168.121.200;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
     class "pxeclients" {
setenforce 0
getenforce 

然后浏览器访问https://ip/cobbler_web

写自己的ip地址,账号和密码都是cobbler

页面如下所示

第六步:

在cobbler进行批量部署centos7/8

7的镜像已经挂载了,创建一个目录我们把8的镜像传进去

#再创建目录
[root@cobbler iso]# mkdir -p CentOS/X86_64/CentOS{7..8}/dvd

看一下自己的centos7是否挂载

然后创建镜像导入存放目录,导入dvd 数据

[root@cobbler iso]# mkdir -p /CentOS/X86_64/CentOS{7..8}/dvd

[root@cobbler iso]# mount /dev/cdrom /CenOS/X86_64/CentOS7/dvd

[root@cobbler iso]# mount /iso/CentOS-8.1.1911-x86_64-dvd1.iso /CentOS/X86_64/CentOS8/dvd
mount: /dev/loop0 is write-protected, mounting read-only
[root@cobbler iso]# cobbler import --path=/CentOS/X86_64/CentOS8/dvd/ --name=CentOS8.1 --arch=x86_64

第七步:

创建新的模版

写入如下代码:

# Cobbler for Kickstart Configurator for CentOS 7 by yao zhang
install
url --url=$tree
text
lang en_US.UTF-8
keyboard us
zerombr
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
#Network information
$SNIPPET('network_config')
#network --bootproto=dhcp --device=eth0 --onboot=yes --noipv6 --hostname=CentOS7
timezone --utc Asia/Shanghai
authconfig --enableshadow --passalgo=sha512
rootpw  --iscrypted $default_password_crypted
clearpart --all --initlabel
part /boot --fstype xfs --size 1024
part swap --size 1024
part / --fstype xfs --size 1 --grow
firstboot --disable
selinux --disabled
firewall --disabled
logging --level=info
reboot

%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end

%packages
@^minimal
@compat-libraries
@core
@debugging
@development
bash-completion
chrony
dos2unix
kexec-tools
lrzsz
nmap
sysstat
telnet
tree
vim
wget
%end

%post
systemctl disable postfix.service
%end

再给centos8创建一个

写出如下代码

#version=RHEL8
install
ignoredisk --only-use=sda
# Partition clearing information
clearpart --all --initlabel
# Use graphical install
text
# Use CDROM installation media
url --url=$tree
 
reboot
# Keyboard layouts
keyboard --vckeymap=cn --xlayouts='cn'
# System language
lang en_US.UTF-8
 
selinux --disabled
firewall --disabled
# Network information
network  --bootproto=dhcp --device=ens160 --ipv6=auto --activate
network  --hostname=wenzi.localhost
# Root password
rootpw --iscrypted 
$default_password_crypted
# Run the Setup Agent on first boot
firstboot --enable
# Do not configure the X Window System
skipx
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
# Disk partitioning information
zerombr
 
part /boot --fstype="ext4" --ondisk=sda --size=1024
part /swap --fstype="swap" --ondisk=sda --size=2048
part / --fstype="xfs" --ondisk=sda --grow --size=1
 
 
%packages
@^minimal-environment
kexec-tools
 
%end
 
%addon com_redhat_kdump --enable --reserve-mb='auto'
 
%end
 
%post
 
%end
 
 
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end

记得点击save保存

然后进行验证即可

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

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

相关文章

机器学习 | 回归算法原理——多重回归

Hi,大家好,我是半亩花海。接着上次的多项式回归继续更新《白话机器学习的数学》这本书的学习笔记,在此分享多重回归这一回归算法原理。本章的回归算法原理基于《基于广告费预测点击量》项目,欢迎大家交流学习! 目录 一…

【Django】anaconda环境变量配置及配置python虚拟环境

文章目录 配置环境变量配置python虚拟环境查看conda源并配置国内源在虚拟环境中安装django 配置环境变量 control sysdm.cpl,,3笔者anaconda安装目录为C:\ProgramData\anaconda3 那么需要加入path中的有如下三个 C:\ProgramData\anaconda3 C:\ProgramData\anaconda3\Scripts C:…

【数据结构】搜索二叉树

二叉搜索树 二叉树的博客 在之前的数据结构的文章中已经基本对二叉树有一定的了解,二叉搜索树也是一种数据结构,下面将对二叉搜索树进行讲解。 二叉搜索树的概念 二叉搜索树又称为二叉排序树,它或者是一棵空树,或者是具有下面性…

【微软蓝屏】微软Windows蓝屏问题汇总与应对解决策略

✨✨ 欢迎大家来到景天科技苑✨✨ 🎈🎈 养成好习惯,先赞后看哦~🎈🎈 🏆 作者简介:景天科技苑 🏆《头衔》:大厂架构师,华为云开发者社区专家博主,…

HTML常见标签——超链接a标签

一、a标签简介 二、a标签属性 href属性 target属性 三、a标签的作用 利用a标签进行页面跳转 利用a标签返回页面顶部以及跳转页面指定区域 利用a标签实现文件下载 一、a标签简介 <a>标签用于做跳转、导航&#xff0c;是双标签&#xff0c;记作<a></a>&#…

【北京迅为】《i.MX8MM嵌入式Linux开发指南》-第三篇 嵌入式Linux驱动开发篇-第三十九章 Linux MISC驱动

i.MX8MM处理器采用了先进的14LPCFinFET工艺&#xff0c;提供更快的速度和更高的电源效率;四核Cortex-A53&#xff0c;单核Cortex-M4&#xff0c;多达五个内核 &#xff0c;主频高达1.8GHz&#xff0c;2G DDR4内存、8G EMMC存储。千兆工业级以太网、MIPI-DSI、USB HOST、WIFI/BT…

MongoDB教程(十八):MongoDB MapReduce

&#x1f49d;&#x1f49d;&#x1f49d;首先&#xff0c;欢迎各位来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里不仅可以有所收获&#xff0c;同时也能感受到一份轻松欢乐的氛围&#xff0c;祝你生活愉快&#xff01; 文章目录 引言一、MapRed…

上传项目到GitHub

上传项目到GitHub 前期工作&#xff1a;创建GitHub仓库 1.使用git命令初始化文件夹 git init2.将文件夹里面所有的文件添加到本地仓库&#xff0c;如果想添加单个文件&#xff0c;将.换成文件名就好。 git add .3.给文件备注&#xff0c;双引号里面是文件备注的内容 git c…

8月开始|《660》+《880》45天带刷计划!

660880题目加起来挺多了&#xff01; 如果是一刷加上二刷错题的话&#xff0c;总共需要做2000道题左右。 如果全都吃透的话&#xff0c;按照传统的刷题方法&#xff0c;慢的话需要2个多月&#xff0c;差不多就是每天30多道题的量 快的话&#xff0c;大概就是一个月就能刷完&…

低代码如何加速数字化转型

数字化转型&#xff0c;正日益决定企业成功的关键。这里的一个关键因素是它可以以更快的速度和质量来实施技术计划。在当今瞬息万变的商业环境中&#xff0c;战略性地采用低代码平台对于旨在加快上市时间、增强业务敏捷性和促进跨团队无缝协作的首席技术官来说至关重要。日益增…

【教程】vscode添加powershell7终端

win10自带的 powershell 是1.0版本的&#xff0c;太老了&#xff0c;更换为powershell7后&#xff0c;在 vscode 的集成终端中没有显示本篇教程记录在vscode添加powershell7终端的过程 打开vscode终端配置 然后来到这个页面进行设置 查看 powershell7 的安装位置&#xff…

Linux开启coredump

在Linux系统中&#xff0c;C/C程序崩溃是常见的问题之一。Coredump是指当一个程序崩溃时&#xff0c;系统把程序运行时的内存数据以二进制文件的形式保存下来&#xff0c;以便程序开发者进行崩溃分析。本文将介绍如何开启并配置Coredump 1、查看并配置coredump 在Linux系统中…

Git仓库拆分和Merge

1. 问题背景 我们原先有一个项目叫open-api&#xff0c;后来想要做租户独立发展&#xff0c;每个租户独立成一个项目&#xff0c;比如租户akc独立部署一个akc-open-api&#xff0c;租户yhd独立部署一个yhd-open-api&#xff0c;其中大部分代码是相同的&#xff0c;少量租户定制…

昇思25天学习打卡营第20天|CV-ResNet50图像分类

打卡 目录 打卡 图像分类 ResNet网络介绍 数据集准备与加载 可视化部分数据集 残差网络构建 Building Block 结构 代码实现 Bottleneck结构 代码实现 构建ResNet50网络 代码定义 模型训练与评估 可视化模型预测 重点&#xff1a;通过网络层数加深&#xff0c;感知…

Docker-Compose配置zookeeper+KaFka+CMAK简单集群

1. 本地DNS解析管理 # 编辑hosts文件 sudo nano /etc/hosts # 添加以下三个主机IP 192.168.186.77 zoo1 k1 192.168.186.18 zoo2 k2 192.168.186.216 zoo3 k3注&#xff1a;zoo1是192.168.186.77的别名&#xff0c;zoo2是192.168.186.18的别名&#xff0c;zoo3是192.168.186.1…

【HarmonyOS】应用推送使用个推SDK如何实现?

【HarmonyOS】应用推送使用个推SDK如何实现&#xff1f; 前言 个推和极光都是市面上很成熟的推送第三方SDK了。今天讲讲个推SDK在鸿蒙中如何集成使用。 存在即合理&#xff0c;三方SDK推送给我们带来了极大的好处&#xff0c;首先在服务器后台处理一套API就可搞定&#xff0…

敏捷CSM认证:精通敏捷Scum估算方法,高效完成项目!

咱们做项目的时候可能都遇到过这种情况&#xff1a;项目一开始信心满满&#xff0c;觉得 deadline 稳了。结果呢&#xff1f;各种意外状况频出&#xff0c;时间好像怎么都不够用了&#xff0c;最后项目只能无奈延期&#xff0c;整个团队都像霜打的茄子。 说到底&#xff0c;还…

Mamba-yolo|结合Mamba注意力机制的视觉检测

一、本文介绍 PDF地址&#xff1a;https://arxiv.org/pdf/2405.16605v1 代码地址&#xff1a;GitHub - LeapLabTHU/MLLA: Official repository of MLLA Demystify Mamba in Vision: A Linear AttentionPerspective一文中引入Baseline Mamba&#xff0c;指明Mamba在处理各种高…

Modbus转BACnet/IP网关的技术实现与应用

引言 随着智能建筑和工业自动化的快速发展&#xff0c;不同通信协议之间的数据交换也变得日益重要。Modbus和BACnet/IP是两种广泛应用于自动化领域的通信协议&#xff0c;Modbus以其简单性和灵活性被广泛用于工业自动化&#xff0c;而BACnet/IP则在楼宇自动化系统中占据主导地…

华为网络模拟器eNSP安装部署教程

eNSP是图形化网络仿真平台&#xff0c;该平台通过对真实网络设备的仿真模拟&#xff0c;帮助广大ICT从业者和客户快速熟悉华为数通系列产品&#xff0c;了解并掌握相关产品的操作和配置、提升对企业ICT网络的规划、建设、运维能力&#xff0c;从而帮助企业构建更高效&#xff0…