cobbler批量装机工具,可以实现同时装多台或多台不同系统的主机,也可以实现定制安装

cobbler批量装机工具

文章目录

  • cobbler批量装机工具
    • 1. cobbler简介
    • 2. cobbler服务端部署uos
    • 3. 客户端安装(内存和cpu可以多个点,以免后面出错)
    • 4.cobbler服务端部署centos7
    • 5.客户端安装
    • 6.cobbler服务端部署centos8
    • 7.客户端安装
    • 8.cobbler服务端部署rockylinux9
    • 9.客户端安装
    • 10.定制安装

1. cobbler简介

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

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

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

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

Cobbler官网

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

2. cobbler服务端部署uos

服务端主机空间要求

在这里插入图片描述

1.关闭防火墙
[root@cobbler ~]# systemctl disable --now firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@cobbler ~]# getenforce
Disabled

2.安装cobbler以及相关的软件
[root@cobbler ~]# yum -y install httpd dhcp tftp python-ctypes cobbler  xinetd cobbler-web pykickstart
UnionTechOS 20 AppStream                                                                         1.3 MB/s | 8.1 MB     00:05    
UnionTechOS 20 BaseOS                                                                            2.0 MB/s | 1.8 MB     00:00    
UnionTechOS 20 PowerTools                                                                        2.6 MB/s | 2.8 MB     00:01    
UnionTechOS 20 Plus                                                                              8.0 MB/s |  10 MB     00:01    
UnionTechOS 20 Extras                                                                            9.1 kB/s | 2.3 kB     00:00    
UnionTechOS 20 Update                                                                            1.0 kB/s | 257  B     00:00    
UnionTechOS 20 GM                                                                                3.4 MB/s | 1.4 MB     00:00    
未找到匹配的参数: dhcp
未找到匹配的参数: python-ctypes
错误:没有任何匹配: dhcp python-ctypes

//解决方案
[root@cobbler ~]# yum list all | grep python|grep ctypes
[root@cobbler ~]# yum -y install httpd dhcp* tftp  cobbler  xinetd cobbler-web pykickstart syslinux
完毕!

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

4.修改server的ip地址为本机ip
[root@cobbler ~]# vim /etc/cobbler/settings
server: 192.168.116.146      //改为自己本机的ip

5.设置tftp的ip地址为本机ip
[root@cobbler ~]# vim /etc/cobbler/settings
next_server: 192.168.116.146   //改为自己本机的ip

6.开启tftp
[root@cobbler ~]# systemctl enable --now tftp
Created symlink /etc/systemd/system/sockets.target.wants/tftp.socket → /usr/lib/systemd/system/tftp.socket.
[root@cobbler ~]# systemctl status tftp
● tftp.service - Tftp Server
   Loaded: loaded (/usr/lib/systemd/system/tftp.service; indirect; vendor preset: disabled)
   Active: active (running) since Mon 2023-12-25 14:06:00 CST; 10s ago
     Docs: man:in.tftpd
 Main PID: 69394 (in.tftpd)
    Tasks: 1
   Memory: 108.0K
   CGroup: /system.slice/tftp.service
           └─69394 /usr/sbin/in.tftpd -s /var/lib/tftpboot

1225 14:06:00 cobbler systemd[1]: Started Tftp Server.

7.下载缺失文件
[root@cobbler ~]# cobbler get-loaders
task started: 2023-12-25_140649_get_loaders
task started (id=Download Bootloader Content, time=Mon Dec 25 14:06:49 2023)
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
downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
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 ***

8.启动rsync并设置开机自启
[root@cobbler ~]# rpm -qa | grep rsync
rsync-3.1.3-19.uelc20.x86_64
[root@cobbler ~]# yum -y install rsync-daemon
完毕!
[root@cobbler ~]# systemctl enable --now rsyncd
Created symlink /etc/systemd/system/multi-user.target.wants/rsyncd.service → /usr/lib/systemd/system/rsyncd.service.
[root@cobbler ~]# systemctl status rsyncd
● rsyncd.service - fast remote file copy program daemon
   Loaded: loaded (/usr/lib/systemd/system/rsyncd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2023-12-25 14:09:05 CST; 6s ago
 Main PID: 93475 (rsync)
    Tasks: 1
   Memory: 188.0K
   CGroup: /system.slice/rsyncd.service
           └─93475 /usr/bin/rsync --daemon --no-detach

1225 14:09:05 cobbler systemd[1]: Started fast remote file copy program daemon.
1225 14:09:05 cobbler rsyncd[93475]: rsyncd version 3.1.3 starting, listening on port 873

9.生成加密的密码
[root@cobbler ~]# openssl passwd -1 -salt "$RANDOM" 'Passw0rd@_~'
$1$24272$8uLVuFlMwimkhkygX30rN0      //这是密码加密后的形式

10.将新生成的加密密码加入到配置文件
[root@cobbler ~]# vim /etc/cobbler/settings
default_password_crypted: "$1$24272$8uLVuFlMwimkhkygX30rN0"    //改为刚刚生成的随机加密的密码

11.重启cobbler
[root@cobbler ~]# systemctl restart cobblerd
[root@cobbler ~]# ss -antl
State          Recv-Q         Send-Q                 Local Address:Port                  Peer Address:Port        Process        
LISTEN         0              128                          0.0.0.0:22                         0.0.0.0:*                          
LISTEN         0              5                          127.0.0.1:631                        0.0.0.0:*                          
LISTEN         0              5                          127.0.0.1:25151                      0.0.0.0:*                          
LISTEN         0              5                            0.0.0.0:873                        0.0.0.0:*                          
LISTEN         0              511                                *:80                               *:*                          
LISTEN         0              128                             [::]:22                            [::]:*                          
LISTEN         0              5                              [::1]:631                           [::]:*                          
LISTEN         0              511                                *:443                              *:*                          
LISTEN         0              5                               [::]:873                           [::]:*                          
12.通过cobbler check 核对当前设置是否有问题
[root@cobbler ~]# cobbler check
The following are potential configuration items that you may want to fix:

1: reposync is not installed, install yum-utils or dnf-plugins-core
2: yumdownloader is not installed, install yum-utils or dnf-plugins-core
3: debmirror package is not installed, it will be required to manage debian deployments and repositories
4: 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@cobbler ~]# yum -y install yum-utils
完毕!

