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)

大家都在看

  • Redis主从配置总结

    grep ‘^[a-Z]’ /usr/local/redis/conf/redis.conf bind 127.0.0.1 192.168.27.115 protected-mod…

    Linux 2023年5月28日
    097
  • elasticsearch集群部署

    Elasticsearch 是一个分布式的 RESTful 风格的搜索和数据分析引擎,能够解决不断涌现出的各种用例。作为 Elastic Stack 的核心,它集中存储您的数据,帮…

    Linux 2023年6月7日
    085
  • SQL45 将titles_test表名修改为titles_2017

    本题链接本题省略表结构。需要用到RENAME TABLE子句,该子句可实现一或多个表名称的修改。子句语法为: RENAME TABLE tbl_name TO new_tbl_na…

    Linux 2023年6月13日
    088
  • muduo源码分析之Buffer

    这一次我们来分析下 muduo中 Buffer的作用,我们知道,当我们客户端向服务器发送数据时候,服务器就会读取我们发送的数据,然后进行一系列处理,然后再发送到其他地方,在这里我们…

    Linux 2023年6月13日
    095
  • 简单易用的任务队列-beanstalkd

    概述 beanstalkd 是一个简单快速的分布式工作队列系统,协议基于 ASCII 编码运行在 TCP 上。其最初设计的目的是通过后台异步执行耗时任务的方式降低高容量 Web 应…

    Linux 2023年6月7日
    0102
  • OpenSSL测试-大数

    任务详情 在openEuler(推荐)或Ubuntu或Windows(不推荐)中完成下面任务 基于OpenSSL的大数库计算2的N次方,N为你学号的后四位(5’) 基于…

    Linux 2023年6月8日
    097
  • kubeadm 加入新master 报错

    error execution phase check-etcd: error syncing endpoints with etcd: context deadline exce…

    Linux 2023年6月14日
    0125
  • 【河北科技大学数据结构课设】校园导航问题

    文档到我的资源下载 点击这里进入我的资源下载 1. 简单介绍 2. 代码 #include #include #include using namespace std; /*测试使…

    Linux 2023年6月8日
    0117
  • 甲骨文严查Java授权,换openJDK要避坑

    背景 外媒The Register报道,甲骨文稽查企业用户,近期开始将把过去看管较松散的Java授权加入。 甲骨文针对标准版Java(Java SE)有2种商业授权。2019年4月…

    Linux 2023年6月14日
    096
  • 【总结】瞬时高并发(秒杀/活动)Redis方案

    1,Redis 丰富的数据结构(Data Structures) * 字符串(String) – Redis字符串能包含 任意类型的数据 一个字符串类型的值最多能存储 …

    Linux 2023年5月28日
    085
  • jmeter之数据库连接JDBC安装与使用

    jmeter中如果要用sql语句查询数据库,就需要用到JDBC请求和JDBC Connection Configuration了。 首先来了解下,JDBC是什么?英文全称为Java…

    Linux 2023年6月8日
    0120
  • 数据结构 栈与队列

    cpp;gutter:true;</p> <h1>include</h1> <h1>include</h1> <h…

    Linux 2023年6月13日
    088
  • Go实现安全双检锁的方法和最佳实践

    不安全的双检锁 从其他语言转入Go语言的同学经常会陷入一个思考:如何创建一个单例? 有些同学可能会把其它语言中的双检锁模式移植过来,双检锁模式也称为懒汉模式,首次用到的时候才创建实…

    Linux 2023年6月13日
    094
  • 一文带你掌握Spring Web异常处理方式

    一、前言 最近从单位离职了,离开了五年多来朝朝夕夕皆灯火辉煌的某网,激情也好悲凉也罢,觥筹场上屡屡物是人非,调转过事业部以为能换种情绪,岂料和下了周五的班的前同事兼好朋友,匆匆赶往…

    Linux 2023年6月6日
    096
  • 用python去除SQL中的注释

    我的博客在看到这个标题时候肯定有人会想,我写SQL直接在数据库工具上执行就行了啊,工具会自动识别注释的,就是不用工具,把SQL写到存储过程里,数据库也会识别注释不执行的,干嘛非要去…

    Linux 2023年6月6日
    097
  • 09_Linux基础-SHELL-标准输入与标准输出-重定向-管道

    09_Linux基础-SHELL-标准输入与标准输出-重定向-管道 博客🔗:https://blog.csdn.net/cpen_web &#x4F5C;&#x4E…

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