当前位置: 首页 > news >正文

cobbler

cobbler

一、cobbler简介
Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等
Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用
Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理
Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack
puppet是一种Linux、Unix、windows平台的集中配置管理系统,使用自有的puppet描述语言,可管理配置文件、用户、cron任务、软件包、系统服务等puppet把这些系统实体称之为资源,puppet的设计目标是简化对这些资源的管理以及妥善处理资源间的依赖关系
puppet采用C/S星状的结构,所有的客户端和一个或几个服务器交互。每个客户端周期的(默认半个小时)向服务器发送请求,获得其最新的配置信息,保证和该配置信息同步。每个puppet客户端每半小时(可以设置)连接一次服务器端, 下载最新的配置文件,并且严格按照配置文件来配置客户端. 配置完成以后,puppet客户端可以反馈给服务器端一个消息. 如果出错,也会给服务器端反馈一个消息

关闭防火墙和selinux略

配置yum仓库略

实验(安装cobbler以及相关的软件):

[root@syf ~]# yum -y install epel-release
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* epel: ftp-stud.hs-esslingen.de* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be updated
---> Package epel-release.noarch 0:7-14 will be an update
--> Finished Dependency ResolutionDependencies Resolved====================================================================Package             Arch          Version        Repository   Size
====================================================================
Updating:epel-release        noarch        7-14           epel         15 kTransaction Summary
====================================================================
Upgrade  1 PackageTotal download size: 15 k
Downloading packages:
epel/x86_64/prestodelta                        |  592 B   00:01     
epel-release-7-14.noarch.rpm   FAILED                                          
https://ftp-stud.hs-esslingen.de/pub/Mirrors/archive.fedoraproject.org/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm: [Errno 14] curl#7 - "Failed to connect to 2001:7c0:700::10: Network is unreachable"
Trying other mirror.
epel-release-7-14.noarch.rpm                   |  15 kB   00:02     
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionUpdating   : epel-release-7-14.noarch                         1/2 Cleanup    : epel-release-7-11.noarch                         2/2 Verifying  : epel-release-7-14.noarch                         1/2 Verifying  : epel-release-7-11.noarch                         2/2 Updated:epel-release.noarch 0:7-14                                        Complete!
[root@syf ~]# yum -y install httpd dhcp* tftp tftp-server cobbler cobbler-web pykickstart rsync rsync-daemon
......
[root@syf ~]# systemctl restart httpd;systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@syf ~]# systemctl restart rsyncd;systemctl enable rsyncd
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.
[root@syf ~]# systemctl restart tftp;systemctl enable tftp
Created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.
[root@syf ~]# systemctl restart cobblerd;systemctl enable cobblerd
Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.
[root@syf ~]# cd /etc/cobbler/
[root@syf cobbler]# ls
auth.conf               ldap            secondary.template
cheetah_macros          modules.conf    settings
cobbler_bash            mongodb.conf    tftpd.template
completions             named.template  users.conf
dhcp.template           power           users.digest
dnsmasq.template        pxe             version
genders.template        reporting       zone.template
import_rsync_whitelist  rsync.exclude   zone_templates
iso                     rsync.template
[root@syf cobbler]# vim settings 
...
next_server: 192.168.100.10     //修改成本地IP地址
...
server: 192.168.100.10
...

生成加密的密码:

[root@syf cobbler]# vim settings 
...
default_password_crypted: ""
...
[root@syf cobbler]# openssl passwd -1 -salt "$RANDOM" 'redhat'
$1$10279$najI782TaMC4oa0i.jDso/
[root@syf cobbler]# vim settings 
...
default_password_crypted: "$1$10279$najI782TaMC4oa0i.jDso/"
...
[root@syf cobbler]# vim settings 
...
manage_dhcp: 1
...
[root@syf cobbler]# systemctl restart cobblerd.service 

通过cobbler check 核对当前设置是否有问题:

