cobbler的部署

cobbler部署

//配置yum源
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2495  100  2495    0     0  10800      0 --:--:-- --:--:-- --:--:-- 10800
[root@localhost ~]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# dnf clean all
[root@localhost ~]# dnf list all
[root@localhost ~]# dnf -y install epel-release

//安装cobbler以及相关的软件
[root@localhost ~]# yum module list | grep cobbler
cobbler              3               default [d]                              Versatile Linux deployment server
cobbler              3.3             default [d]                              Versatile Linux deployment server

[root@localhost ~]# dnf module enable cobbler:3 -y

[root@localhost ~]# dnf -y install httpd dhcp* tftp tftp-server cobbler cobbler-web pykickstart rsync rsync-daemon

//启动服务并设置开机自启
[root@localhost ~]# systemctl enable --now httpd
[root@localhost ~]# systemctl enable --now rsyncd
[root@localhost ~]# systemctl enable --now tftp
[root@localhost ~]# systemctl enable --now cobblerd

//关闭防火墙和selinux
[root@localhost ~]# systemctl disable --now firewalld.service
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.

Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

[root@localhost ~]# sed -ri '/^SELINUX=/s/(SELINUX=).*/\1disabled/g' /etc/selinux/config
//重启系统
[root@localhost ~]# reboot

//修改cobbler 主配置文件
[root@localhost ~]# vim /etc/cobbler/settings.yaml
server: 192.168.169.139         //改为服务器的IP地址
next_server: 192.168.169.139

//生成加密的密码
[root@localhost ~]# openssl passwd -1 -salt  "$RANDOM" "zzd123!"
$1$23$FmphinVlvQL8Lck6CsOIN.

[root@localhost ~]# vim /etc/cobbler/settings.yaml
default_password_crypted: "$1$23$FmphinVlvQL8Lck6CsOIN."    //刚才生成的密码

//将cobbler的dhcp功能打开
[root@localhost ~]# vim /etc/cobbler/settings.yaml
manage_dhcp: true