[root@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
2: 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.

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

14.配置dhcp
[root@cobbler ~]# vim /etc/cobbler/dhcp.template
subnet 192.168.116.0 netmask 255.255.255.0 {               //改为自己虚拟机的网段
     option routers             192.168.116.146;           //改为自己虚拟机的ip
     option domain-name-servers 192.168.116.2;             //自己虚拟机的网关
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.116.100 192.168.116.200;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;

15.重启服务并同步配置,改完dhcp必须要sync同步配置
[root@cobbler ~]# systemctl restart cobblerd
[root@cobbler ~]# cobbler sync
task started: 2023-12-25_142054_sync
task started (id=Sync, time=Mon Dec 25 14:20:54 2023)
running python triggers from /var/lib/cobbler/triggers/task/sync/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/sync/pre/*
shell triggers finished successfully
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/system
removing: /var/lib/tftpboot/grub/system_link
removing: /var/lib/tftpboot/grub/images
copying bootloaders
running: ['rsync', '-rpt', '--copy-links', '--exclude=.cobbler_postun_cleanup', '/var/lib/cobbler/loaders/', '/var/lib/tftpboot']
received on stdout: 
received on stderr: 
running: ['rsync', '-rpt', '--copy-links', '--exclude=README.grubconfig', '/var/lib/cobbler/grub_config/', '/var/lib/tftpboot']
received on stdout: 
received on stderr: 
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
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/*
shell triggers finished successfully
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running python trigger cobbler.modules.managers.genders
running shell triggers from /var/lib/cobbler/triggers/change/*
shell triggers finished successfully
*** TASK COMPLETE ***

16.检查dhcp是否正常
[root@cobbler ~]# ss -anulp|grep dhcp
UNCONN 0      0            0.0.0.0:59154      0.0.0.0:*    users:(("dhcpd",pid=144794,fd=20))    
UNCONN 0      0            0.0.0.0:67         0.0.0.0:*    users:(("dhcpd",pid=144794,fd=10))    
UNCONN 0      0               [::]:40968         [::]:*    users:(("dhcpd",pid=144794,fd=21))    

17.导入uos镜像
[root@cobbler ~]# mount /dev/cdrom /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@cobbler ~]# ls /mnt
AppStream  BaseOS  EFI  extra_files.json  images  isolinux  kernel419  kernel510  media.repo  RPM-GPG-KEY-uos-release  TRANS.TBL
[root@cobbler ~]# cobbler import --path=/mnt --name=uos20 --arch=x86_64
task started: 2023-12-25_142438_import
task started (id=Media import, time=Mon Dec 25 14:24:38 2023)
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
Found a candidate signature: breed=uniontech, version=uniontech
Found a matching signature: breed=uniontech, version=uniontech
Adding distros from path /var/www/cobbler/distro_mirror/uos20-x86_64:
creating new distro: uos20-x86_64
trying symlink: /var/www/cobbler/distro_mirror/uos20-x86_64 -> /var/www/cobbler/links/uos20-x86_64
creating new profile: uos20-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/distro_mirror/uos20-x86_64 for uos20-x86_64
processing repo at : /var/www/cobbler/distro_mirror/uos20-x86_64/AppStream
need to process repo/comps: /var/www/cobbler/distro_mirror/uos20-x86_64/AppStream
looking for /var/www/cobbler/distro_mirror/uos20-x86_64/AppStream/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/distro_mirror/uos20-x86_64/AppStream/repodata
processing repo at : /var/www/cobbler/distro_mirror/uos20-x86_64/BaseOS
need to process repo/comps: /var/www/cobbler/distro_mirror/uos20-x86_64/BaseOS
looking for /var/www/cobbler/distro_mirror/uos20-x86_64/BaseOS/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/distro_mirror/uos20-x86_64/BaseOS/repodata
processing repo at : /var/www/cobbler/distro_mirror/uos20-x86_64/kernel419
directory /var/www/cobbler/distro_mirror/uos20-x86_64/kernel419 is missing xml comps file, skipping
processing repo at : /var/www/cobbler/distro_mirror/uos20-x86_64/kernel510
directory /var/www/cobbler/distro_mirror/uos20-x86_64/kernel510 is missing xml comps file, skipping
*** TASK COMPLETE ***

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

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

18.查看cobbler镜像列表
[root@cobbler ~]# cobbler list
distros:
   uos20-x86_64

profiles:
   uos20-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

19.进入/var/lib/cobbler/templates目录创建一个以.ks结尾的文件生成自动安装脚本
[root@cobbler ~]# cd /var/lib/cobbler/
[root@cobbler cobbler]# ls
collections  distro_signatures.json  grub_config  loaders  lock  scripts  snippets  templates  triggers  web.ss  webui_sessions
[root@cobbler cobbler]# cd templates/
[root@cobbler templates]# ls
default.ks    install_profiles  pxerescue.ks         sample_esxi5.ks  sample_legacy.ks
esxi4-ks.cfg  legacy.ks         sample_autoyast.xml  sample_esxi6.ks  sample_old.seed
esxi5-ks.cfg  powerkvm.ks       sample_esxi4.ks      sample.ks        sample.seed
[root@cobbler templates]# pwd
/var/lib/cobbler/templates
[root@cobbler templates]# vim uos20.ks
[root@cobbler templates]# cat uos20.ks
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.116.146/cobbler/links/uos20-x86_64/       //这个到网页上面访问:ip/cobbler
$yum_repo_stanza
reboot

rootpw --iscrypted $6$WqdLuLnm2W8M98bv$XKfgxxCeviKNg4y/pj6bT2/b/WIT.91YyWcb3930BgVUiuHXuFtqQXLP3isSdfz2mZpSQCDqO.Ude3uL9pz370                            //这个位置可以复制自己虚拟机的/root/anaconda-ks.cfg中的

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

20.检查ks文件语法是否有误
[root@cobbler ~]# cobbler --help
usage
=====
cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ... 
        [add|edit|copy|get-autoinstall*|list|remove|rename|report] [options|--help]
cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validate-autoinstalls|version|signature|get-loaders|hardlink> [options|--help]
[root@cobbler ~]# cobbler validate-autoinstalls
task started: 2023-12-25_143648_validate_autoinstall_files
task started (id=Automated installation files validation, time=Mon Dec 25 14:36:48 2023)
running python triggers from /var/lib/cobbler/triggers/task/validate_autoinstall_files/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/validate_autoinstall_files/pre/*
shell triggers finished successfully
*** TASK COMPLETE ***

21.查看当前cobbler有哪些配置文件
[root@cobbler ~]# cobbler profile list
   uos20-x86_64

22.修改profile,将我们新建的ks文件设为默认的autoinstall安装文件
[root@cobbler ~]# cobbler profile edit --help
 --autoinstall=AUTOINSTALL
                        Automatic Installation Template (Path to automatic
                        installation template)
[root@cobbler ~]# cobbler profile edit --name uos20-x86_64 --autoinstall=uos20.ks

23.配置网卡名称为传统网卡名称eth0
[root@cobbler ~]# cobbler profile edit --help
--kernel-options=KERNEL_OPTIONS
                        Kernel Options (Ex: selinux=permissive)
[root@cobbler ~]# cobbler profile edit --name uos20-x86_64 --kernel-options='net.ifnames=0 biosdevname=0'

24.检查当前系统cobbler配置文件信息
[root@cobbler ~]# cobbler profile report
Name                           : uos20-x86_64
Automatic Installation Template : uos20.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : uos20-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
DHCP Filename Override         : <<inherit>>
Kernel Options                 : {'net.ifnames': '0', 'biosdevname': '0'}
Kernel Options (Post Install)  : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Next Server Override           : <<inherit>>
Owners                         : ['admin']
Parent Profile                 : 
Proxy                          : 
Red Hat Management Key         : <<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

25.同步cobbler
[root@cobbler ~]# cobbler sync
task started: 2023-12-25_144402_sync
task started (id=Sync, time=Mon Dec 25 14:44:02 2023)
running python triggers from /var/lib/cobbler/triggers/task/sync/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/sync/pre/*
shell triggers finished successfully
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/uos20-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/system
removing: /var/lib/tftpboot/grub/system_link
removing: /var/lib/tftpboot/grub/grub.cfg
removing: /var/lib/tftpboot/grub/local_efi.cfg
removing: /var/lib/tftpboot/grub/local_legacy.cfg
removing: /var/lib/tftpboot/grub/local_powerpc-ieee1275.cfg
removing: /var/lib/tftpboot/grub/aarch64_menu_items.cfg
removing: /var/lib/tftpboot/grub/i386_menu_items.cfg
removing: /var/lib/tftpboot/grub/x86_64_menu_items.cfg
removing: /var/lib/tftpboot/grub/ppc_menu_items.cfg
removing: /var/lib/tftpboot/grub/ppc64_menu_items.cfg
removing: /var/lib/tftpboot/grub/ppc64le_menu_items.cfg
removing: /var/lib/tftpboot/grub/loongarch64_menu_items.cfg
removing: /var/lib/tftpboot/grub/amd64_menu_items.cfg
removing: /var/lib/tftpboot/grub/ppc64el_menu_items.cfg
removing: /var/lib/tftpboot/grub/ia64_menu_items.cfg
removing: /var/lib/tftpboot/grub/s390_menu_items.cfg
removing: /var/lib/tftpboot/grub/s390x_menu_items.cfg
removing: /var/lib/tftpboot/grub/i586_menu_items.cfg
removing: /var/lib/tftpboot/images/uos20-x86_64
copying bootloaders
running: ['rsync', '-rpt', '--copy-links', '--exclude=.cobbler_postun_cleanup', '/var/lib/cobbler/loaders/', '/var/lib/tftpboot']
received on stdout: 
received on stderr: 
running: ['rsync', '-rpt', '--copy-links', '--exclude=README.grubconfig', '/var/lib/cobbler/grub_config/', '/var/lib/tftpboot']
received on stdout: 
received on stderr: 
copying distros to tftpboot
copying files for distro: uos20-x86_64
trying hardlink /var/www/cobbler/distro_mirror/uos20-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/uos20-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/uos20-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/uos20-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: uos20-x86_64
trying hardlink /var/www/cobbler/distro_mirror/uos20-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/uos20-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/uos20-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/uos20-x86_64/initrd.img
Writing template files for uos20-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
processing boot_files for distro: uos20-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/*
shell triggers finished successfully
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running python trigger cobbler.modules.managers.genders
running shell triggers from /var/lib/cobbler/triggers/change/*
shell triggers finished successfully
*** TASK COMPLETE ***

26.为避免发生未知问题,先把服务端所有服务重启
[root@cobbler ~]# systemctl restart httpd cobblerd
[root@cobbler ~]# systemctl status xinetd
● xinetd.service - Xinetd A Powerful Replacement For Inetd
   Loaded: loaded (/usr/lib/systemd/system/xinetd.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:xinetd
           man:xinetd.conf
           man:xinetd.log
[root@cobbler ~]# systemctl enable --now xinetd
[root@cobbler ~]# systemctl status xinetd
● xinetd.service - Xinetd A Powerful Replacement For Inetd
   Loaded: loaded (/usr/lib/systemd/system/xinetd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2023-12-25 14:46:11 CST; 2s ago
     Docs: man:xinetd
           man:xinetd.conf
           man:xinetd.log
  Process: 274806 ExecStart=/usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid (code=exited, status=0/SUCCESS)
 Main PID: 274807 (xinetd)
    Tasks: 1
   Memory: 828.0K
   CGroup: /system.slice/xinetd.service
           └─274807 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
[root@cobbler ~]# ss -antl
State          Recv-Q         Send-Q                 Local Address:Port                  Peer Address:Port        Process        
LISTEN         0              128                          0.0.0.0:22                         0.0.0.0:*                          
LISTEN         0              5                          127.0.0.1:631                        0.0.0.0:*                          
LISTEN         0              5                          127.0.0.1:25151                      0.0.0.0:*                          
LISTEN         0              5                            0.0.0.0:873                        0.0.0.0:*                          
LISTEN         0              511                                *:80                               *:*                          
LISTEN         0              128                             [::]:22                            [::]:*                          
LISTEN         0              5                              [::1]:631                           [::]:*                          
LISTEN         0              511                                *:443                              *:*                          
LISTEN         0              5                               [::]:873                           [::]:*                          

3. 客户端安装(内存和cpu可以多个点,以免后面出错)

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

//解决方案
[root@cobbler ~]# cd /var/lib/tftpboot/
[root@cobbler tftpboot]# ls
boot              COPYING.yaboot  grub      grub-x86_64.efi  images   menu.c32  pxelinux.0    README  yaboot
COPYING.syslinux  etc             grub.cfg  grub-x86.efi     images2  ppc       pxelinux.cfg  s390x

[root@cobbler ~]# vim /etc/cobbler/dhcp.template 
subnet 192.168.116.0 netmask 255.255.255.0 {
     option routers             192.168.116.146;
     option domain-name-servers 192.168.116.2;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.116.100 192.168.116.200;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
     class "pxeclients" {                //这里的其余的行可以删除吧filename这一行中的grup.0改为pxelinux.0
          match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
          filename "pxelinux.0";
          
     }
}

在这里插入图片描述

//解决方案,不用同步
[root@cobbler ~]# cd /var/lib/tftpboot/
[root@cobbler tftpboot]# ls
boot              COPYING.yaboot  grub      grub-x86_64.efi  images   menu.c32  pxelinux.0    README  yaboot
COPYING.syslinux  etc             grub.cfg  grub-x86.efi     images2  ppc       pxelinux.cfg  s390x
[root@cobbler tftpboot]# mv menu.c32  pxelinux.0 /opt
[root@cobbler tftpboot]# ls /usr/share/syslinux
altmbr.bin    cpuidtest.c32  gfxboot.c32   ifplop.c32          ldlinux.c32   mboot.c32     prdhcp.c32      syslinux.com
altmbr_c.bin  debug.c32      gptmbr.bin    isohdpfx.bin        lfs.c32       mbr.bin       pwd.c32         syslinux.exe
altmbr_f.bin  dhcp.c32       gptmbr_c.bin  isohdpfx_c.bin      libcom32.c32  mbr_c.bin     pxechn.c32      vesa.c32
cat.c32       diag           gptmbr_f.bin  isohdpfx_f.bin      libgpl.c32    mbr_f.bin     pxelinux.0      vesainfo.c32
chain.c32     dir.c32        gpxecmd.c32   isohdppx.bin        liblua.c32    memdisk       reboot.c32      vesamenu.c32
cmd.c32       disk.c32       hdt.c32       isohdppx_c.bin      libmenu.c32   meminfo.c32   rosh.c32        vpdtest.c32
cmenu.c32     dmi.c32        hexdump.c32   isohdppx_f.bin      libutil.c32   menu.c32      sanboot.c32     whichsys.c32
config.c32    dmitest.c32    host.c32      isolinux.bin        linux.c32     pci.c32       sdi.c32         zzjson.c32
cptime.c32    dosutil        ifcpu64.c32   isolinux-debug.bin  lpxelinux.0   pcitest.c32   sysdump.c32
cpu.c32       elf.c32        ifcpu.c32     kbdmap.c32          ls.c32        pmload.c32    syslinux64.exe
cpuid.c32     ethersel.c32   ifmemdsk.c32  kontron_wdt.c32     lua.c32       poweroff.c32  syslinux.c32
[root@cobbler tftpboot]# cp /usr/share/syslinux/menu.c32 .
[root@cobbler tftpboot]# cp /usr/share/syslinux/pxelinux.0 .
[root@cobbler tftpboot]# ls
boot              COPYING.yaboot  grub      grub-x86_64.efi  images   menu.c32  pxelinux.0    README  yaboot
COPYING.syslinux  etc             grub.cfg  grub-x86.efi     images2  ppc       pxelinux.cfg  s390x
[root@cobbler tftpboot]# ll /usr/share/syslinux/menu.c32 /opt/menu.c32 
-rw-r--r-- 1 root root  9379 1225 14:07 /opt/menu.c32
-rw-r--r-- 1 root root 26276  315  2023 /usr/share/syslinux/menu.c32
[root@cobbler tftpboot]# ll /usr/share/syslinux/pxelinux.0 /opt/pxelinux.0 
-rw-r--r-- 1 root root  9379 1225 14:07 /opt/pxelinux.0
-rw-r--r-- 1 root root 42373  315  2023 /usr/share/syslinux/pxelinux.0

在这里插入图片描述

//解决方案
[root@cobbler tftpboot]# ls /usr/share/syslinux
altmbr.bin    cpuidtest.c32  gfxboot.c32   ifplop.c32          ldlinux.c32   mboot.c32     prdhcp.c32      syslinux.com
altmbr_c.bin  debug.c32      gptmbr.bin    isohdpfx.bin        lfs.c32       mbr.bin       pwd.c32         syslinux.exe
altmbr_f.bin  dhcp.c32       gptmbr_c.bin  isohdpfx_c.bin      libcom32.c32  mbr_c.bin     pxechn.c32      vesa.c32
cat.c32       diag           gptmbr_f.bin  isohdpfx_f.bin      libgpl.c32    mbr_f.bin     pxelinux.0      vesainfo.c32
chain.c32     dir.c32        gpxecmd.c32   isohdppx.bin        liblua.c32    memdisk       reboot.c32      vesamenu.c32
cmd.c32       disk.c32       hdt.c32       isohdppx_c.bin      libmenu.c32   meminfo.c32   rosh.c32        vpdtest.c32
cmenu.c32     dmi.c32        hexdump.c32   isohdppx_f.bin      libutil.c32   menu.c32      sanboot.c32     whichsys.c32
config.c32    dmitest.c32    host.c32      isolinux.bin        linux.c32     pci.c32       sdi.c32         zzjson.c32
cptime.c32    dosutil        ifcpu64.c32   isolinux-debug.bin  lpxelinux.0   pcitest.c32   sysdump.c32
cpu.c32       elf.c32        ifcpu.c32     kbdmap.c32          ls.c32        pmload.c32    syslinux64.exe
cpuid.c32     ethersel.c32   ifmemdsk.c32  kontron_wdt.c32     lua.c32       poweroff.c32  syslinux.c32
[root@cobbler tftpboot]# cp /usr/share/syslinux/ldlinux.c32 .
[root@cobbler tftpboot]# pwd
/var/lib/tftpboot
[root@cobbler tftpboot]# ls
boot              COPYING.yaboot  grub      grub-x86_64.efi  images   ldlinux.c32  ppc         pxelinux.cfg  s390x
COPYING.syslinux  etc             grub.cfg  grub-x86.efi     images2  menu.c32     pxelinux.0  README        yaboot

在这里插入图片描述

//解决方案
[root@cobbler tftpboot]# pwd
/var/lib/tftpboot
[root@cobbler tftpboot]# ls /usr/share/syslinux
altmbr.bin    cpuidtest.c32  gfxboot.c32   ifplop.c32          ldlinux.c32   mboot.c32     prdhcp.c32      syslinux.com
altmbr_c.bin  debug.c32      gptmbr.bin    isohdpfx.bin        lfs.c32       mbr.bin       pwd.c32         syslinux.exe
altmbr_f.bin  dhcp.c32       gptmbr_c.bin  isohdpfx_c.bin      libcom32.c32  mbr_c.bin     pxechn.c32      vesa.c32
cat.c32       diag           gptmbr_f.bin  isohdpfx_f.bin      libgpl.c32    mbr_f.bin     pxelinux.0      vesainfo.c32
chain.c32     dir.c32        gpxecmd.c32   isohdppx.bin        liblua.c32    memdisk       reboot.c32      vesamenu.c32
cmd.c32       disk.c32       hdt.c32       isohdppx_c.bin      libmenu.c32   meminfo.c32   rosh.c32        vpdtest.c32
cmenu.c32     dmi.c32        hexdump.c32   isohdppx_f.bin      libutil.c32   menu.c32      sanboot.c32     whichsys.c32
config.c32    dmitest.c32    host.c32      isolinux.bin        linux.c32     pci.c32       sdi.c32         zzjson.c32
cptime.c32    dosutil        ifcpu64.c32   isolinux-debug.bin  lpxelinux.0   pcitest.c32   sysdump.c32
cpu.c32       elf.c32        ifcpu.c32     kbdmap.c32          ls.c32        pmload.c32    syslinux64.exe
cpuid.c32     ethersel.c32   ifmemdsk.c32  kontron_wdt.c32     lua.c32       poweroff.c32  syslinux.c32
[root@cobbler tftpboot]# cp /usr/share/syslinux/libutil.c32 .
[root@cobbler tftpboot]# ls
boot              COPYING.yaboot  grub      grub-x86_64.efi  images   ldlinux.c32  menu.c32  pxelinux.0    README  yaboot
COPYING.syslinux  etc             grub.cfg  grub-x86.efi     images2  libutil.c32  ppc       pxelinux.cfg  s390x

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

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

//解决方案
[root@cobbler ~]# vim /var/lib/cobbler/templates/uos20.ks 
[root@cobbler ~]# cat /var/lib/cobbler/templates/uos20.ks 
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.116.146/cobbler/links/uos20-x86_64/
$yum_repo_stanza                          //删除这一行
reboot

rootpw --iscrypted $6$WqdLuLnm2W8M98bv$XKfgxxCeviKNg4y/pj6bT2/b/WIT.91YyWcb3930BgVUiuHXuFtqQXLP3isSdfz2mZpSQCDqO.Ude3uL9pz370

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

在这里插入图片描述

4.cobbler服务端部署centos7

接着上面的基础上部署

在这里插入图片描述

1.导入centos7镜像
[root@cobbler ~]# mount /dev/cdrom /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@cobbler ~]# ls /mnt
CentOS_BuildTag  EULA  images    LiveOS    repodata              RPM-GPG-KEY-CentOS-Testing-7
EFI              GPL   isolinux  Packages  RPM-GPG-KEY-CentOS-7  TRANS.TBL

[root@cobbler ~]# cobbler import --path=/mnt --name=centos-7 --arch=x86_64
task started: 2023-12-25_153833_import
task started (id=Media import, time=Mon Dec 25 15:38:33 2023)
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
Found a candidate signature: breed=uniontech, version=uniontech
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a candidate signature: breed=redhat, version=rhel8
Found a matching signature: breed=redhat, version=rhel8
Adding distros from path /var/www/cobbler/distro_mirror/centos-7-x86_64:
creating new distro: centos-7-x86_64
trying symlink: /var/www/cobbler/distro_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/distro_mirror/centos-7-x86_64 for centos-7-x86_64
processing repo at : /var/www/cobbler/distro_mirror/centos-7-x86_64
need to process repo/comps: /var/www/cobbler/distro_mirror/centos-7-x86_64
looking for /var/www/cobbler/distro_mirror/centos-7-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/distro_mirror/centos-7-x86_64/repodata
*** TASK COMPLETE ***
2.查看cobbler镜像列表
[root@cobbler ~]# cobbler list
distros:
   centos-7-x86_64
   uos20-x86_64

profiles:
   centos-7-x86_64
   uos20-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

3.创建kickstarts自动安装脚本
[root@cobbler ~]# cd /var/lib/cobbler/templates/
[root@cobbler templates]# ls
default.ks    install_profiles  pxerescue.ks         sample_esxi5.ks  sample_legacy.ks  uos20.ks
esxi4-ks.cfg  legacy.ks         sample_autoyast.xml  sample_esxi6.ks  sample_old.seed
esxi5-ks.cfg  powerkvm.ks       sample_esxi4.ks      sample.ks        sample.seed
[root@cobbler templates]# cp uos20.ks centos-7.ks
[root@cobbler templates]# ls
centos-7.ks   esxi5-ks.cfg      powerkvm.ks          sample_esxi4.ks  sample.ks         sample.seed
default.ks    install_profiles  pxerescue.ks         sample_esxi5.ks  sample_legacy.ks  uos20.ks
esxi4-ks.cfg  legacy.ks         sample_autoyast.xml  sample_esxi6.ks  sample_old.seed
[root@cobbler templates]# vim centos-7.ks
[root@cobbler templates]# cat centos-7.ks
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.116.146/cobbler/links/centos-7-x86_64/
$yum_repo_stanza
reboot

rootpw --iscrypted $6$WqdLuLnm2W8M98bv$XKfgxxCeviKNg4y/pj6bT2/b/WIT.91YyWcb3930BgVUiuHXuFtqQXLP3isSdfz2mZpSQCDqO.Ude3uL9pz370

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

4.检查ks文件语法是否有误
[root@cobbler ~]# cobbler --help
usage
=====
cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ... 
        [add|edit|copy|get-autoinstall*|list|remove|rename|report] [options|--help]
cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validate-autoinstalls|version|signature|get-loaders|hardlink> [options|--help]
[root@cobbler ~]# cobbler validate-autoinstalls
task started: 2023-12-25_154550_validate_autoinstall_files
task started (id=Automated installation files validation, time=Mon Dec 25 15:45:50 2023)
running python triggers from /var/lib/cobbler/triggers/task/validate_autoinstall_files/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/validate_autoinstall_files/pre/*
shell triggers finished successfully
*** TASK COMPLETE ***

5.查看当前cobbler有哪些配置文件
[root@cobbler ~]# cobbler profile list
   centos-7-x86_64
   uos20-x86_64

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

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

8.检查当前系统cobbler配置文件信息
[root@cobbler ~]# cobbler profile report
Name                           : uos20-x86_64
Automatic Installation Template : uos20.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : uos20-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
DHCP Filename Override         : <<inherit>>
Kernel Options                 : {'net.ifnames': '0', 'biosdevname': '0'}
Kernel Options (Post Install)  : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Next Server Override           : <<inherit>>
Owners                         : ['admin']
Parent Profile                 : 
Proxy                          : 
Red Hat Management Key         : <<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
Automatic Installation Template : centos-7.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos-7-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
DHCP Filename Override         : <<inherit>>
Kernel Options                 : {'net.ifnames': '0', 'biosdevname': '0'}
Kernel Options (Post Install)  : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Next Server Override           : <<inherit>>
Owners                         : ['admin']
Parent Profile                 : 
Proxy                          : 
Red Hat Management Key         : <<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

9.为避免发生未知问题,先把服务端所有服务重启
[root@cobbler ~]# systemctl restart xinetd httpd cobblerd
[root@cobbler ~]# ss -antl
State          Recv-Q         Send-Q                 Local Address:Port                  Peer Address:Port        Process        
LISTEN         0              5                            0.0.0.0:873                        0.0.0.0:*                          
LISTEN         0              128                          0.0.0.0:22                         0.0.0.0:*                          
LISTEN         0              5                          127.0.0.1:631                        0.0.0.0:*                          
LISTEN         0              5                          127.0.0.1:25151                      0.0.0.0:*                          
LISTEN         0              5                               [::]:873                           [::]:*                          
LISTEN         0              511                                *:80                               *:*                          
LISTEN         0              128                             [::]:22                            [::]:*                          
LISTEN         0              5                              [::1]:631                           [::]:*                          
LISTEN         0              511                                *:443                              *:*                         

5.客户端安装

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

6.cobbler服务端部署centos8

在这里插入图片描述

1.导入centos8镜像
[root@cobbler ~]# mount /dev/cdrom /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@cobbler ~]# ls /mnt/
AppStream  BaseOS  EFI  images  isolinux  LICENSE  media.repo  TRANS.TBL
[root@cobbler ~]# cobbler --help
usage
=====
cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ... 
        [add|edit|copy|get-autoinstall*|list|remove|rename|report] [options|--help]
cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validate-autoinstalls|version|signature|get-loaders|hardlink> [options|--help]
[root@cobbler ~]# cobbler signature update
task started: 2023-12-25_171337_sigupdate
task started (id=Updating Signatures, time=Mon Dec 25 17:13:37 2023)
running python triggers from /var/lib/cobbler/triggers/task/sigupdate/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/sigupdate/pre/*
shell triggers finished successfully
Successfully got file from https://cobbler.github.io/signatures/3.0.x/latest.json
*** TASK COMPLETE ***
[root@cobbler ~]# cobbler import --path=/mnt --name=centos-8 --arch=x86_64
task started: 2023-12-25_210336_import
task started (id=Media import, time=Mon Dec 25 21:03:36 2023)
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
Found a candidate signature: breed=redhat, version=rhel8
Found a matching signature: breed=redhat, version=rhel8
Adding distros from path /var/www/cobbler/distro_mirror/centos-8-x86_64:
creating new distro: centos-8-x86_64
trying symlink: /var/www/cobbler/distro_mirror/centos-8-x86_64 -> /var/www/cobbler/links/centos-8-x86_64
creating new profile: centos-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/distro_mirror/centos-8-x86_64 for centos-8-x86_64
processing repo at : /var/www/cobbler/distro_mirror/centos-8-x86_64/AppStream
need to process repo/comps: /var/www/cobbler/distro_mirror/centos-8-x86_64/AppStream
looking for /var/www/cobbler/distro_mirror/centos-8-x86_64/AppStream/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/distro_mirror/centos-8-x86_64/AppStream/repodata
processing repo at : /var/www/cobbler/distro_mirror/centos-8-x86_64/BaseOS
need to process repo/comps: /var/www/cobbler/distro_mirror/centos-8-x86_64/BaseOS
looking for /var/www/cobbler/distro_mirror/centos-8-x86_64/BaseOS/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/distro_mirror/centos-8-x86_64/BaseOS/repodata
*** TASK COMPLETE ***

2.查看cobbler镜像列表
[root@cobbler ~]# cobbler list
distros:
   centos-7-x86_64
   centos-8-x86_64
   uos20-x86_64

profiles:
   centos-7-x86_64
   centos-8-x86_64
   uos20-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

3.创建kickstarts自动安装脚本
[root@cobbler ~]# cd /var/lib/cobbler/
[root@cobbler cobbler]# ls
collections  distro_signatures.json  grub_config  loaders  lock  scripts  snippets  templates  triggers  web.ss  webui_sessions
[root@cobbler cobbler]# cd templates/
[root@cobbler templates]# ls
centos-7.ks  esxi4-ks.cfg  install_profiles  powerkvm.ks   sample_autoyast.xml  sample_esxi5.ks  sample.ks         sample_old.seed  uos20.ks
default.ks   esxi5-ks.cfg  legacy.ks         pxerescue.ks  sample_esxi4.ks      sample_esxi6.ks  sample_legacy.ks  sample.seed
[root@cobbler templates]# cp uos20.ks centos-8.ks
[root@cobbler templates]# vim centos-8.ks
[root@cobbler templates]# cat centos-8.ks
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.116.146/cobbler/links/centos-8-x86_64/
$yum_repo_stanza
reboot

rootpw --iscrypted $6$WqdLuLnm2W8M98bv$XKfgxxCeviKNg4y/pj6bT2/b/WIT.91YyWcb3930BgVUiuHXuFtqQXLP3isSdfz2mZpSQCDqO.Ude3uL9pz370

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

4.检查ks文件语法是否有误
[root@cobbler ~]# cobbler --help
usage
=====
cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ... 
        [add|edit|copy|get-autoinstall*|list|remove|rename|report] [options|--help]
cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validate-autoinstalls|version|signature|get-loaders|hardlink> [options|--help]
[root@cobbler ~]# cobbler validate-autoinstalls
task started: 2023-12-25_172657_validate_autoinstall_files
task started (id=Automated installation files validation, time=Mon Dec 25 17:26:57 2023)
running python triggers from /var/lib/cobbler/triggers/task/validate_autoinstall_files/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/validate_autoinstall_files/pre/*
shell triggers finished successfully
*** TASK COMPLETE ***

5.查看当前cobbler有哪些配置文件
[root@cobbler ~]# cobbler profile list
   centos-7-x86_64
   centos-8-x86_64
   uos20-x86_64

6.修改profile,将我们新建的ks文件设为默认的kickstarts安装文件
[root@cobbler ~]# cobbler profile edit --name centos-8-x86_64 --autoinstall=centos-8.ks

7.配置网卡名称为传统网卡名称eth0
[root@cobbler ~]# cobbler profile edit --name centos-8-x86_64 --kernel-options='net.ifnames=0 biosdevname=0'

8.检查当前系统cobbler配置文件信息
[root@cobbler ~]# cobbler profile report
Name                           : uos20-x86_64
Automatic Installation Template : uos20.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : uos20-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
DHCP Filename Override         : <<inherit>>
Kernel Options                 : {'net.ifnames': '0', 'biosdevname': '0'}
Kernel Options (Post Install)  : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Next Server Override           : <<inherit>>
Owners                         : ['admin']
Parent Profile                 : 
Proxy                          : 
Red Hat Management Key         : <<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
Automatic Installation Template : centos-7.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos-7-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
DHCP Filename Override         : <<inherit>>
Kernel Options                 : {'net.ifnames': '0', 'biosdevname': '0'}
Kernel Options (Post Install)  : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Next Server Override           : <<inherit>>
Owners                         : ['admin']
Parent Profile                 : 
Proxy                          : 
Red Hat Management Key         : <<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-8-x86_64
Automatic Installation Template : centos-8.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos-8-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
DHCP Filename Override         : <<inherit>>
Kernel Options                 : {'net.ifnames': '0', 'biosdevname': '0'}
Kernel Options (Post Install)  : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Next Server Override           : <<inherit>>
Owners                         : ['admin']
Parent Profile                 : 
Proxy                          : 
Red Hat Management Key         : <<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

7.客户端安装

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

8.cobbler服务端部署rockylinux9

1.导入rockylinux9镜像
[root@cobbler ~]# mount /dev/cdrom /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@cobbler ~]# ls /mnt
AppStream  BaseOS  EFI  images  isolinux  LICENSE  media.repo
[root@cobbler ~]# cobbler --help
usage
=====
cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ... 
        [add|edit|copy|get-autoinstall*|list|remove|rename|report] [options|--help]
cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validate-autoinstalls|version|signature|get-loaders|hardlink> [options|--help]
[root@cobbler ~]# cobbler signature update
task started: 2023-12-25_173814_sigupdate
task started (id=Updating Signatures, time=Mon Dec 25 17:38:14 2023)
running python triggers from /var/lib/cobbler/triggers/task/sigupdate/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/sigupdate/pre/*
shell triggers finished successfully
Successfully got file from https://cobbler.github.io/signatures/3.0.x/latest.json
*** TASK COMPLETE ***
[root@cobbler ~]# mount /dev/cdrom /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@cobbler ~]# cobbler signature update
task started: 2023-12-25_211938_sigupdate
task started (id=Updating Signatures, time=Mon Dec 25 21:19:38 2023)
running python triggers from /var/lib/cobbler/triggers/task/sigupdate/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/sigupdate/pre/*
shell triggers finished successfully
Successfully got file from https://cobbler.github.io/signatures/3.0.x/latest.json
*** TASK COMPLETE ***
[root@cobbler ~]# cobbler import --path=/mnt --name=rockylinux9 --arch=x86_64
task started: 2023-12-25_212031_import
task started (id=Media import, time=Mon Dec 25 21:20:31 2023)
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
Found a candidate signature: breed=redhat, version=rhel8
Found a candidate signature: breed=redhat, version=rhel9
Found a matching signature: breed=redhat, version=rhel9
Adding distros from path /var/www/cobbler/distro_mirror/rockylinux9-x86_64:
creating new distro: rockylinux9-x86_64
trying symlink: /var/www/cobbler/distro_mirror/rockylinux9-x86_64 -> /var/www/cobbler/links/rockylinux9-x86_64
creating new profile: rockylinux9-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/distro_mirror/rockylinux9-x86_64 for rockylinux9-x86_64
processing repo at : /var/www/cobbler/distro_mirror/rockylinux9-x86_64/AppStream
directory /var/www/cobbler/distro_mirror/rockylinux9-x86_64/AppStream is missing xml comps file, skipping
processing repo at : /var/www/cobbler/distro_mirror/rockylinux9-x86_64/BaseOS
directory /var/www/cobbler/distro_mirror/rockylinux9-x86_64/BaseOS is missing xml comps file, skipping
*** TASK COMPLETE ***

2.查看cobbler镜像列表
[root@cobbler ~]# cobbler list
distros:
   centos-8-x86_64
   rockylinux9-x86_64
   uos20-x86_64

profiles:
   centos-8-x86_64
   rockylinux9-x86_64
   uos20-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

3.创建kickstarts自动安装脚本
[root@cobbler ~]# cd /var/lib/cobbler/templates/
[root@cobbler templates]# ls
centos-8.ks  esxi4-ks.cfg  install_profiles  powerkvm.ks   sample_autoyast.xml  sample_esxi5.ks  sample.ks         sample_old.seed  uos20.ks
default.ks   esxi5-ks.cfg  legacy.ks         pxerescue.ks  sample_esxi4.ks      sample_esxi6.ks  sample_legacy.ks  sample.seed
[root@cobbler templates]# cp uos20.ks rockylinux9.ks
[root@cobbler templates]# vim rockylinux9.ks 
[root@cobbler templates]# cat rockylinux9.ks 
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.116.147/cobbler/links/rockylinux9-x86_64/
reboot


rootpw --iscrypted $6$cbbyBQuKbE03l1D.$.0dMYU5cLAbG7w.wwLdJOreYDXusceBHnUUUHufkY25OZzF8mt7H7YzRWVYckC13uQB88ad09JQ93CsUabHJd0

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

%packages
@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

4.检查ks文件语法是否有误
[root@cobbler ~]# cobbler --help
usage
=====
cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ... 
        [add|edit|copy|get-autoinstall*|list|remove|rename|report] [options|--help]
cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validate-autoinstalls|version|signature|get-loaders|hardlink> [options|--help]
[root@cobbler ~]# cobbler validate-autoinstalls
task started: 2023-12-25_212700_validate_autoinstall_files
task started (id=Automated installation files validation, time=Mon Dec 25 21:27:00 2023)
running python triggers from /var/lib/cobbler/triggers/task/validate_autoinstall_files/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/validate_autoinstall_files/pre/*
shell triggers finished successfully
*** TASK COMPLETE ***

5.查看当前cobbler有哪些配置文件
[root@cobbler ~]# cobbler profile list
   centos-8-x86_64
   rockylinux9-x86_64
   uos20-x86_64

6.修改profile,将我们新建的ks文件设为默认的kickstarts安装文件
[root@cobbler ~]# cobbler profile edit --name rockylinux9-x86_64 --autoinstall=rockylinux9.ks

7.配置网卡名称为传统网卡名称eth0
[root@cobbler ~]# cobbler profile edit --name rockylinux9-x86_64 --kernel-options='net.ifnames=0 biosdevname=0'

8.检查当前系统cobbler配置文件信息
[root@cobbler ~]# cobbler profile report
Name                           : uos20-x86_64
Automatic Installation Template : uos20.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : uos20-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
DHCP Filename Override         : <<inherit>>
Kernel Options                 : {'net.ifnames': '0', 'biosdevname': '0'}
Kernel Options (Post Install)  : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Next Server Override           : <<inherit>>
Owners                         : ['admin']
Parent Profile                 : 
Proxy                          : 
Red Hat Management Key         : <<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-8-x86_64
Automatic Installation Template : centos-8.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos-8-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
DHCP Filename Override         : <<inherit>>
Kernel Options                 : {'net.ifnames': '0', 'biosdevname': '0'}
Kernel Options (Post Install)  : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Next Server Override           : <<inherit>>
Owners                         : ['admin']
Parent Profile                 : 
Proxy                          : 
Red Hat Management Key         : <<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                           : rockylinux9-x86_64
Automatic Installation Template : rockylinux9.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : rockylinux9-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
DHCP Filename Override         : <<inherit>>
Kernel Options                 : {'net.ifnames': '0', 'biosdevname': '0'}
Kernel Options (Post Install)  : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Next Server Override           : <<inherit>>
Owners                         : ['admin']
Parent Profile                 : 
Proxy                          : 
Red Hat Management Key         : <<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

9.客户端安装

修改参数

1.第一个位置(这个位置可以忽略)
[root@cobbler ~]# cd /var/lib/tftpboot/
[root@cobbler tftpboot]# ls
boot              COPYING.yaboot  grub      grub-x86_64.efi  images   ldlinux.c32  menu.c32  pxelinux.0    README  yaboot
COPYING.syslinux  etc             grub.cfg  grub-x86.efi     images2  libutil.c32  ppc       pxelinux.cfg  s390x
[root@cobbler tftpboot]# ls grub
aarch64_menu_items.cfg  arm_menu_items.cfg   ia64_menu_items.cfg  local_powerpc-ieee1275.cfg  ppc64_menu_items.cfg  system
amd64_menu_items.cfg    grub.cfg             images               loongarch64_menu_items.cfg  ppc_menu_items.cfg    system_link
ARM64_menu_items.cfg    i386_menu_items.cfg  local_efi.cfg        ppc64el_menu_items.cfg      s390_menu_items.cfg   x86_64_menu_items.cfg
armhfp_menu_items.cfg   i586_menu_items.cfg  local_legacy.cfg     ppc64le_menu_items.cfg      s390x_menu_items.cfg  x86_menu_items.cfg
[root@cobbler tftpboot]# vim grub/x86_64_menu_items.cfg      //找到rockylinux9的在ks前面加inst
       append initrd=/images/rockylinux9-x86_64/initrd.img net.ifnames=0 biosdevname=0  inst.kssendmac inst.ks=http://192.168.116.147/cblr/svc/op/autoinstall/profile/rockylinux9-x86_64

2.第二个位置
[root@cobbler tftpboot]# pwd
/var/lib/tftpboot
[root@cobbler tftpboot]# ls
boot              COPYING.yaboot  grub      grub-x86_64.efi  images   ldlinux.c32  menu.c32  pxelinux.0    README  yaboot
COPYING.syslinux  etc             grub.cfg  grub-x86.efi     images2  libutil.c32  ppc       pxelinux.cfg  s390x
[root@cobbler tftpboot]# ls pxelinux.cfg/
default
[root@cobbler tftpboot]# vim pxelinux.cfg/default 
[root@cobbler tftpboot]# cat pxelinux.cfg/default     //找到rockylinux9,ks前面加上inst
        append initrd=/images/rockylinux9-x86_64/initrd.img net.ifnames=0 biosdevname=0  inst.kssendmac inst.ks=http://192.168.116.147/cblr/svc/op/autoinstall/profile/rockylinux9-x86_64

3.第三个位置
[root@cobbler tftpboot]# find / -name tftp*.py
/usr/sbin/tftpd.py
/usr/lib/python3.6/site-packages/cobbler/modules/managers/tftpd_py.py
/usr/lib/python3.6/site-packages/cobbler/tftpgen.py
[root@cobbler tftpboot]# ls /usr/lib/python3.6/site-packages/cobbler
actions                 cexceptions.py       cobblerd.py          grub.py           modules           resource.py    templar.py       validate.py
api.py                  cli.py               configgen.py         __init__.py       power_manager.py  serializer.py  template_api.py  web
autoinstallgen.py       clogger.py           download_manager.py  items             __pycache__       services.py    tftpgen.py       yumgen.py
autoinstall_manager.py  cobbler_collections  field_info.py        module_loader.py  remote.py         settings.py    utils.py
//用/sendmac找,然后在ks前面加上inst
[root@cobbler tftpboot]# vim /usr/lib/python3.6/site-packages/cobbler/tftpgen.py 
                append_line += " inst.kssendmac"
                append_line = "%s inst.ks=%s" % (append_line, autoinstall_path)
                gpxe = blended["enable_gpxe"]

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

10.定制安装

定制安装步骤:

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

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/471440.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

HarmonyOS NEXT应用开发之Navigation实现多设备适配案例

介绍 在应用开发时&#xff0c;一个应用需要适配多终端的设备&#xff0c;使用Navigation的mode属性来实现一套代码&#xff0c;多终端适配。 效果图预览 使用说明 将程序运行在折叠屏手机或者平板上观看适配效果。 实现思路 本例涉及的关键特性和实现方案如下&#xff1a…

关于 hbuild 真机调试:

当手机插上数据线&#xff0c;刷新&#xff0c;依旧找不到手机列表时&#xff0c;点击“故障排查指南” 参考官网&#xff1a;https://uniapp.dcloud.net.cn/tutorial/run/run-app-faq.html 操作步骤&#xff1a; 1、在手机设置中打开开发者模式&#xff08;根据不同手机打开…

postman进阶功能学习,别再简单的发请求了!

1.Postman数据驱动 想要批量执行接口用例&#xff0c;我们一般会将对应的接口用例放在同一个Collection中&#xff0c;然后再通过Runner批量执行。这种方式适用于接口用例参数固定的情况下&#xff0c;但也存在另一个问题&#xff0c;如果每次运行时&#xff0c;接口参数都在变…

易百纳诚挚邀请,Meetup易百纳技术社区工程师见面会,与您不见不散!

2024年3月29日(周五)&#xff0c;易百纳将携手openEuler社区&#xff0c;南京邮电大学共同举办一场openEuler Embedded Meetup会议。 本次交流活动将邀请多位业内专家围绕嵌入式前沿技术、应用案例、创新方向、芯片开发板优秀实践几个方面进行分享&#xff0c;在活动上还将成立…

在Arm 虚拟硬件(AVH)部署深度学习OCR算法

AI算法的嵌入式部署 AI算法在独立的设备上运行其实就是行业内的嵌入式AI的概念, 大致过程如下: 开发AI模型, 2.对数据集进行处理, 3.训练AI模型并验证效果, 4.转成ONNX格式(ONNX:万金油中间格式,给模型优化和部署带来了更多可能性)或者借助libtorch或者TensorFlow来部署C++版…

Java面试题总结18之springcloud四种分布式事务解决方案

XA规范&#xff1a;分布式事务规范&#xff0c;规定了分布式事务模型 四个角色&#xff1a;事务管理器&#xff08;协调者TM&#xff09;&#xff0c;资源管理器&#xff08;参与者RM&#xff09;&#xff0c;应用程序AP&#xff0c;通信资源管理器CRM 全局事务&#xff1a;一…

螺栓拧紧扭矩测量的原理、方法和影响因素——SunTorque智能扭矩系统

智能扭矩系统-智能拧紧系统-扭矩自动控制系统-SunTorque 螺栓拧紧扭矩测量是确保螺栓连接紧固性和可靠性的重要环节。在工业生产中&#xff0c;螺栓连接广泛应用于各种设备和结构中&#xff0c;因此&#xff0c;对螺栓拧紧扭矩的准确测量和控制具有重要意义。本文将详细介绍螺…

【LeetCode: 173. 二叉搜索树迭代器 + dfs + 二叉搜索树】

&#x1f680; 算法题 &#x1f680; &#x1f332; 算法刷题专栏 | 面试必备算法 | 面试高频算法 &#x1f340; &#x1f332; 越难的东西,越要努力坚持&#xff0c;因为它具有很高的价值&#xff0c;算法就是这样✨ &#x1f332; 作者简介&#xff1a;硕风和炜&#xff0c;…

以题为例浅谈文件包含

什么叫做文件包含 文件包含函数加载的参数没有经过过滤或严格定义&#xff0c;可以被用户控制&#xff0c; 包含其他恶意文件&#xff0c;导致了执行非预期代码。 文件包含漏洞&#xff08;File Inclusion Vulnerability&#xff09;是一种常见的网络安全漏洞&#xff0c;它允…

springboot283图书商城管理系统

图书商城管理系统 摘 要 现代经济快节奏发展以及不断完善升级的信息化技术&#xff0c;让传统数据信息的管理升级为软件存储&#xff0c;归纳&#xff0c;集中处理数据信息的管理方式。本图书商城管理系统就是在这样的大环境下诞生&#xff0c;其可以帮助管理者在短时间内处理…

设计模式 模板方法模式

01.如果接到一个任务&#xff0c;要求设计不同型号的悍马车 02.设计一个悍马车的抽象类&#xff08;模具&#xff0c;车模&#xff09; public abstract class HummerModel {/** 首先&#xff0c;这个模型要能够被发动起来&#xff0c;别管是手摇发动&#xff0c;还是电力发动…

软件杯 深度学习 YOLO 实现车牌识别算法

文章目录 0 前言1 课题介绍2 算法简介2.1网络架构 3 数据准备4 模型训练5 实现效果5.1 图片识别效果5.2视频识别效果 6 部分关键代码7 最后 0 前言 &#x1f525; 优质竞赛项目系列&#xff0c;今天要分享的是 &#x1f6a9; 基于yolov5的深度学习车牌识别系统实现 该项目较…

YOLOv9改进策略:下采样涨点系列 | 一种新颖的基于 Haar 小波的下采样HWD,有效涨点系列

&#x1f4a1;&#x1f4a1;&#x1f4a1;本文独家改进&#xff1a;HWD的核心思想是应用Haar小波变换来降低特征图的空间分辨率&#xff0c;同时保留尽可能多的信息&#xff0c;与传统的下采样方法相比&#xff0c;有效降低信息不确定性。 &#x1f4a1;&#x1f4a1;&#x1…

如何进行PLCH1U-XP系列汇川PLC在线修改程序?

在工业自动化的世界里&#xff0c;可编程逻辑控制器&#xff08;PLC&#xff09;是生产线自动化的心脏。汇川PLCH1U-XP系列以其卓越的性能和广泛的应用场景&#xff0c;赢得了众多企业的青睐。然而&#xff0c;随着生产需求的不断变化&#xff0c;PLC程序也需要相应地调整。传统…

【Linux】基础 IO(动静态库)-- 详解

一、前言 为什么要使用别人的代码&#xff1f; 主要是为了提高程序开发的效率和程序的健壮性。 当别人把功能都实现了&#xff0c;然后我们再基于别人的代码去做二次开发&#xff0c;那么效率当然就提高了。其次&#xff0c;这里基于的别人当然不是随便找的一个人&#xff0c;…

matplotlib绘制统计特征图和分布特征图

文章目录 一、统计特征图绘制1.需求2.代码方法一方法二总结 二、分布特征图绘制1.需求2.代码 一、统计特征图绘制 1.需求 我现在有两个数据集Pdata和Cdata分别在DataFrame对象中&#xff0c;我现在想对这两个数据集进行统计特征分析&#xff0c;并用直方图展示出来。 2.代码…

在线预订酒店房源小程序源码系统平台版 带完整的安装代码包以及搭建教程

近年来&#xff0c;互联网技术的飞速发展推动了各行各业的数字化转型。酒店行业也不例外&#xff0c;传统的酒店预订方式已经无法满足现代旅客的需求。旅客期望能够随时随地通过手机或电脑进行酒店预订&#xff0c;并享受到个性化的服务体验。因此&#xff0c;开发一款功能齐全…

107 在携带请求体的情况下, hutool 将 get 请求转换为了 post 请求

前言 本问题主要是来自于同事 情况大致如下, 同样的代码 一个是测试用例, 一个是生产环境的应用, 访问同一个第三方服务, 参数什么的完全一致 但是 出现的问题就是 测试用例能够拿到正确的对方的响应, 但是 生产环境的应用 却是拿到的对方的报错 然后 我开始以为是 是否…

【进阶五】Python实现SDVRP(需求拆分)常见求解算法——离散粒子群算法(DPSO)

基于python语言&#xff0c;采用经典离散粒子群算法&#xff08;DPSO&#xff09;对 需求拆分车辆路径规划问题&#xff08;SDVRP&#xff09; 进行求解。 目录 往期优质资源1. 适用场景2. 代码调整3. 求解结果4. 代码片段参考 往期优质资源 经过一年多的创作&#xff0c;目前已…

邮箱与Email有何异同?如何正确使用它们?

邮箱与Email之间有何联系&#xff1f;如何正确区分邮箱和Email&#xff1f; 电子邮箱已成为我们日常生活和工作中不可或缺的一部分。而提到电子邮箱&#xff0c;很多人会自然而然地联想到“邮箱”这个词。那么&#xff0c;邮箱与Email之间究竟有哪些异同呢&#xff1f;让AokSe…