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)

大家都在看

  • 手把手教你设置MongoDB密码

    mongodb密码和传统数据如mysql等有些区别: mongodb的用户名和密码是基于特定数据库的,而不是基于整个系统的。所有所有数据库db都需要设置密码。 1. 查看所有数据库…

    Linux 2023年6月14日
    0103
  • shell脚本echo打印错位

    问题描述 在脚本中使用curl命令请求Jenkins的API获取job的编号,随后将编号和其他字符串拼接后,使用echo命令打印出来,但打印后字符串错位了。 脚本大致如下: num…

    Linux 2023年6月8日
    0118
  • 在VS code使用Remote-SSH远程连接Linux 开发C++ 配置详细介绍

    VS code 远程连接服务器,编译C++ 一、前期准备 1、VS code安装 Remote-SSH插件 2、Windows安装SSH。 3、Linux服务器连接测试。 a.接通…

    Linux 2023年5月27日
    0150
  • “XZ”格式文件解压

    1、下载xz 官网:https://tukaani.org/xz/ 例:wget https://nchc.dl.sourceforge.net/project/lzmautils…

    Linux 2023年6月6日
    0106
  • 自动化服务器巡检的实现过程

    由于上级的工作安排,从今年5月开始,每天都要做一些服务器信息检查。 [En] Due to the work arrangement of the superior, it is …

    Linux 2023年5月27日
    094
  • 4.3 Linux压缩文件或目录为.zip格式(zip命令)

    我们经常会在 Windows 系统上使用 “.zip”格式压缩文件,其实”.zip”格式文件是 Windows 和 Linux 系统…

    Linux 2023年6月7日
    0105
  • docker相关命令杂理

    – 2020.11.16docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] #保存现有的镜像 # docker commit …

    Linux 2023年6月8日
    091
  • cgroup-v1在android中的应用实现浅析

    本文档内容主要是分析android设备中cgroup v1实现了哪些控制器,他们有哪些子控制器以及如何配置这些控制器的。 我是使用红米Note4Plus的开发版本来调研分析的,手机…

    Linux 2023年6月7日
    0111
  • iptables快速入门

    iptables简介 在生产实践过程中,为了保证生产安全,通常需要进行数据加密,例如通过网络层面上将应用隔离成内网和公网应用,内网再分成生产、测试、开发、DMZ等区域,然后进行不同…

    Linux 2023年6月6日
    0100
  • python_距离测量

    之所以写这个,其实就是希望能对距离有一些概念,当然这个也是很基础的,不过千里之行始于足下嘛,各种路径算法,比如a*什么的都会用到这个 距离测量有三种方式 1、欧式距离,这个是最常用…

    Linux 2023年6月6日
    092
  • 大数据——配置并启动集群/开启历史服务器和日志聚集

    上篇文章通过克隆将集群搭建出来,这篇文章对Hadoop进行配置,修改配置文件,启动并测试集群。开去历史服务器以及日志聚集。 部署规划 hadoop102 hadoop103 had…

    Linux 2023年6月8日
    098
  • 关于最近公司一个业务系统的性能优化方案

    一个刚上线的IT系统,往往负载压力不大,所以不会存在什么性能问题。这时,人们大多只关心系统的功能性和用户体验。但是,随着时间推移,用户量和数据量都比刚上线的时候要多很多,高并发和大…

    Linux 2023年6月6日
    0102
  • Golang 实现 Redis(5): 使用跳表实现 SortedSet

    本文是使用 golang 实现 redis 系列的第五篇, 将介绍如何使用跳表实现有序集合(SortedSet)的相关功能。 跳表(skiplist) 是 Redis 中 Sort…

    Linux 2023年5月28日
    096
  • USB转双串口产品设计-TTL串口

    基于USB转2路串口芯片CH342,可以为各类主机扩展出2个独立的串口。CH342芯片支持使用操作系统内置的CDC串口驱动,也支持使用厂商提供的VCP串口驱动程序,可支持Windo…

    Linux 2023年6月7日
    0103
  • 事务与事务隔离级别详解

    事务基本概念 一组要么同时执行成功,要么同时执行失败的SQL 语句。是数据库操作的一个执行单元。 事务开始于: 连接到数据库上,并执行一条DML 语句in sert 、update…

    Linux 2023年6月14日
    0100
  • 2020年12月-第02阶段-前端基础-CSS Day06

    CSS Day06 定位(position) *理解 能说出为什么要用定位能说出定位的4种分类能说出四种定位的各自特点能说出我们为什么常用子绝父相布局 *应用 能写出淘宝轮播图布局…

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