目 录CONTENT

文章目录

Cobbler

ZiChen D
2021-10-13 / 0 评论 / 0 点赞 / 399 阅读 / 31,458 字 / 正在检测是否收录...

Cobbler简介

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

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

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

Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack。
Cobbler官网:http://cobbler.github.io/

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/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 //查看配置信息

Cobbler服务端部署

//CentOS7版本
//下载yum源
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1572  100  1572    0     0   1612      0 --:--:-- --:--:-- --:--:--  1612
[root@localhost ~]# ls /etc/yum.repos.d/
CentOS7-Base-163.repo  CentOS-Base.repo  CentOS-CR.repo  CentOS-Debuginfo.repo  CentOS-fasttrack.repo  CentOS-Media.repo  CentOS-Sources.repo  CentOS-Vault.repo  epel.repo  epel-testing.repo

[root@localhost ~]# sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@localhost ~]# sed -i 's/^enabled=.*/enabled=1/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@localhost ~]# yum -y install epel-release
完毕!

//安装cobbler及其相关软件
[root@localhost ~]# yum -y install httpd dhcp tftp python-ctypes cobbler  xinetd cobbler-web pykickstart
完毕!

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

//修改/cobbler下的settings文件
[root@localhost ~]# cd /etc/cobbler/
[root@localhost cobbler]# vim settings 
# of the manpage for how that works.
server: 192.168.159.100		//修改server ip地址为本机ip
# if you do not set this correctly, this will be manifested in TFTP open timeouts.		//修改tftp ip地址为本机ip
next_server: 192.168.159.100

//开启tftp
[root@localhost cobbler]# sed -i '/disable/s/yes/no/g' /etc/xinetd.d/tftp

//下载缺失文件
CentOS7无法下载,所以由本地上传
[root@localhost cobbler]# ls
auth.conf       completions       genders.template        ldap          mongodb.conf    pxe            rsync.template      tftpd.template  version
cheetah_macros  dhcp.template     import_rsync_whitelist  **loaders**       named.template  reporting      secondary.template  users.conf      zone.template
cobbler_bash    dnsmasq.template  iso                     modules.conf  power           rsync.exclude  settings            users.digest    zone_templates

//启动rsync并设置开机自启
[root@localhost cobbler]# systemctl start rsyncd
[root@localhost cobbler]# systemctl enable rsyncd
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.

//生成加密的密码
[root@localhost cobbler]# openssl passwd -1
Password: 
Verifying - Password: 
$1$BF2DI8mk$edfKoXVRn2X4bgG5s17wl.

//将新生成的加密密码加入到配置文件
[root@localhost cobbler]# vim settings 
# and put the output between the "" below.
default_password_crypted: "$1$BF2DI8mk$edfKoXVRn2X4bgG5s17wl."

//重启cobbler
[root@localhost cobbler]# systemctl restart cobblerd
[root@localhost cobbler]# ss -anlt
State       Recv-Q Send-Q                                                   Local Address:Port                                                                  Peer Address:Port              
LISTEN      0      5                                                            127.0.0.1:25151                                                                            *:*                  
LISTEN      0      5                                                                    *:873                                                                              *:*                  
LISTEN      0      128                                                                  *:22                                                                               *:*                  
LISTEN      0      100                                                          127.0.0.1:25                                                                               *:*                  
LISTEN      0      5                                                                   :::873                                                                             :::*                  
LISTEN      0      128                                                                 :::80                                                                              :::*                  
LISTEN      0      128                                                                 :::22                                                                              :::*                  
LISTEN      0      100                                                                ::1:25                                                                              :::*                  
LISTEN      0      128                                                                 :::443                                                                             :::*       

//通过cobbler check 核对当前设置是否有问题
[root@localhost cobbler]# cobbler check
The following are potential configuration items that you may want to fix:

1 : debmirror package is not installed, it will be required to manage debian deployments and repositories

Restart cobblerd and then run 'cobbler sync' to apply changes.
//以上是关于debian系统的错误,请忽略

//配置cobbler dhcp
//修改cobbler配置文件,让cobbler控制dhcp
[root@localhost cobbler]# vim settings 
manage_dhcp: 1

