cobbler自动批量安装多版本操作系统

本次虚拟化环境为VMware Workstation Pro,cobbler服务端为CentOS7.9,需要自动安装的版本为CentOS7.9和CentOS8.1

目录

  • 一、安装cobbler服务端
    • 1、修改YUM源
    • 2、关闭防火墙
    • 3、安装软件包
    • 4、cobbler环境配置
    • 5、解决语法问题
    • 6、启动服务
    • 7、导入镜像
    • 8、自定义ks文件
    • 9、修改启动菜单
    • 10、自动安装操作系统
  • 二、配置多版本自动安装系统
    • 1、导入镜像
    • 2、自定义ks文件
    • 3、修改启动菜单
    • 4、自动安装操作系统

一、安装cobbler服务端

1、修改YUM源

如果是内网服务器,有本地YUM源

cd /etc/yum.repos.d/
mkdir ./repobak
mv ./*.repo ./repobak/

上传repo文件

yum clean all
yum makecache
yum repolist

如果有外网环境直接下载公网源

cd /etc/yum.repos.d/
mkdir ./repobak
mv ./*.repo ./repobak/
curl -O https://mirrors.aliyun.com/repo/Centos-7.repo
curl -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

2、关闭防火墙

关闭防火墙,selinux

systemctl stop firewalld.service
systemctl disable firewalld.service
vim /etc/selinux/config

在这里插入图片描述

3、安装软件包

yum install -y httpd dhcp xinetd tftp-server cobbler cobbler-web
cobbler语法检查前先启动http与cobbler
systemctl start httpd.service
systemctl start cobblerd.service

4、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 re          achable 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 packag          e 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

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

5、解决语法问题

第1、2条

vim /etc/cobbler/settings
manage_dhcp: 1	
next_server: 192.168.241.128
server: 192.168.241.128
manage_rsync: 1
pxe_just_once: 1

第3条

vim /etc/xinetd.d/tftp
wait                    = no
disable                 = no

第4条
/var/lib/cobbler/loaders 中缺少一些网络引导加载器。如果只想处理 x86/x86_64 网络引导,则可以确保已安装 syslinux 包的最新版本,并且可以完全忽略此消息。如果想要支持所有体系结构,此目录中的文件应包括 pxelinux.0、menu.c32、elilo.efi 和 yaboot。

yum -y install syslinux

安装syslinux,不需要支持所有架构,便不用理会该警告

第5条

systemctl start rsyncd
systemctl enable rsyncd

第6条

yum  install  -y  pykickstart  debmirror
vi /etc/debmirror.conf  #注释掉 @dists 和 @arches 两行
#@dists="sid";
#@arches="i386";

第7条

 openssl passwd -1 -salt 'cobbler' '123456'

得到
1 1 1cobbler$sqDDOBeLKJVmxTCZr52/11

vim /etc/cobbler/settings
default_password_crypted: "$1$cobbler$sqDDOBeLKJVmxTCZr52/11"

cp /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.bak
vim /etc/cobbler/dhcp.template

在这里插入图片描述

systemctl restart cobblerd.service
cobbler sync
cobbler check

在这里插入图片描述

6、启动服务

systemctl status httpd dhcpd rsyncd tftp cobblerd
systemctl start httpd dhcpd rsyncd tftp cobblerd
systemctl enable httpd dhcpd rsyncd tftp cobblerd

7、导入镜像

导入镜像到cobbler服务端中
上传镜像,挂载镜像

mkdir /mnt/centos7.9
mount CentOS-7.9-x86_64-Everything-2207-02.iso  /mnt/centos7.9
cobbler import --path=/mnt/centos7.9 --name=CentOS-7.9-x86_64-Everything-2207-02 --arch=x86_64

在这里插入图片描述

8、自定义ks文件

cd /var/lib/cobbler/kickstarts/
ll
vim centos7u9.ks

以服务器版为例

#Kickstart Configurator for cobbler by KE HUIWEN
#platform=x86, AMD64, or Intel EM64T
#System  language
lang en_US
#System keyboard
keyboard us
#Sytem timezone
timezone Asia/Shanghai
#Root password
rootpw --iscrypted $default_password_crypted
#Use text mode install
text
#Install OS instead of upgrade
install
#Use NFS installation Media
url --url=$tree
#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
part swap --fstype="swap" --size 4096 --ondisk sda
part / --fstype xfs --size 1 --grow --ondisk sda
#System authorization infomation
auth  --useshadow  --enablemd5
#Network information
$SNIPPET('network_config')
# network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Firewall configuration
firewall --disabled
#SELinux configuration
selinux --disabled
#Do not configure XWindows
skipx
#Package install information
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end

%packages
@^infrastructure-server-environment
@base
@compat-libraries
@core
@debugging
@development
@directory-client
@guest-agents
@ha
@hardware-monitoring
@infiniband
@java-platform
@large-systems
@load-balancer
@network-file-system-client
@performance
@remote-system-management
@resilient-storage
@security-tools
@smart-card
@system-admin-tools
@virtualization-hypervisor
kexec-tools
%end
  
%post
systemctl disable postfix.service
%end

#指定启动文件,要手写,不要复制

cobbler profile edit --name "CentOS-7.9-Everything-2207-02-x86_64"  --kickstart=/var/lib/cobbler/kickstarts/centos7u9.ks

#修改centos配置文件中的kickstart值

cobbler profile edit --name=CentOS-7.9-Everything-2207-02-x86_64 --kopts='net.ifnames=0 biosdevname=0'
cobbler sync   #执行rsync同步,同步成功

查看kickstart 关联是否成功,注意是否修改成功

cobbler profile report

在这里插入图片描述

9、修改启动菜单

cobbler system add  --name=default --profile=CentOS-7.9-Everything-2207-02-x86_64
cobbler  system list
cobbler sync 

在这里插入图片描述

cat /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.io/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT CentOS-7.9-Everything-2207-02-x86_64

LABEL local
        MENU LABEL (local)
        MENU DEFAULT
        LOCALBOOT -1

LABEL CentOS-7.9-Everything-2207-02-x86_64
        kernel /images/CentOS-7.9-Everything-2207-02-x86_64/vmlinuz
        MENU LABEL CentOS-7.9-Everything-2207-02-x86_64
        append initrd=/images/CentOS-7.9-Everything-2207-02-x86_64/initrd.img ksdevice=bootif lang=  text net.ifnames=0 biosdevname=0 kssendmac  ks=http://10.49.33.206/cblr/svc/op/ks/profile/CentOS-7.9-Everything-2207-02-x86_64
        ipappend 2

MENU end

10、自动安装操作系统

新建虚拟机,安装客户机操作系统界面时选择稍后安装操作系统
在这里插入图片描述
开启虚拟机,选择镜像安装
在这里插入图片描述
等待安装完成

二、配置多版本自动安装系统

1、导入镜像

上传镜像,挂载镜像

mkdir /mnt/centos8.1
mount CentOS-8.1.1911-x86_64-dvd1.iso  /mnt/centos8.1 
cobbler import --path=/mnt/centos8.1 --name=CentOS-8.1.1911-x86_64-dvd1 --arch=x86_64

在这里插入图片描述

2、自定义ks文件

cd /var/lib/cobbler/kickstarts/
ll
 vim centos8u1.ks

#安装服务器版centos
注意安装包会有所不同

#Kickstart Configurator for cobbler by KE HUIWEN
#platform=x86, AMD64, or Intel EM64T
#System  language
lang en_US
#System keyboard
keyboard us
#Sytem timezone
timezone Asia/Shanghai
#Root password
rootpw --iscrypted $default_password_crypted
#Use text mode install
text
#Install OS instead of upgrade
install
#Use NFS installation Media
url --url=$tree
#System bootloader configuration
bootloader --location=mbr --boot-drive=sda
#Clear the Master Boot Record
zerombr
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part /boot --fstype xfs --size 1024 --ondisk sda
part swap --fstype="swap" --size 4096 --ondisk sda
part / --fstype xfs --size 1 --grow --ondisk sda
#System authorization infomation
auth  --useshadow  --enablemd5
#Network information
$SNIPPET('network_config')
# network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Firewall configuration
firewall --disabled
#SELinux configuration
selinux --disabled
#Do not configure XWindows
skipx
#Package install information
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end

%packages
@base
@core
@desktop-debugging
@dial-up
@fonts
@gnome-desktop
@guest-desktop-agents
@input-methods
@internet-browser
@java-platform
@multimedia
@network-file-system-client
@print-client
binutils
ftp
gcc
kernel-devel
kexec-tools
make
mesa-libxatracker
open-vm-tools
patch
xorg-x11-drv-vmware
%end
  
%post
systemctl disable postfix.service
%end

#指定启动文件,要手写,不要复制

cobbler profile edit --name "CentOS-8.1.1911-dvd1-x86_64" --kickstart=/var/lib/cobbler/kickstarts/centos8u1.ks

#修改centos配置文件中的kickstart值

cobbler profile edit --name=CentOS-8.1.1911-dvd1-x86_64 --kopts='net.ifnames=0 biosdevname=0'
cobbler sync   #执行rsync同步,同步成功

查看kickstart 关联是否成功,注意是否修改成功

cobbler profile report

在这里插入图片描述

3、修改启动菜单

cobbler system add  --name=centos8u1 --profile=CentOS-8.1.1911-dvd1-x86_64
cobbler  system list
cobbler sync 

在这里插入图片描述

cat /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.io/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT CentOS-7.9-Everything-2207-02-x86_64

LABEL local
        MENU LABEL (local)
        MENU DEFAULT
        LOCALBOOT -1

LABEL CentOS-7.9-Everything-2207-02-x86_64
        kernel /images/CentOS-7.9-Everything-2207-02-x86_64/vmlinuz
        MENU LABEL CentOS-7.9-Everything-2207-02-x86_64
        append initrd=/images/CentOS-7.9-Everything-2207-02-x86_64/initrd.img ksdevice=bootif lang=  text net.ifnames=0 biosdevname=0 kssendmac  ks=http://192.168.241.128/cblr/svc/op/ks/profile/CentOS-7.9-Everything-2207-02-x86_64
        ipappend 2

LABEL CentOS-8.1.1911-dvd1-x86_64
        kernel /images/CentOS-8.1.1911-dvd1-x86_64/vmlinuz
        MENU LABEL CentOS-8.1.1911-dvd1-x86_64
        append initrd=/images/CentOS-8.1.1911-dvd1-x86_64/initrd.img ksdevice=bootif lang=  text net.ifnames=0 biosdevname=0 kssendmac  ks=http://192.168.241.128/cblr/svc/op/ks/profile/CentOS-8.1.1911-dvd1-x86_64
        ipappend 2



MENU end

4、自动安装操作系统

新建虚拟机,操作如上1.10,选择CentOS-8.1
在这里插入图片描述
等待自动安装在这里插入图片描述
安装完成
在这里插入图片描述

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

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

相关文章

Spring自定义参数解析器

在这篇文章中,我们认识了参数解析器和消息转换器,今天我们来自定义一个参数解析器。 自定义参数解析器 实现HandlerMethodArgumentResolver的类,并注册到Spring容器。 Component//注册到Spring public class UserAr…

统信服务器操作系统【Cron定时任务服务】

Cron定时任务服务服务介绍、服务管理、服务配置 文章目录 一、功能概述二、功能介绍1. Cron 服务管理2.Cron 服务管理3.Cron 服务配置run-parts一、功能概述 cron是一个可以用来根据时间、日期、月份、星期的组合来 调度对周期性任务执行的守护进程。利用 cron 所提供的功能,可…

第十四届蓝桥杯嵌入式国赛

一. 前言 本篇博客主要讲述十四届蓝桥杯嵌入式的国赛题目,包括STM32CubeMx的相关配置以及相关功能实现代码以及我在做题过程中所遇到的一些问题和总结收获。如果有兴趣的伙伴还可以去做做其它届的真题,可去 蓝桥云课 上搜索历届真题即可。 二. 题目概述 …

七种修复错误:由于找不到msvcr110.dll 无法继续执行的方法

当你在运行某些程序时遇到“找不到msvcr110.dll”的错误提示,这通常意味着你的系统缺少了Microsoft Visual C 2012 Redistributable包中的一个重要文件。这个DLL文件是Microsoft Visual C Redistributable的一部分,用于支持许多使用Visual C编写的软件和…

Elasticsearch:检索增强生成背后的重要思想

作者:来自 Elastic Jessica L. Moszkowicz 星期天晚上 10 点,我九年级的女儿哭着冲进我的房间。她说她对代数一无所知,注定要失败。我进入超级妈妈模式,却发现我一点高中数学知识都不记得了。于是,我做了任何一位超级妈…

多颜色绘制语义分割/变化检测结果图

在论文绘图时,传统的二元语义分割结果图颜色单一(下图左),所以论文中常根据混淆矩阵类别使用多颜色进行绘制(下图右),可以看到,结果的可视化效果更好。 以下是绘制代码: …

Windows系统的Tomcat日志路径配置

文章目录 引言I Windows系统的Tomcat日志路径配置配置常规日志路径访问日志路径配置,修改server.xmlII 日志文件切割:以分隔割tomcat 的 catalina.out 文件为例子通过Linux系统自带的切割工具logrotate来进行切割引言 需求:C盘空间不足,处理日志文件,tomcat日志迁移到D盘…

Java基础知识扫盲

目录 Arrays.sort的底层实现 BigDecimal(double)和BigDecimal(String)有什么区别 Char可以存储一个汉字吗 Java中的Timer定时调度任务是咋实现的 Java中的序列化机制是咋实现的 Java中的注解是干嘛的 Arrays.sort的底层实现 Arrays.sort是Java中提供的对数组进行排序的…

信用卡存量经营读书笔记

信用卡的各项收益和损失分析表 用杜邦分析法拆利润如下 信用卡要不要烧钱?不要,因为没有网络效应(用户量增加带来的优惠比较少)和赢家通吃的情况 线上获客的几种方式:引流分成、某个项目的联名信用卡、营业收入分成 …

爬虫到底难在哪里?

如果你是自己做爬虫脚本开发,那确实难,因为你需要掌握Python、HTML、JS、xpath、database等技术,而且还要处理反爬、动态网页、逆向等情况,不然压根不知道怎么去写代码,这些技术和经验储备起码得要个三五年。 比如这几…

【D3.js in Action 3 精译_023】3.3 使用 D3 将数据绑定到 DOM 元素

当前内容所在位置: 第一部分 D3.js 基础知识 第一章 D3.js 简介(已完结) 1.1 何为 D3.js?1.2 D3 生态系统——入门须知1.3 数据可视化最佳实践(上)1.3 数据可视化最佳实践(下)1.4 本…

【开源免费】基于SpringBoot+Vue.JS教师工作量管理系统(JAVA毕业设计)

本文项目编号 T 043 ,文末自助获取源码 \color{red}{T043,文末自助获取源码} T043,文末自助获取源码 目录 一、系统介绍二、演示录屏三、启动教程四、功能截图五、文案资料5.1 选题背景5.2 国内外研究现状5.3 可行性分析 六、核心代码6.1 查…

两数之和、三数之和、四数之和

目录 两数之和 题目链接 题目描述 思路分析 代码实现 三数之和 题目链接 题目描述 思路分析 代码实现 四数之和 题目链接 题目描述 思路分析 代码实现 两数之和 题目链接 LCR 179. 查找总价格为目标值的两个商品 - 力扣(LeetCode) 题目…

算法:69.x的平方根

题目 链接:leetcode链接 思路分析(二分算法) 当然你可以使用暴力查找,但是二分算法的时间复杂度更好。 我们先用暴力查找找点灵感 x :1 2 3 4 5 6 7 8 x2:1 4 9 16 25 36 49 64 我们的目的是找到一个x…

《程序猿之设计模式实战 · 适配器模式》

📢 大家好,我是 【战神刘玉栋】,有10多年的研发经验,致力于前后端技术栈的知识沉淀和传播。 💗 🌻 CSDN入驻不久,希望大家多多支持,后续会继续提升文章质量,绝不滥竽充数…

【数据结构初阶】链式二叉树接口实现超详解

文章目录 1. 节点定义2. 前中后序遍历2. 1 遍历规则2. 2 遍历实现2. 3 结点个数2. 3. 1 二叉树节点个数2. 3. 2 二叉树叶子节点个数2. 3. 3 二叉树第k层节点个数 2. 4 二叉树查找值为x的节点2. 5 二叉树层序遍历2. 6 判断二叉树是否是完全二叉树 3. 二叉树性质 1. 节点定义 用…

推荐一款开源的Redis桌面客户端

TinyRDM 是一个现代化的、轻量级的跨平台 Redis 桌面客户端,能在 Mac、Windows 和 Linux 系统上使用。它有着现代化的设计风格,界面既简洁又清晰,操作起来方便又高效。不管是刚开始接触的新手,还是经验丰富的开发者,都…

软考(9.22)

1 在浏览器的地址栏中输入xxxyftp.abc.can.cn,在该URL中( )是要访问的主机名。 A.xxxyftp B.abc C.can D.cn 协议://主机名.域名.域名后缀或IP地址(:端口号)/目录/文件名。 本题xxxyftp是主机名,选择A选项。 2 假设磁盘块与缓冲区大小相同,…

WPF 的TreeView的TreeViewItem下动态生成TreeViewItem

树形结构仅部分需要动态生成TreeViewItem的可以参考本文。 xaml页面 <TreeView MinWidth"220" ><TreeViewItem Header"功能列表" ItemsSource"{Binding Functions}"><TreeViewItem.ItemTemplate><HierarchicalDataTempla…

一.python入门

gyp的读研日记&#xff0c;哈哈哈哈&#xff0c;&#x1f642;&#xff0c;从复习python开始&#xff0c; 目录 1.python入门 1.1 Python说明书 1.2 Python具备的功能 1.3 学习前提 1.4 何为Python 1.5 编程语言 2.Python环境搭建 2.1 开发环境概述 2.2 Python的安装与…