C/C++教程

cobbler源码安装

本文主要是介绍cobbler源码安装,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

cobbler源码安装

1. cobbler简介

Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。

Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。

Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。

Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack。

链接: 官网.

cobbler集成的服务

  • PXE服务支持
  • DHCP服务管理
  • DNS服务管理(可选bind,dnsmasq)
  • 电源管理
  • Kickstart服务支持
  • YUM仓库管理
  • TFTP(PXE启动时需要)
  • Apache(提供kickstart的安装源,并提供定制化的kickstart配置)
    cobbler配置文件详解
    cobbler配置文件目录在/etc/cobbler
配置文件作用
/etc/cobbler/settingscobbler 主配置文件
/etc/cobbler/iso/iso模板配置文件
/etc/cobbler/iso/iso模板配置文件
/etc/cobbler/pxepxe模板配置文件
/etc/cobbler/power电源配置文件
/etc/cobbler/user.confweb服务授权配置文件
/etc/cobbler/users.digestweb访问的用户名密码配置文件
/etc/cobbler/dhcp.templatedhcp服务器的的配置模板
/etc/cobbler/dnsmasq.templatedns服务器的配置模板
/etc/cobbler/tftpd.templatetftp服务的配置模板
/etc/cobbler/modules.conf模块的配置文件

cobbler数据目录

目录作用
/var/lib/cobbler/config/用于存放distros,system,profiles等信息配置文件
/var/lib/cobbler/triggers/用于存放用户定义的cobbler命令
/var/lib/cobbler/kickstart/默认存放kickstart文件
/var/lib/cobbler/loaders/存放各种引导程序以及镜像目录
/var/www/cobbler/ks_mirror/导入的发行版系统的所有数据
/var/www/cobbler/images/导入发行版的kernel和initrd镜像用于远程网络启动
/var/www/cobbler/repo_mirror/yum仓库存储目录

cobbler日志文件

日志文件路径说明
/var/log/cobbler/installing客户端安装日志
/var/log/cobbler/cobbler.logcobbler日志

cobbler命令详解

cobbler check       //核对当前设置是否有问题
cobbler list        //列出所有的cobbler元素
cobbler report      //列出元素的详细信息
cobbler sync        //同步配置到数据目录,更改配置最好都要执行下
cobbler reposync    //同步yum仓库
cobbler distro      //查看导入的发行版系统信息
cobbler system      //查看添加的系统信息
cobbler profile     //查看配置信息

2. cobbler服务端部署

//安装epel源
[root@localhost yum.repos.d]# yum -y install epel-release
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

//关闭防火墙
[root@localhost yum.repos.d]# systemctl disable --now firewalld
[root@localhost yum.repos.d]# setenforce 0
[root@localhost yum.repos.d]# 

//安装cobbler以及相关的软件
[root@localhost yum.repos.d]# yum -y install httpd tftp
[root@localhost yum.repos.d]# yum -y install dhcp-*
[root@localhost yum.repos.d]# yum -y install xinetd
[root@localhost yum.repos.d]# yum -y install pykickstart
[root@localhost yum.repos.d]# dnf -y install cobbler
[root@localhost yum.repos.d]# dnf -y install cobbler-web
[root@localhost settings.d]# yum -y install syslinux


//启动服务并设置开机自启
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl start cobblerd
[root@localhost ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@localhost ~]# systemctl enable cobblerd
Created symlink /etc/systemd/system/multi-user.target.wants/cobblerd.service → /usr/lib/systemd/system/cobblerd.service.


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

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

//修改配置文件
[root@localhost settings.d]# ls
bind_manage_ipmi.settings  manage_genders.settings  nsupdate.settings
[root@localhost settings.d]# cat bind_manage_ipmi.settings 
# bind_manage_ipmi - used to let bind manage IPMI addresses if the power management address is an IP and if manage_bind
# is set.
bind_manage_ipmi: true
[root@localhost settings.d]# cat manage_genders.settings 
# manage_genders - Bool to enable/disable managing an /etc/genders file for use with pdsh and others.
manage_genders: True
[root@localhost settings.d]# cat nsupdate.settings 
# Set to "true" to enable Cobbler's dynamic DNS updates.
nsupdate_enabled: True

# define tsig key
# please don't use this one, instead generate your own:
#   dnssec-keygen -a HMAC-SHA512 -b 512 -n USER cobbler_update_key
nsupdate_tsig_algorithm: "hmac-sha512"
nsupdate_tsig_key: [ "cobbler_update_key.", "hvnK54HFJXFasHjzjEn09ASIkCOGYSnofRq4ejsiBHz3udVyGiuebFGAswSjKUxNuhmllPrkI0HRSSmM2qvZug==" ]

# if set, enables logging to that file
nsupdate_log: "/var/log/cobbler/nsupdate.log"

[root@localhost settings.d]# 

//下载缺失文件
[root@localhost ~]# cobbler get-loaders
task started: 2021-10-12_072329_get_loaders
task started (id=Download Bootloader Content, time=Tue Oct 12 07:23:29 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
path /var/lib/cobbler/loaders/pxelinux.0 already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/menu.c32 already exists, not overwriting existing content, use --force if you wish to update
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 ***
[root@localhost ~]# 

这篇关于cobbler源码安装的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!