//配置dhcp
[root@localhost cobbler]# pwd
/etc/cobbler
[root@localhost cobbler]# vim dhcp.template
subnet 192.168.159.0 netmask 255.255.255.0 {
     option routers             192.168.159.100;
     option domain-name-servers 192.168.159.2;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.159.150 192.168.159.200;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;

//重启服务并同步配置,改完dhcp必须要sync同步配置
[root@localhost cobbler]# systemctl restart cobblerd
[root@localhost cobbler]# cobbler sync
task started: 2021-10-13_211544_sync
task started (id=Sync, time=Wed Oct 13 21:15:44 2021)
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
trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
trying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
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.service

running 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 ***

//检查dhcp是否正常
[root@localhost cobbler]# netstat -anulp|grep dhcp
udp        0      0 0.0.0.0:67              0.0.0.0:*                           70551/dhcpd     

//导入redhat7镜像
[root@localhost ~]# mount /dev/cdrom /mnt
mount: /dev/sr0 写保护,将以只读方式挂载
mount: /dev/sr0 已经挂载或 /mnt 忙
       /dev/sr0 已经挂载到 /mnt 上
[root@localhost ~]# cobbler import --path=/mnt --name=centos-7 --arch=x86_64
task started: 2021-10-13_212844_import
task started (id=Media import, time=Wed Oct 13 21:28:44 2021)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path /var/www/cobbler/ks_mirror/centos-7-x86_64:
creating new distro: centos-7-x86_64
trying symlink: /var/www/cobbler/ks_mirror/centos-7-x86_64 -> /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-x86_64 for centos-7-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos-7-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/centos-7-x86_64
looking for /var/www/cobbler/ks_mirror/centos-7-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos-7-x86_64/repodata
*** TASK COMPLETE ***

//说明:
	--path      //镜像路径
	--name      //为安装源定义一个名字
	--arch      //指定安装源平台

//安装源的唯一标示就是根据name参数来定义,本例导入成功后,安装源的唯一标示就是:CentOS-7-x86_64,如果重复,系统会提示导入失败

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

profiles:
   centos-7-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

创建kickstarts自动安装脚本

[root@localhost ~]# cat > /var/lib/cobbler/kickstarts/centos-7-x96_64.ks <<'EOF'
> auth --enableshadow --passalgo=sha512
> bootloader --location=mbr
> clearpart --all --initlabel
> part /boot --asprimary --fstype="ext4" --size=500
> part swap --fstype="swap" --size=4096
> part / --fstype="ext4" --grow --size=15000
> text
> firewall --disabled
> firstboot --disable
> keyboard us
> lang en_US
> url --url=http://192.168.159.100/cobbler/ks_mirror/centos-7-x86_64
> $yum_repo_stanza
> reboot
> 
> rootpw --iscrypted $6$2WTFvfNvAMgCUPuC$MJgWGzhakgxrRObcEbAwSe8vkz0s//xyiTllGwxRsHHruQhcskO69u2LVTU9u0eemHXH2pzcGawyAJ54R2E/x0
> 
> selinux --disabled
> skipx
> timezone Asia/Shanghai --isUtc --nontp
> install
> zerombr
> 
> %packages
> @^minimal
> @core
> kexec-tools
> 
> %end
> 
> %addon com_redhat_kdump --enable --reserve-mb='auto'
> 
> %end
> 
> %anaconda
> pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
> pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
> pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
> %end
> EOF

[root@localhost ~]# cd /var/lib/cobbler/kickstarts/
[root@localhost kickstarts]# ls
centos-7-x86_64.ks  esxi4-ks.cfg  install_profiles  pxerescue.ks         sample_end.ks   sample_esxi4.ks  sample_esxi6.ks  sample_old.seed  sample.seed.28
default.ks          esxi5-ks.cfg  legacy.ks         sample_autoyast.xml  sample_esx4.ks  sample_esxi5.ks  sample.ks        sample.seed

//检查ks文件语法是否有误
[root@localhost kickstarts]# cobbler validateks
task started: 2021-10-13_214821_validateks
task started (id=Kickstart Validation, time=Wed Oct 13 21:48:21 2021)
----------------------------
osversion: rhel7
checking url: http://192.168.159.100/cblr/svc/op/ks/profile/centos-7-x86_64
running: /usr/bin/ksvalidator -v "rhel7" "http://192.168.159.100/cblr/svc/op/ks/profile/centos-7-x86_64"
received on stdout: 
received on stderr: 
*** all kickstarts seem to be ok ***
*** TASK COMPLETE ***

//查看当前cobbler有哪些配置文件
[root@localhost kickstarts]# cobbler profile list
   centos-7-x86_64



//检查当前系统cobbler配置文件信息
[root@localhost kickstarts]# cobbler profile report
Name                           : centos-7-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos-7-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
**Kickstart                      : /var/lib/cobbler/kickstarts/sample_end.ks**	//默认使用的还是sample_end.ks这个文件
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm

//修改profile,将我们新建的ks文件设为默认的kickstarts安装文件
[root@localhost kickstarts]# cobbler profile edit --name centos-7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos-7-x86_64.ks

//配置网卡名称为传统网卡名称eth0
[root@localhost kickstarts]# cobbler profile edit --name centos-7-x86_64 --kopts='net.ifnames=0 biosdevname=0'

//检查当前系统cobbler配置文件信息
[root@localhost kickstarts]# cobbler profile report
Name                           : centos-7-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos-7-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
**Kernel Options                 : {'biosdevname': '0', 'net.ifnames': '0'}**	//网卡设置回归传统命名
Kernel Options (Post Install)  : {}
**Kickstart                      : /var/lib/cobbler/kickstarts/centos-7-x86_64.ks**	//设置好为我们创建的镜像文件
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm

//同步cobbler
[root@localhost kickstarts]# cobbler sync
task started: 2021-10-13_220001_sync
task started (id=Sync, time=Wed Oct 13 22:00:01 2021)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/centos-7-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/images/centos-7-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying files for distro: centos-7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos-7-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos-7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos-7-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos-7-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: centos-7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos-7-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos-7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos-7-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos-7-x86_64/initrd.img
Writing template files for centos-7-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
processing boot_files for distro: centos-7-x86_64
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.service

running 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 ***

//重启服务
[root@localhost kickstarts]# systemctl restart httpd
[root@localhost kickstarts]# systemctl restart cobblerd
[root@localhost kickstarts]# systemctl restart xinetd

客户端安装

新建虚拟机从pxe启动,若出现以下界面则表示成功:

定制安装

定制安装步骤:

  • 统计服务器mac地址
  • 配置cobbler
  • 安装

统计mac地址此处就不赘述了,直接最重要的配置
在 cobbler 的web界面上配置:

PS:账号密码都为cobbler


步骤:

  1. 添加网卡,网卡名eth0
  1. 选择第1步添加的网卡
  2. 填写要安装的服务器的MAC地址
  3. 安装好后给此服务器分配的IP地址
  4. 设置子网掩码
  5. 确认添加

同步配置并重启相关服务:

[root@localhost ~]# cobbler sync
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# systemctl restart cobblerd
[root@localhost ~]# systemctl restart xinetd

部署Redhat8

//导入rhel-8镜像
[root@localhost kickstarts]# mount /dev/cdrom /mnt
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost kickstarts]# cobbler import --path=/mnt --name=rhel-8 --arch=x86_64
task started: 2021-10-14_141420_import
task started (id=Media import, time=Thu Oct 14 14:14:20 2021)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path /var/www/cobbler/ks_mirror/rhel-8-x86_64:
creating new distro: rhel-8-x86_64
trying symlink: /var/www/cobbler/ks_mirror/rhel-8-x86_64 -> /var/www/cobbler/links/rhel-8-x86_64
creating new profile: rhel-8-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/rhel-8-x86_64 for rhel-8-x86_64
processing repo at : /var/www/cobbler/ks_mirror/rhel-8-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-8-x86_64
looking for /var/www/cobbler/ks_mirror/rhel-8-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel-8-x86_64/repodata
*** TASK COMPLETE ***

