cobbler

目录

cobbler简介

cobbler集成的服务:

cobbler命令

cobbler服务端部署

自动安装

​编辑 手动安装

cobbler简介

Cobbler 可以用来快速建立 Linux 网络安装环境。

Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows。

使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP、DNS、TFTP、RSYNC以及yum仓库、构造系统ISO镜像。 Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用,Cobbler客户端Koan支持虚拟机安装和操作系统重新安装。

1、Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。
2、Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。
3、Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。
4、Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet。

cobbler集成的服务:

PXE服务支持

DHCP服务管理

DNS服务管理(可选bind,dnsmasq)

电源管理

Kickstart服务支持

YUM仓库管理

TFTP(PXE启动时需要)

Apache(提供kickstart的安装源,并提供定制化的kickstart配置)

cobbler命令

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

cobbler服务端部署

//关闭防火墙和selinux
[root@localhost ~]# systemctl disable --now firewalld.service
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# sed -ri 's/^(SELINUX=).*/\1disabled/g' /etc/selinux/config
[root@localhost ~]# reboot
//重启生效
[root@localhost ~]# getenforce 
Disabled


//配置yum源,并安装epel源
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
[root@localhost ~]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
[root@localhost ~]# sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
[root@localhost ~]# sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*



//安装cobbler及相关软件
[root@localhost ~]# yum module list | grep cobbler
Failed to set locale, defaulting to C.UTF-8
Repository extras is listed more than once in the configuration
cobbler              3               default [d]                              Versatile Linux deployment server                                                                                                                                                                                                         
cobbler              3.3             default [d]                              Versatile Linux deployment server                                                 
[root@localhost ~]# dnf -y module enable cobbler:3
······
[root@localhost ~]# dnf -y install httpd dhcp* tftp tftp-server cobbler cobbler-web pykickstart rsync rsync-daemon 
······


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


//生成加密的密码
[root@localhost ~]# openssl passwd -1 -salt "$RANDOM" "lishuai123"
$1$16610$qZdGTdwFNRDmRzT16kOSL.


//修改cobbler主配置文件
[root@localhost ~]# dnf install vim -y
[root@localhost ~]# vim /etc/cobbler/settings.yaml
103 default_password_crypted: "$1$16610$qZdGTdwFNRDmRzT16kOSL."		//修改密码为新生成的加密密码
······
220 manage_dhcp: true		//将dhcp功能打开
······
255 next_server: 192.168.153.150	tftp的ip地址,为本机ip
······
353 server: 192.168.153.150		//server的ip地址,为本机ip
······
[root@localhost ~]# systemctl restart cobblerd.service


//通过cobbler check核对当前设置是否有问题
[root@localhost ~]# 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, and yaboot.
2: reposync is not installed, install yum-utils or dnf-plugins-core
3: yumdownloader is not installed, install yum-utils or dnf-plugins-core
4: debmirror package is not installed, it will be required to manage debian deployments and repositories
5: 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.
[root@localhost ~]# 

//问题1解决办法:
[root@rhel8 ~]# yum -y install syslinux*
[root@rhel8 ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/cobbler/loaders/
[root@rhel8 ~]# cp /usr/share/syslinux/menu.c32 /var/lib/cobbler/loaders/
[root@rhel8 ~]# ls /var/lib/cobbler/loaders/
menu.c32  pxelinux.0

问题2和问题3解决办法
[root@rhel8 ~]# yum -y install yum-utils

问题4和问题5可以忽略,
因为是debian系统才需要解决,显示使用的是centos8
Debian系统解决办法安装fence-agents


//配置DHCP模板文件
[root@localhost ~]# vim /etc/cobbler/dhcp.template
subnet 192.168.153.0 netmask 255.255.255.0 {		//网段
     option routers             192.168.153.2;		//网关
     option domain-name-servers 8.8.8.8;	//dns服务器
     option subnet-mask         255.255.255.0;		//子网掩码
     range dynamic-bootp        192.168.153.100 192.168.153.200;		//IP地址池
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
          
[root@localhost ~]# systemctl restart cobblerd.service httpd


//同步cobbler配置
[root@localhost ~]# cobbler sync
······
shell triggers finished successfully


管理distro
//挂载镜像
[root@localhost ~]# mount /dev/cdrom /mnt/
mount: /mnt: WARNING: device write-protected, mounted read-only.

//导入镜像
[root@localhost ~]# cobbler import --path=/mnt/ --name=wangquan arch=x86_64
······

//查看cobbler镜像列表
[root@localhost ~]# cobbler list
distros:
   wangquan-x86_64

profiles:
   wangquan-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

//查看详细信息  查看指定的--name 接镜像名
[root@localhost ~]# cobbler distro report --name wangquan-x86_64
Name                           : wangquan-x86_64
Architecture                   : x86_64
Automatic Installation Template Metadata : {'tree': 'http://@@http_server@@/cblr/links/wangquan-x86_64'}
TFTP Boot Files                : {}
Boot loader                    : grub
Breed                          : redhat
Comment                        : 
Fetchable Files                : {}
Initrd                         : /var/www/cobbler/distro_mirror/wangquan/images/pxeboot/initrd.img
Kernel                         : /var/www/cobbler/distro_mirror/wangquan/images/pxeboot/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Management Classes             : []
OS Version                     : rhel8
Owners                         : ['admin']
Redhat Management Key          : 
Remote Boot Initrd             : ~
Remote Boot Kernel             : ~
Template Files                 : {}

//创建kickstarts自动安装脚本
[root@localhost ~]# cobbler profile get-autoinstall --name wangquan-x86_64 > /var/lib/cobbler/templates/wangquan.ks
[root@localhost ~]# vim /var/lib/cobbler/templates/wangquan.ks
······
# Firewall configuration
firewall --disabled		//关闭防火墙
······
%packages
@^minimal-environment		//设置最小化安装
······

//如果是生产环境,那么部署就已经完成,如果是虚拟机就还需执行以下步骤
[root@localhost ~]# cd /usr/share/cobbler/bin/
[root@localhost bin]# ls
migrate-data-v2-to-v3.py  mkgrub.sh
migrate-settings.sh       settings-migration-v1-to-v2.sh
[root@localhost bin]# bash mkgrub.sh
[root@localhost bin]# cd /var/lib/cobbler/loaders/
[root@localhost ~]# cobbler sync
[root@localhost ~]# systemctl restart httpd cobblerd rsyncd dhcpd

自动安装

 

 

 手动安装

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值