//解决cobbler check命令可能会报错的问题
[root@localhost ~]# dnf -y install syslinux* yum-utils
[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/cobbler/loaders/
[root@localhost ~]# cp /usr/share/syslinux/menu.c32  /var/lib/cobbler/loaders/

//重启cobbler
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# systemctl restart cobblerd.service

//通过cobbler check 核对当前设置是否有问题
[root@localhost ~]# 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, 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.

//第一个问题我们已经解决过了,第二第三个问题是在Debian系统上面需要注意的,解决办法是在Debian系统上面安装fence-agents,可以忽略

//配置DHCP模板文件
[root@localhost ~]# vim /etc/cobbler/dhcp.template
subnet 192.168.169.0 netmask 255.255.255.0 {
     option routers             192.168.169.2;
     option domain-name-servers 8.8.8.8;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.169.143 192.168.169.153;        //地址池,视情况而定
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;

//同步cobbler配置
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# systemctl restart cobblerd.service
[root@localhost ~]# cobbler sync
task started: 2022-09-23_170758_sync
task started (id=Sync, time=Fri Sep 23 17:07:58 2022)
running python triggers from /var/lib/cobbler/triggers/task/sync/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/sync/pre/*
shell triggers finished successfully
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/system
removing: /var/lib/tftpboot/grub/system_link
removing: /var/lib/tftpboot/grub/images
copying bootloaders
running: ['rsync', '-rpt', '--copy-links', '--exclude=.cobbler_postun_cleanup', '/var/lib/cobbler/loaders/', '/var/lib/tftpboot']
received on stdout:
received on stderr:
running: ['rsync', '-rpt', '--copy-links', '--exclude=README.grubconfig', '/var/lib/cobbler/grub_config/', '/var/lib/tftpboot']
received on stdout:
received on stderr:
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
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/*
shell triggers finished successfully
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running python trigger cobbler.modules.managers.genders
running shell triggers from /var/lib/cobbler/triggers/change/*
shell triggers finished successfully
*** TASK COMPLETE ***

管理distro
//挂载镜像
[root@localhost ~]# mount /dev/cdrom /mnt/
mount: /mnt: WARNING: device write-protected, mounted read-only.

//导入镜像
[root@localhost ~]# cobbler import --path=/mnt --name=zzd arch=x86_64  //--name可以自定义
task started: 2022-09-23_183222_import
task started (id=Media import, time=Fri Sep 23 18:32:22 2022)
running python triggers from /var/lib/cobbler/triggers/task/import/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/import/pre/*
shell triggers finished successfully
............

*** TASK COMPLETE ***

//查看cobbler镜像列表
[root@localhost ~]# cobbler list
distros:
   zzd-x86_64

profiles:
   zzd-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

//查看详细信息  查看指定的--name 接镜像名
[root@localhost ~]# cobbler distro report --name zzd-x86_64
Name                           : zzd-x86_64
Architecture                   : x86_64
Automatic Installation Template Metadata : {'tree': 'http://@@http_server@@/cblr/links/zzd-x86_64'}
TFTP Boot Files                : {}
Boot loader                    : grub
Breed                          : redhat
Comment                        :
Fetchable Files                : {}
Initrd                         : /var/www/cobbler/distro_mirror/zzd/images/pxeboot/initrd.img
Kernel                         : /var/www/cobbler/distro_mirror/zzd/images/pxeboot/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Management Classes             : []
OS Version                     : rhel8
Owners                         : ['admin']
Redhat Management Key          :
Remote Boot Initrd             : ~
Remote Boot Kernel             : ~
Template Files                 : {}

//创建kickstarts自动安装脚本
[root@localhost ~]# cobbler profile get-autoinstall --name zzd-x86_64  > /var/lib/cobbler/templates/centos8.ks  //存放位置可以自定义

//修改脚本文件
[root@localhost ~]# vim /var/lib/cobbler/templates/centos8.ks
firewall --disable      //关闭防火墙

%packages
@^minimal-environment //在这两行中间加上这一行,设置最小换安装
%end

//如果是在生产环境中,那么cobbler的部署已经完成了,但是在VMware虚拟机中还需要做如下操作
[root@localhost ~]# cd /usr/share/cobbler/bin/
[root@localhost bin]# ls
migrate-data-v2-to-v3.py  migrate-settings.sh  mkgrub.sh  settings-migration-v1-to-v2.sh
[root@localhost bin]# bash mkgrub.sh
[root@localhost bin]# cd /var/lib/cobbler/loaders/
[root@localhost loaders]# ls
grub  ldlinux.c32  menu.c32  pxelinux.0
[root@localhost loaders]# cobbler sync
[root@localhost loaders]# systemctl restart httpd cobblerd rsyncd dhcpd

手动安装

创建一个虚拟机,然后打开虚拟机,等待dhcp分配完毕,选择想要使用的镜像

cobbler的部署

密码就是上面执行命令所用的密码

cobbler的部署

自动安装

通过web管理界面进行自动安装,先新建一个虚拟机

在浏览器输入:https:// + ip地址/cobbler_web

用户名和密码都为:cobbler

cobbler的部署

cobbler的部署

cobbler的部署

cobbler的部署

将生成出来的mac地址复制保存下来点击左上角的save保存

cobbler的部署

同步,右上角有同步日志

cobbler的部署

这里也可以查看日志

cobbler的部署

将刚才保存下来的Mac地址复制到即将安装的虚拟机上

cobbler的部署

cobbler的部署

打开虚拟机,进行安装,等待安装完成后,进行验证

cobbler的部署

Original: https://www.cnblogs.com/zicnotes/p/16727675.html
Author: Zic师傅
Title: cobbler的部署

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/606500/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • VBA中Selection.TypeText长度限制的替代写法

    | 0.06分钟 | 100字符 | 1、引言&背景 2、解决方案 3、声明与参考资料 | SCscHero | 2022/6/5 AM11:34 | 系列 | 已完成 每…

    Linux 2023年6月14日
    088
  • final关键字

    1-1 编译期常量 定义:带有 ①编译时数值(区别于运行时数值)的 ②final ③ 基本数据类型的量。 注意: 既是static又是final的量不一定是编译期常量; publi…

    Linux 2023年6月8日
    069
  • 根据温度、气压计算海拔高度

    基本概念 标准大气压:表示气压的单位,习惯上常用水银柱高度。例如,一个标准大气压等于760毫米高的水银柱的重量,它相当于一平方厘米面积上承受1.0336公斤重的大气压力。由于各国所…

    Linux 2023年6月8日
    086
  • 【计算机取证篇】镜像挂载利器-Arsenal Image Mounter

    Arsenal Image Mounter是一款非常优秀的磁盘挂载工具,在Microsoft Windows中可以将磁盘映像的内容作为”真实磁盘”挂载到系统…

    Linux 2023年6月13日
    0109
  • 银河麒麟KYLIN安装wireshark进行抓包

    银河麒麟KYLIN安装wireshark进行抓包(前提是网络连通):sudo apt-get updatesudo apt-get install wireshark -y弹出框选…

    Linux 2023年6月13日
    0109
  • Hystrix 源码解读

    转载请注明出处: 1.引入依赖: 2. 查看自动配置类HystrixCircuitBreakerConfiguration 查看 org.springframework.cloud…

    Linux 2023年6月14日
    086
  • JAVA中如何将以Date型的数据保存到数据库以Datetime型的字段中

    用Timestamp就行了 recordOuttime是Date类型 import java.sql.Timestamp; Record record = recordMapper…

    Linux 2023年6月8日
    068
  • Mybatis源码解读-SpringBoot中配置加载和Mapper的生成

    本文 mybatis-spring-boot探讨在springboot工程中mybatis相关对象的注册与加载。 建议先了解mybatis在spring中的使用和springboo…

    Linux 2023年6月7日
    098
  • 操作系统实战45讲笔记-01 程序的运行过程:从代码到机器运行

    计算机硬件是无法直接运行C 语言文本程序代码的,需要 C 语言编译器,把这个代码编译成具体硬件平台的二进制代码。再由具体操作系统建立进程,把这个二进制文件装进其进程的内存空间中,才…

    Linux 2023年6月7日
    076
  • 软件工程 结构法方法 第2篇随笔

    建立系统的功能模型图 首先:建立系统环境图,确定系统边界 其中: 数据流为:销售的商品,日销售额等;三个输入流,三个输出流 ​ 数据源为:营业员,经理,收款员 ​ 数据潭为:经理,…

    Linux 2023年6月7日
    092
  • 后端编写Swagger接口管理文档

    在后端开发当中,编写好多个接口后需要通过注解编写相应的接口文档提供给前端调用接口实现前后端分离。 Swagger接口管理文档 访问接口文档的网页:http://localhost:…

    Linux 2023年6月7日
    078
  • Linux ARMv7架构通用中断流程(1)【转】

    一、ARMv7 Cortex-A系列处理器寄存器组介绍及其功能介绍 1. ARMv7 Cortex-A处理器一般共有37寄存器,其中包括: (1) 31个通用寄存器,包括PC(程序…

    Linux 2023年6月8日
    071
  • 带你了解我们的“彩虹运维技术栈社区”

    关于我们 彩虹象征着美好、童话、幻想,所要追求的成功,必历经挫折之后才能达到目标。我们每个人都需经历学习的枯燥、工作和生活的辛苦,不经历风雨又怎能见彩虹? TTR,全称Taste …

    Linux 2023年6月7日
    077
  • python入门基础知识六(函数)

    函数要先定义,再调用! 一、函数参数的类型: 1. 形式参数和实际参数: def funct_name(arguments): codes… codes… …

    Linux 2023年6月7日
    077
  • UWP 自定义密码框控件

    1. 概述 微软官方有提供自己的密码控件,但是控件默认的行为是输入密码,会立即显示掩码,比如 *。如果像查看真实的文本,需要按查看按钮。 而我现在自定义的密码控件是先显示你输入的字…

    Linux 2023年6月13日
    078
  • Redis配置参数详解

    Redis是一个应用非常广泛的高性能Key-Value型数据库,与memcached类似,但功能更加强大!本文将按照不同功能模块的方式,依次对各个功能模块的配置参数进行详细介绍。 …

    Linux 2023年5月28日
    074
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球