[root@syf ~]# cobbler check
The following are potential configuration items that you may want to fix:1 : change 'disable' to 'no' in /etc/xinetd.d/tftp
2 : 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, elilo.efi, and yaboot.
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 themRestart cobblerd and then run 'cobbler sync' to apply changes.
[root@syf ~]# vim /etc/xinetd.d/tftp 
...disable                 = no
...
[root@syf ~]# systemctl restart tftp
[root@syf ~]# yum -y install syslinux*
......
[root@syf ~]# cd /var/lib/cobbler/loaders/
[root@syf loaders]# ls
[root@syf loaders]# cd /usr/share/syslinux/
[root@syf syslinux]# ls
altmbr.bin     gptmbr_c.bin    isolinux-debug.bin  pxelinux.0
altmbr_c.bin   gptmbr_f.bin    kbdmap.c32          reboot.c32
altmbr_f.bin   gpxecmd.c32     linux.c32           rosh.c32
cat.c32        gpxelinux.0     ls.c32              sanboot.c32
chain.c32      gpxelinuxk.0    lua.c32             sdi.c32
cmd.c32        hdt.c32         mboot.c32           sysdump.c32
com32          host.c32        mbr.bin             syslinux64.exe
config.c32     ifcpu64.c32     mbr_c.bin           syslinux.com
cpuid.c32      ifcpu.c32       mbr_f.bin           syslinux.exe
cpuidtest.c32  ifplop.c32      memdisk             ver.com
diag           int18.com       memdump.com         vesainfo.c32
disk.c32       isohdpfx.bin    meminfo.c32         vesamenu.c32
dmitest.c32    isohdpfx_c.bin  menu.c32            vpdtest.c32
dosutil        isohdpfx_f.bin  pcitest.c32         whichsys.c32
elf.c32        isohdppx.bin    pmload.c32          zzjson.c32
ethersel.c32   isohdppx_c.bin  poweroff.com
gfxboot.c32    isohdppx_f.bin  pwd.c32
gptmbr.bin     isolinux.bin    pxechain.com
[root@syf syslinux]# ls pxelinux.0
pxelinux.0
[root@syf syslinux]# ls menu.c32 
menu.c32
[root@syf syslinux]# cd -
/var/lib/cobbler/loaders
[root@syf loaders]# ls
[root@syf loaders]# cd -
/usr/share/syslinux
[root@syf syslinux]# cp pxelinux.0 /var/lib/cobbler/loaders
[root@syf syslinux]# cp menu.c32 /var/lib/cobbler/loaders
[root@syf syslinux]# cd -
/var/lib/cobbler/loaders
[root@syf loaders]# ls
menu.c32  pxelinux.0
[root@syf loaders]# yum -y install yum-utils
.....
[root@syf ~]# 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, elilo.efi, 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 themRestart cobblerd and then run 'cobbler sync' to apply changes.

配置DHCP模板文件:

[root@syf ~]# cd /etc/cobbler/
[root@syf cobbler]# ls
auth.conf               ldap            secondary.template
cheetah_macros          modules.conf    settings
cobbler_bash            mongodb.conf    tftpd.template
completions             named.template  users.conf
dhcp.template           power           users.digest
dnsmasq.template        pxe             version
genders.template        reporting       zone.template
import_rsync_whitelist  rsync.exclude   zone_templates
iso                     rsync.template
[root@syf cobbler]# vim dhcp.template
....
subnet 192.168.100.0 netmask 255.255.255.0 {option routers             192.168.100.254;option domain-name-servers 8.8.8.8;option subnet-mask         255.255.255.0;range dynamic-bootp        192.168.100.100 192.168.100.110;
....
[root@syf cobbler]# systemctl restart cobblerd.service 
[root@syf cobbler]# systemctl restart httpd
[root@syf cobbler]# cobbler sync
task started: 2025-08-20_183311_sync
task started (id=Sync, time=Wed Aug 20 18:33:11 2025)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
copying: /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
copying: /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
copying: /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
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.servicerunning shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.manage_genders
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

管理distro:

//挂载镜像:

[root@syf ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 is write-protected, mounting read-only

导入镜像:

[root@syf ~]# ls /mnt/
CentOS_BuildTag  GPL       LiveOS    RPM-GPG-KEY-CentOS-7
EFI              images    Packages  RPM-GPG-KEY-CentOS-Testing-7
EULA             isolinux  repodata  TRANS.TBL
[root@syf ~]# cobbler import --path=/mnt/ --name=Centos-7 arch=x86_64
task started: 2025-08-20_183754_import
task started (id=Media import, time=Wed Aug 20 18:37:54 2025)
Found a candidate signature: breed=suse, version=opensuse15.0
Found a candidate signature: breed=suse, version=opensuse15.1
Found a candidate signature: breed=redhat, version=rhel6
Found a matching signature: breed=redhat, version=rhel6
Adding distros from path /var/www/cobbler/ks_mirror/Centos-7:
creating new distro: Centos-7-x86_64
trying symlink: /var/www/cobbler/ks_mirror/Centos-7 -> /var/www/cobbler/links/Centos-7-x86_64
creating new profile: Centos-7-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/Centos-7 for Centos-7-x86_64
processing repo at : /var/www/cobbler/ks_mirror/Centos-7
need to process repo/comps: /var/www/cobbler/ks_mirror/Centos-7
looking for /var/www/cobbler/ks_mirror/Centos-7/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/Centos-7/repodata
*** TASK COMPLETE ***
[root@syf ~]# cobbler list
distros:Centos-7-x86_64profiles:Centos-7-x86_64systems:repos:images:mgmtclasses:packages:files:

查看详细信息 查看指定的–name 接镜像名:

[root@syf ~]# cobbler distro report --name Centos-7-x86_64
Name                           : Centos-7-x86_64
Architecture                   : x86_64
TFTP Boot Files                : {}
Breed                          : redhat
Comment                        : 
Fetchable Files                : {}
Initrd                         : /var/www/cobbler/ks_mirror/Centos-7/images/pxeboot/initrd.img
Kernel                         : /var/www/cobbler/ks_mirror/Centos-7/images/pxeboot/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : {'tree': 'http://@@http_server@@/cblr/links/Centos-7-x86_64'}
Management Classes             : []
OS Version                     : rhel6
Owners                         : ['admin']
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Template Files                 : {}

创建新的虚拟机:

在这里插入图片描述

下一步、下一步:

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

然后一直下一步、完成

开机:

在这里插入图片描述

选第二个回车:

在这里插入图片描述

在这里插入图片描述

http://www.lryc.cn/news/626969.html

相关文章:

  • 基于FPGA的实时图像处理系统(2)——VGA显示彩条和图片
  • [论文阅读] 人工智能 + 软件工程 | 从用户需求到产品迭代:特征请求研究的全景解析
  • 372. 超级次方
  • Flask 之 Request 对象详解:全面掌握请求数据处理
  • 解决前端项目启动时找不到esm文件的问题
  • STM32F407VGT6从零建立一个标准库工程模板+VSCode或Keil5
  • Spring Boot 定时任务与 xxl-job 灵活切换方案
  • 双分支混合光伏预测模型
  • 第5.7节:awk赋值运算
  • 技术半衰期悖论:AI时代“不可替代领域“的深耕地图
  • AIStarter服务器版深度解析:与桌面版对比,解锁云端AI开发新体
  • 如何代开VSCode的settigns.json文件
  • 【JavaEE】多线程(线程安全问题)
  • Gin传参和接收参数的方式
  • BM25 系列检索算法
  • 自学大语言模型之Transformer的Trainer
  • 工业电脑选得好生产效率节节高稳定可靠之选
  • 0基础安卓逆向原理与实践:第5章:APK结构分析与解包
  • 华为仓颉语言的class(类)初步
  • 比剪映更轻量!SolveigMM 视频无损剪切实战体验
  • 将集合拆分成若干个batch,并将batch存于新的集合
  • ubuntu下安装vivado2015.2时报错解决方法
  • 换根DP(P3478 [POI 2008] STA-StationP3574 [POI 2014] FAR-FarmCraft)
  • Qt 中最经典、最常用的多线程通信场景
  • 通过自动化本地计算磁盘与块存储卷加密保护数据安全
  • 链表-24.两两交换链表中的结点-力扣(LeetCode)
  • ansible playbook 实战案例roles | 实现基于firewalld添加端口
  • SSM从入门到实战:2.1 MyBatis框架概述与环境搭建
  • 【LeetCode 热题 100】279. 完全平方数——(解法三)空间优化
  • innovus auto_fix_short.tcl