当前位置: 首页 > 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.dtcms.com/a/341660.html

相关文章:

  • 连续空间强化学习:策略输出的两种形态 —— 概率分布与确定性动作
  • 智慧城市SaaS平台/市政设施运行监测系统之排水管网运行监测、综合管廊运行监测
  • lesson43:Python操作MongoDB数据库完全指南
  • Hyperledger Fabric官方中文教程-改进笔记(十三)-使用测试网络创建通道
  • 25年CATL宁德时代社招晋升竞聘Veirfy测评SHL题库演绎数字语言推理答题指南
  • Js逆向 某花顺登录滑块逆向
  • AI入门学习--理解token
  • Springboot 项目配置多数据源
  • TDengine IDMP 运维指南(5. 使用 Helm 部署)
  • C++ 数据结构 和 STL
  • Python如何将两个列表转化为一个字典
  • Spring Framework 常用注解详解(按所属包分类整理)
  • innovus auto_fix_short.tcl
  • MTK Linux DRM分析(三)- drm_drv.c分析
  • 【智能体记忆】记忆如何塑造我们:深入探究记忆的类型
  • yolov8检测实时视频流,裁剪出未戴头盔的头部方案
  • HarmonyOS相对布局 (RelativeContainer) 基本概念
  • ODPS 十五周年实录 | 为 AI 而生的数据平台
  • 大数据毕业设计选题推荐-基于Hadoop的电信客服数据处理与分析系统-Spark-HDFS-Pandas
  • 文本智能抽取:如何用NLP从海量文本中“炼“出真金?-告别无效阅读,让AI成为你的“信息炼金师
  • OceanBase DBA实战营2期--SQL 关键字限流学习笔记
  • ae复制合成后修改里面图层相互影响问题
  • uos(类linux)系统 打印机自定义打印尺寸
  • MySQL分库分表与MyCAT
  • open webui源码分析5-Tools
  • 基于单片机水质检测系统/污水监测系统/水情监测
  • ansible中roles角色是什么意思?
  • 详解flink table api基础(三)
  • 【网络】使用 DNAT 进行负载均衡时,若未配置配套的 SNAT,回包失败
  • 猫头虎开源AI分享|基于大模型和RAG的一款智能text2sql问答系统:SQLBot(SQL-RAG-QABot),可以帮你用自然语言查询数据库