Cobbler部署与配置

Cobbler部署与配置

//关闭防火墙
[root@php ~]# systemctl disable --now firewalld.service 
[root@php ~]# sed -ri 's/^(SELINUX=).*/\1disabled/g' /etc/selinux/config
[root@php ~]# setenforce 0
setenforce: SELinux is disabled

//配置yum源
[root@php ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2595  100  2595    0     0  13657      0 --:--:-- --:--:-- --:--:-- 13657
[root@php ~]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

//配置epel源
[root@php ~]# yum -y install epel-release

//安装依赖包
[root@php ~]# dnf module enable cobbler
[root@php ~]# dnf -y install httpd dhcp-* tftp xinetd pykickstart cobbler cobbler-web rsync-daemon python3 tftp-server

//启动
[root@php ~]# systemctl enable --now httpd cobblerd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/cobblerd.service → /usr/lib/systemd/system/cobblerd.service.

//修改server的ip地址为本机ip
[root@php ~]# sed -i 's/^server: 127.0.0.1/server: 192.168.47.129/' /etc/cobbler/settings.yaml

//设置tftp的ip地址为本机ip
[root@php ~]# sed -i 's/^next_server: 127.0.0.1/next_server: 192.168.47.129/' /etc/cobbler/settings.yaml

//下载缺失文件
[root@php ~]# cobbler get-loaders
task started: 2021-10-13_024304_get_loaders
task started (id=Download Bootloader Content, time=Wed Oct 13 02:43:04 2021)
running python triggers from /var/lib/cobbler/triggers/task/get_loaders/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/get_loaders/pre/*
shell triggers finished successfully
downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***

//启动rsync并设置开机自启
[root@php ~]# systemctl enable --now rsyncd
Created symlink /etc/systemd/system/multi-user.target.wants/rsyncd.service → /usr/lib/systemd/system/rsyncd.service.

//生成加密的密码
[root@php ~]# openssl passwd -1 -salt "$RANDOM" '123456'
$1$5737$x7ovYIxKR02aelaEOFzI21     //加密后的密码

//将新生成的加密密码加入到配置文件
[root@php ~]# vim /etc/cobbler/settings.yaml 
....
default_password_crypted: "$1$5737$x7ovYIxKR02aelaEOFzI21"
....

//重启cobbler
[root@php ~]# systemctl restart cobblerd
[root@php ~]# ss -anlt
State            Recv-Q           Send-Q                     Local Address:Port                        Peer Address:Port           
LISTEN           0                5                                0.0.0.0:873                              0.0.0.0:*              
LISTEN           0                128                              0.0.0.0:111                              0.0.0.0:*              
LISTEN           0                128                              0.0.0.0:80                               0.0.0.0:*              
LISTEN           0                32                         192.168.122.1:53                               0.0.0.0:*              
LISTEN           0                128                              0.0.0.0:22                               0.0.0.0:*              
LISTEN           0                5                              127.0.0.1:631                              0.0.0.0:*              
LISTEN           0                128                              0.0.0.0:443                              0.0.0.0:*              
LISTEN           0                5                              127.0.0.1:25151                            0.0.0.0:*              
LISTEN           0                5                                   [::]:873                                 [::]:*              
LISTEN           0                80                                     *:3306                                   *:*              
LISTEN           0                128                                 [::]:111                                 [::]:*              
LISTEN           0                128                                 [::]:22                                  [::]:*              
LISTEN           0                5                                  [::1]:631                                 [::]:*     

//检查问题  出现四个
[root@php ~]# cobbler check
The following are potential configuration items that you may want to fix:

1: reposync is not installed, install yum-utils or dnf-plugins-core
2: yumdownloader is not installed, install yum-utils or dnf-plugins-core
3: debmirror package is not installed, it will be required to manage debian deployments and repositories
4: 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.
#以上3、4是关于debian系统的错误,请忽略

//12问题解决方案
[root@php ~]# wget -P /etc/yum.repos.d/ https://copr.fedoraproject.org/coprs/jkastner/dnf-plugins-core/repo/epel-7/jkastner-dnf-plugins-core-epel-7.repo && yum install dnf-plugins-core  

//再次查看   
[root@php ~]#  cobbler check
The following are potential configuration items that you may want to fix:

1: debmirror package is not installed, it will be required to manage debian deployments and repositories
2: 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.

//修改cobbler配置文件,让cobbler控制dhcp
[root@php ~]# sed -i 's/^manage_dhcp: false/manage_dhcp: true/g' /etc/cobbler/settings.yaml		#修改此处的值为true,表示让cobbler控制dhcp

//配置dhcp
[root@localhost ~]# vim /etc/cobbler/dhcp.template

subnet 192.168.47.0 netmask 255.255.255.0 {
     option routers             192.168.47.129;							#本地主机网段
     option domain-name-servers 114.114.114.114;						#本机IP
     option subnet-mask         255.255.255.0;							#子网掩码
     range dynamic-bootp        192.168.47.20 192.168.47.200;			#dhcp服务器分配的IP地址范围
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
     class "pxeclients" {


//重启服务并同步配置,改完dhcp必须要sync同步配置
[root@php ~]# systemctl restart cobblerd
[root@php ~]# cobbler sync
task started: 2021-10-13_032729_sync
task started (id=Sync, time=Wed Oct 13 03:27:29 2021)
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/www/cobbler/images/redhat-8-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/system
removing: /var/lib/tftpboot/grub/system_link
removing: /var/lib/tftpboot/grub/grub.cfg
removing: /var/lib/tftpboot/grub/local_efi.cfg
removing: /var/lib/tftpboot/grub/local_legacy.cfg
removing: /var/lib/tftpboot/grub/local_powerpc-ieee1275.cfg
removing: /var/lib/tftpboot/images/redhat-8-x86_64
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 files for distro: redhat-8-x86_64
trying hardlink /var/www/cobbler/distro_mirror/redhat-8-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/redhat-8-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/redhat-8-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/redhat-8-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: redhat-8-x86_64
trying hardlink /var/www/cobbler/distro_mirror/redhat-8-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/redhat-8-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/redhat-8-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/redhat-8-x86_64/initrd.img
Writing template files for redhat-8-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
processing boot_files for distro: redhat-8-x86_64
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 ***



//检查dhcp是否正常
[root@php ~]# ss -anulp| grep dhcp
UNCONN    0         0                   0.0.0.0:40348            0.0.0.0:*       users:(("dhcpd",pid=146845,fd=20))                                             
UNCONN    0         0                   0.0.0.0:67               0.0.0.0:*       users:(("dhcpd",pid=146845,fd=10))                                             
UNCONN    0         0                      [::]:52014               [::]:*       users:(("dhcpd",pid=146845,fd=21))                                             

//导入安装镜像
[root@php ~]# mount /dev/cdrom  /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.

#参数说明
		--path      //镜像路径
        --name      //为安装源定义一个名字
        --arch      //指定安装源平台
#安装源的唯一标示就是根据name参数来定义,本例导入成功后,安装源的唯一标示就是:redhat-8.2-x86_64,如果重复,系统会提示导入失败

热门文章

暂无图片
编程学习 ·

exe4j详细使用教程(附下载安装链接)

一、exe4j介绍 ​ exe4j是一个帮助你集成Java应用程序到Windows操作环境的java可执行文件生成工具,无论这些应用是用于服务器,还是图形用户界面(GUI)或命令行的应用程序。如果你想在任务管理器中及Windows XP分组的用户友好任务栏…
暂无图片
编程学习 ·

AUTOSAR从入门到精通100讲(126)-浅谈车载充电系统通信方案

01 引言 本文深入研究车载充电系统策略,设计出一套基于电动汽车电池管理系统与车载充电机的CAN通信协议,可供电动汽车设计人员参考借鉴。 02 电动汽车充电系统通讯网络 电动汽车整车控制系统中采用的是CAN总线通信方式,由一个整车内部高速CAN网络、内部低速CAN网络和一个充电…
暂无图片
编程学习 ·

CMake(九):生成器表达式

当运行CMake时,开发人员倾向于认为它是一个简单的步骤,需要读取项目的CMakeLists.txt文件,并生成相关的特定于生成器的项目文件集(例如Visual Studio解决方案和项目文件,Xcode项目,Unix Makefiles或Ninja输入文件)。然…
暂无图片
编程学习 ·

47.第十章 网络协议和管理配置 -- 网络配置(八)

4.3.3 route 命令 路由表管理命令 路由表主要构成: Destination: 目标网络ID,表示可以到达的目标网络ID,0.0.0.0/0 表示所有未知网络,又称为默认路由,优先级最低Genmask:目标网络对应的netmaskIface: 到达对应网络,应该从当前主机哪个网卡发送出来Gateway: 到达非直连的网络,…
暂无图片
编程学习 ·

元宇宙技术基础

请看图: 1、通过AR、VR等交互技术提升游戏的沉浸感 回顾游戏的发展历程,沉浸感的提升一直是技术突破的主要方向。从《愤怒的小鸟》到CSGO,游戏建模方式从2D到3D的提升使游戏中的物体呈现立体感。玩家在游戏中可以只有切换视角,进而提升沉浸…
暂无图片
编程学习 ·

flink的伪分布式搭建

一 flink的伪分布式搭建 1.1 执行架构图 1.Flink程序需要提交给 Job Client2.Job Client将作业提交给 Job Manager3.Job Manager负责协调资源分配和作业执行。 资源分配完成后,任务将提交给相应的 Task Manage。4.Task Manager启动一个线程以开始执行。Task Manage…
暂无图片
编程学习 ·

十进制正整数与二进制字符串的转换(C++)

Function one: //十进制数字转成二进制字符串 string Binary(int x) {string s "";while(x){if(x % 2 0) s 0 s;else s 1 s;x / 2;}return s; } Function two: //二进制字符串变为十进制数字 int Decimal(string s) {int num 0, …
暂无图片
编程学习 ·

[含lw+源码等]微信小程序校园辩论管理平台+后台管理系统[包运行成功]Java毕业设计计算机毕设

项目功能简介: 《微信小程序校园辩论管理平台后台管理系统》该项目含有源码、论文等资料、配套开发软件、软件安装教程、项目发布教程等 本系统包含微信小程序做的辩论管理前台和Java做的后台管理系统: 微信小程序——辩论管理前台涉及技术:WXML 和 WXS…
暂无图片
编程学习 ·

树莓派驱动DHT11温湿度传感器

1,直接使用python库 代码如下 import RPi.GPIO as GPIO import dht11 import time import datetimeGPIO.setwarnings(True) GPIO.setmode(GPIO.BCM)instance dht11.DHT11(pin14)try:while True:result instance.read()if result.is_valid():print(ok)print(&quo…
暂无图片
编程学习 ·

ELK简介

ELK简介 ELK是三个开源软件的缩写,Elasticsearch、Logstash、Kibana。它们都是开源软件。不过现在还新增了一个 Beats,它是一个轻量级的日志收集处理工具(Agent),Beats 占用资源少,适合于在各个服务器上搜集日志后传输给 Logstas…
暂无图片
编程学习 ·

Linux 基础

通常大数据框架都部署在 Linux 服务器上,所以需要具备一定的 Linux 知识。Linux 书籍当中比较著名的是 《鸟哥私房菜》系列,这个系列很全面也很经典。但如果你希望能够快速地入门,这里推荐《Linux 就该这么学》,其网站上有免费的电…
暂无图片
编程学习 ·

Windows2022 无线网卡装不上驱动

想来 Windows2022 和 windows10/11 的驱动应该差不多通用的,但是死活装不上呢? 搜一下,有人提到 “默认安装时‘无线LAN服务’是关闭的,如果需要开启,只需要在“添加角色和功能”中,选择开启“无线LAN服务…
暂无图片
编程学习 ·

【嵌入式面试宝典】版本控制工具Git常用命令总结

目录 创建仓库 查看信息 版本回退 版本检出 远程库 Git 创建仓库 git initgit add <file> 可反复多次使用&#xff0c;添加多个文件git commit -m <message> 查看信息 git status 仓库当前的状态git diff 差异对比git log 历史记录&#xff0c;提交日志--pret…
暂无图片
编程学习 ·

用Postman生成测试报告

newman newman是一款基于nodejs开发的可以运行postman脚本的工具&#xff0c;使用Newman&#xff0c;可以直接从命令运行和测试postman集合。 安装nodejs 下载地址&#xff1a;https://nodejs.org/en/download/ 选择自己系统相对应的版本内容进行下载&#xff0c;然后傻瓜式安…
暂无图片
编程学习 ·

Java面向对象之多态、向上转型和向下转型

文章目录前言一、多态二、引用类型之间的转换Ⅰ.向上转型Ⅱ.向下转型总结前言 今天继续Java面向对象的学习&#xff0c;学习面向对象的第三大特征&#xff1a;多态&#xff0c;了解多态的意义&#xff0c;以及两种引用类型之间的转换&#xff1a;向上转型、向下转型。  希望能…