//编写kickstarts自动安装脚本
[root@localhost ~]# cat > /var/lib/cobbler/kickstarts/rhel-7-x86_64.ks <<'EOF'
auth --enableshadow --passalgo=sha512
bootloader --location=mbr
clearpart --all --initlabel
part /boot --asprimary --fstype="ext4" --size=500
part swap --fstype="swap" --size=4096
part / --fstype="ext4" --grow --size=15000
text
firewall --disabled
firstboot --disable
keyboard us
lang en_US
url --url=http://192.168.159.100/cobbler/ks_mirror/centos-7-x86_64
reboot

repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
repo --name="BaseOS" --baseurl=file:///run/install/repo/BaseOS


rootpw --iscrypted $6$sAWTiMRXee5ShzV4$PdBCTYP9oHMu4edsj.lwLmJhPCwZF5indWhgvnqBeOes/l4pgkH6jee/Jcb9zB6M7eerNobBRvucdiuwLFz3r/


selinux --disabled
skipx
timezone Asia/Shanghai --isUtc --nontp
install
zerombr

%packages
@^minimal
@core
kexec-tools

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
EOF

//检查ks文件语法是否有误
[root@localhost kickstarts]# cobbler validateks
task started: 2021-10-14_141919_validateks
task started (id=Kickstart Validation, time=Thu Oct 14 14:19:19 2021)
----------------------------
osversion: rhel7
checking url: http://192.168.159.100/cblr/svc/op/ks/profile/rhel-8-x86_64
running: /usr/bin/ksvalidator -v "rhel7" "http://192.168.159.100/cblr/svc/op/ks/profile/rhel-8-x86_64"
received on stdout: 
received on stderr: 
----------------------------
osversion: rhel7
checking url: http://192.168.159.100/cblr/svc/op/ks/profile/centos-7-x86_64
running: /usr/bin/ksvalidator -v "rhel7" "http://192.168.159.100/cblr/svc/op/ks/profile/centos-7-x86_64"
received on stdout: 
received on stderr: 
Potential templating errors:
Unknown variable found at line 16, column 39: '$MJgWGzhakgxrRObcEbAwSe8vkz0s'
----------------------------
osversion: rhel7
checking url: http://192.168.159.100/cblr/svc/op/ks/system/test1
running: /usr/bin/ksvalidator -v "rhel7" "http://192.168.159.100/cblr/svc/op/ks/system/test1"
received on stdout: 
received on stderr: 
Potential templating errors:
Unknown variable found at line 16, column 39: '$MJgWGzhakgxrRObcEbAwSe8vkz0s'
*** all kickstarts seem to be ok ***
*** TASK COMPLETE ***

