cobbler

//安装软件包
[root@server ~]# yum -y install httpd dhcp* tftp tftp-server pykickstart rsync rsync-daemon
[root@server ~]# yum -y install cobbler
[root@server ~]# yum -y install cobbler-web
Last metadata expiration check: 0:01:11 ago on Thu 25 Jul 2024 09:48:33 AM CST.
Error: 
 Problem: problem with installed package cobbler-3.3.4-1.el9.noarch
  - package cobbler3.2-3.2.2-16.el9.noarch from epel conflicts with cobbler > 3.2.2 provided by cobbler-3.3.4-1.el9.noarch from @System
  - package cobbler3.2-3.2.2-16.el9.noarch from epel conflicts with cobbler > 3.2.2 provided by cobbler-3.3.4-1.el9.noarch from epel
  - package cobbler3.2-web-3.2.2-16.el9.noarch from epel requires cobbler3.2 = 3.2.2-16.el9, but none of the providers can be installed
  - conflicting requests
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)//此时有报错信息,需要添加--allowerasing继续安装
[root@server ~]# yum -y install cobbler-web --allowerasing

//重启服务
[root@server ~]# systemctl restart httpd
[root@server ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@server ~]# systemctl restart rsyncd
[root@server ~]# systemctl enable rsyncd
Created symlink /etc/systemd/system/multi-user.target.wants/rsyncd.service → /usr/lib/systemd/system/rsyncd.service.
[root@server ~]# systemctl restart tftp
[root@server ~]# systemctl enable tftp
Created symlink /etc/systemd/system/sockets.target.wants/tftp.socket → /usr/lib/systemd/system/tftp.socket.
[root@server ~]# systemctl restart cobblerd.service 
[root@server ~]# systemctl enable cobblerd.service 
Created symlink /etc/systemd/system/multi-user.target.wants/cobblerd.service → /usr/lib/systemd/system/cobblerd.service.

//生成加密密码
[root@server ~]# openssl passwd -1 -salt "$RANDOM" 'redhat'
$1$18142$2h82VpocEPk3tah.wgCLq1
//编辑配置文件,修改server的ip地址为本机ip,设置tftp的ip地址为本机ip,添加加密密码,将cobbler的dhcp功能打开
[root@server ~]# vim /etc/cobbler/settings.yaml 
next_server: 192.168.35.142 //tftp IP地址
server: 192.168.35.142 //server IP地址
default_password_crypted: "$1$18142$2h82VpocEPk3tah.wgCLq1" //加密密码
manage_dhcp: true //dhcp功能

//重启服务,查看报错信息
[root@server ~]# systemctl restart cobblerd.service 
[root@server ~]# 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. //文件丢失,在/var/lib/cobbler/loaders中找不到pxelinux.0, menu.c32, and yaboot
2: reposync is not installed, install yum-utils or dnf-plugins-core //yum-utils软件包未安装
3: yumdownloader is not installed, install yum-utils or dnf-plugins-core //yum-utils软件包未安装
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

//解决问题
问题一
[root@server ~]# yum -y install syslinux*
[root@server ~]# cd /usr/share/syslinux/
[root@server syslinux]# cp pxelinux.0 /var/lib/cobbler/loaders/
[root@server syslinux]# cp menu.c32 /var/lib/cobbler/loaders/
问题二、问题三
[root@server ~]# yum -y install yum-utils
问题四和问题五可以忽略,因为是debian系统才需要解决,显示使用的是centos8,Debian系统解决办法安装fence-agents

//配置DHCP模板文件
[root@server syslinux]# vim /etc/cobbler/dhcp.template
subnet 192.168.35.0 // 当前网段 netmask 255.255.255.0 //网络掩码{
     option routers             192.168.35.2; //网关
     option domain-name-servers 114.114.114.114; //dns
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.35.128 192.168.35.200; //子网范围
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
     class "pxeclients" {
          match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";

//同步cobbler配置
[root@server ~]systemctl restart httpd cobblerd
[root@server ~]# cobbler sync

//管理distro,挂载镜像,导入镜像
[root@server ~]# mount /dev/cdrom /mnt/ //挂载
[root@server ~]# cobbler import --path=/mnt/ --name=Rocky-9 arch=x86_64 //导入
task started: 2024-07-25_104851_import
task started (id=Media import, time=Thu Jul 25 10:48:51 2024)
running python triggers from /var/lib/cobbler/triggers/task/import/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/import/pre/*
shell triggers finished successfully

//生成文件,编辑配置文件
[root@server ~]# cobbler profile get-autoinstall --name Rocky-9-x86_64 > /var/lib/cobbler/templates/rocky9.ks
[root@server ~]# vim /var/lib/cobbler/templates/rocky9.ks
//关闭防火墙
firewall --disabled
//yum源
repo --name=source-1 --baseurl="http//192.168.100.10/cobbler/distro_mirror/AppStream"
repo --name=source-2 --baseurl="http//192.168.100.10/cobbler/distro_mirror/BaseOS"
//最小安装软件包
%packages
@^minimal-environment
%end

//此时使用虚拟机去安装系统并不会成功  需要做如下操作
[root@server ~]# cd /usr/share/cobbler/bin/
[root@server bin]# ls
migrate-data-v2-to-v3.py  mkgrub.sh
migrate-settings.sh       settings-migration-v1-to-v2.sh
[root@server bin]# bash mkgrub.sh 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值