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/settings | cobbler 主配置文件 |
/etc/cobbler/iso/ | iso模板配置文件 |
/etc/cobbler/iso/ | iso模板配置文件 |
/etc/cobbler/pxe | pxe模板配置文件 |
/etc/cobbler/power | 电源配置文件 |
/etc/cobbler/user.conf | web服务授权配置文件 |
/etc/cobbler/users.digest | web访问的用户名密码配置文件 |
/etc/cobbler/dhcp.template | dhcp服务器的的配置模板 |
/etc/cobbler/dnsmasq.template | dns服务器的配置模板 |
/etc/cobbler/tftpd.template | tftp服务的配置模板 |
/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.log | cobbler日志 |
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 ~]#
标签:root,loaders,源码,cobbler,var,yum,安装,localhost 来源: https://blog.csdn.net/qq_60032726/article/details/120726023