//查看当前cobbler有哪些配置文件
[root@localhost kickstarts]# cobbler profile list
   centos-7-x86_64
   rhel-8-x86_64

//修改profile,将我们新建的ks文件设为默认的kickstarts安装文件
[root@localhost kickstarts]# cobbler profile edit --name rhel-8-x86_64 --kickstart=/var/lib/cobbler/kickstarts/rhel-8-x86_64.ks

//配置网卡名称为传统网卡名称eth0
[root@localhost kickstarts]# cobbler profile edit --name rhel-8-x86_64 --kopts='net.ifnames=0 biosdevname=0'

//检查当前系统cobbler配置文件信息
[root@localhost kickstarts]# cobbler profile report
Name                           : rhel-8-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : rhel-8-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {'biosdevname': '0', 'net.ifnames': '0'}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/rhel-8-x86_64.ks
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm

Name                           : centos-7-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos-7-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {'biosdevname': '0', 'net.ifnames': '0'}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/centos-7-x86_64.ks
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : kvm

//同步cobbler
[root@localhost kickstarts]# cobbler sync
task started: 2021-10-14_142238_sync
task started (id=Sync, time=Thu Oct 14 14:22:38 2021)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/centos-7-x86_64
removing: /var/www/cobbler/images/rhel-8-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/pxelinux.cfg/01-00-0c-29-05-71-82
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/grub/01-00-0C-29-05-71-82
removing: /var/lib/tftpboot/images/centos-7-x86_64
removing: /var/lib/tftpboot/images/rhel-8-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying files for distro: rhel-8-x86_64
trying hardlink /var/www/cobbler/ks_mirror/rhel-8-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/rhel-8-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/rhel-8-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/rhel-8-x86_64/initrd.img
copying files for distro: centos-7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos-7-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos-7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos-7-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos-7-x86_64/initrd.img
copying images
generating PXE configuration files
generating: /var/lib/tftpboot/pxelinux.cfg/01-00-0c-29-05-71-82
generating: /var/lib/tftpboot/grub/01-00-0C-29-05-71-82
generating PXE menu structure
copying files for distro: rhel-8-x86_64
trying hardlink /var/www/cobbler/ks_mirror/rhel-8-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/rhel-8-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/rhel-8-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/rhel-8-x86_64/initrd.img
Writing template files for rhel-8-x86_64
copying files for distro: centos-7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos-7-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos-7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos-7-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos-7-x86_64/initrd.img
Writing template files for centos-7-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
processing boot_files for distro: rhel-8-x86_64
processing boot_files for distro: centos-7-x86_64
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.service

running 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 ***

//重启服务
[root@localhost kickstarts]# systemctl restart xinetd
[root@localhost kickstarts]# systemctl restart cobblerd
[root@localhost kickstarts]# systemctl restart httpd
[root@localhost kickstarts]# ss -anlt
State       Recv-Q Send-Q                                                   Local Address:Port                                                                  Peer Address:Port              
LISTEN      0      5                                                            127.0.0.1:25151                                                                            *:*                  
LISTEN      0      5                                                                    *:873                                                                              *:*                  
LISTEN      0      128                                                                  *:22                                                                               *:*                  
LISTEN      0      100                                                          127.0.0.1:25                                                                               *:*                  
LISTEN      0      5                                                                   :::873                                                                             :::*                  
LISTEN      0      128                                                                 :::80                                                                              :::*                  
LISTEN      0      128                                                                 :::22                                                                              :::*                  
LISTEN      0      100                                                                ::1:25                                                                              :::*                  
LISTEN      0      128                                                                 :::443                                                                             :::*  

安装客户端:
新建虚拟机验证:

0

评论区