Cobbler自动化部署安装CentOS7

news2025/2/24 14:26:51

Cobbler介绍:

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

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

3)Cobbler是较早前的Kickstart的升级版本,优点是比较容易配置,还自带Web界面比较容易管理。

4)Cobbler内置了一个轻量级配置管理系统,但它也支持和其他配置管理系统集成,如Puppet。

Cobbler的配置结构基于一组注册的对象,每个对象表示一个与另一个实体相关联的实体。当一个对象指向另一个对象时,它就继承了被指向对象的数据,并可覆盖或添加更多特定信息。

发行版:表示一个操作系统。它承载了内核和initrd的信息,以及内核参数等其他数据。

配置文件:包含一个发型版,一个kickstart文件以及可能的存储库,还包括更多特定的内核参数等其他数据。

系统:表示要配给的机器。它还包括一个配置文件和一个镜像,IP地址和MAC地址,电源管理(地址、凭据、类型)以及更为专业的数据等信息。

镜像:可以替换一个保函不屑于此类别的文件的发型版对象(例如:无法分为内核和initrd的对象)。

Cobble集成的服务:

PXE服务支持

DHCP服务管理

DNS服务管理

电源管理

Kickstart服务支持

YUM仓库管理

TFTP

Apache

Cobbler的工作原理:

这个过程跟PXE和Kickstart的过程有点类似。

Server端
启动Cobbler服务
进行Cobbler错误检查,执行cobbler check命令
进行配置同步更新,执行cobbler sync命令
复制相关启动文件到TFTP目录中
启动DHCP服务,提供地址分配
DHCP服务分配IP地址
TFTP传输启动文件
Server端接收安装信息
Server端发送ISO镜像与Kickstart文件
Client端
客户端以PXE模式启动
客户端获取IP地址
通过TFTP服务器获取启动文件
进入Cobbler安装选择界面
根据配置信息准备安装系统
加载Kickstart文件
传输系统安装的其它文件
进行安装系统

 Cobbler安装:

说明:虚拟机网卡采用NAT模式或者仅主机模式,不要使用桥接模式,因为后面会搭建DHCP服务器,在同一个局域网多个DHCP服务器会引起冲突。VMware的NAT模式的DHCP服务也关闭,避免冲突。

环境准备:

关闭防火墙和Disabled SELINUX。

[root@vm1 network-scripts]# systemctl stop firewalld && systemctl disable firewalld
[root@vm1 network-scripts]#
[root@vm1 network-scripts]# sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
[root@vm1 network-scripts]#
[root@vm1 network-scripts]# getenforce
Disabled

 安装Cobbler:

安装epel源:

[root@vm1 network-scripts]# yum install -y epel-release

 安装cobbler以及cobbler-web、tftp-server、dhcp、xinetd软件:

yum install -y cobbler cobbler-web tftp-server dhcp xinetd httpd

启动cobbler和httpd,并设置开机自启动:

[root@vm1 network-scripts]# systemctl start httpd
[root@vm1 network-scripts]# systemctl start cobblerd
[root@vm1 network-scripts]# systemctl enable cobblerd
Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.
[root@vm1 network-scripts]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

查看安装后的文件:

[root@cobbler ~]# rpm -ql cobbler
/etc/cobbler                  # 配置文件目录
/etc/cobbler/settings         # cobbler主配置文件,这个文件是YAML格式,Cobbler是python写的程序。
/etc/cobbler/dhcp.template    # DHCP服务的配置模板
/etc/cobbler/tftpd.template   # tftp服务的配置模板
/etc/cobbler/rsync.template   # rsync服务的配置模板
/etc/cobbler/iso              # iso模板配置文件目录
/etc/cobbler/pxe              # pxe模板文件目录
/etc/cobbler/power            # 电源的配置文件目录
/etc/cobbler/users.conf       # Web服务授权配置文件
/etc/cobbler/users.digest     # 用于web访问的用户名密码配置文件
/etc/cobbler/dnsmasq.template # DNS服务的配置模板
/etc/cobbler/modules.conf     # Cobbler模块配置文件
/var/lib/cobbler              # Cobbler数据目录
/var/lib/cobbler/config       # 配置文件
/var/lib/cobbler/kickstarts   # 默认存放kickstart文件
/var/lib/cobbler/loaders      # 存放的各种引导程序
/var/www/cobbler              # 系统安装镜像目录
/var/www/cobbler/ks_mirror    # 导入的系统镜像列表
/var/www/cobbler/images       # 导入的系统镜像启动文件
/var/www/cobbler/repo_mirror  # yum源存储目录
/var/log/cobbler              # 日志目录
/var/log/cobbler/install.log  # 客户端系统安装日志
/var/log/cobbler/cobbler.log  # cobbler日志

配置cobbler:

检查Cobbler的配置,如果看不到下面的结果,再次重启Cobbler:

[root@vm1 ~]# cobbler check
The following are potential configuration items that you may want to fix:

1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work.  This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : change 'disable' to 'no' in /etc/xinetd.d/tftp
4 : Some network boot-loaders are missing from /var/lib/cobbler/loaders.  If you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely.  Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot.
5 : enable and start rsyncd.service with systemctl
6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
7 : ksvalidator was not found, install pykickstart
8 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
9 : 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@vm1 ~]# sed -ri '/allow_dynamic_settings:/c\allow_dynamic_settings: 1' /etc/cobbler/settings
[root@vm1 ~]# grep allow_dynamic_settings /etc/cobbler/settings
allow_dynamic_settings: 1
[root@vm1 ~]# systemctl restart cobblerd
1. server
[root@vm1 ~]# cobbler setting edit --name=server --value=192.168.17.3
[root@vm1 ~]#

2. next_server
[root@vm1 ~]# cobbler setting edit --name=next_server --value=192.168.17.3
[root@vm1 ~]#

3. tftp和xinetd
[root@vm1 ~]# sed -ri '/disable/c\disable = no' /etc/xinetd.d/tftp
[root@vm1 ~]#
[root@vm1 ~]# systemctl restart xinetd
[root@vm1 ~]# systemctl enable xinetd


4. boot-loaders
[root@vm1 ~]# cobbler get-loaders   # 这个操作提示No such command: get-loaders。cobbler给出了其他解决办法,就是安装syslinux。我们系统已经安装syslinux,所以这边可以通过。

5. rsyncd
[root@vm1 ~]# systemctl start rsyncd
[root@vm1 ~]# systemctl enable rsyncd

6. debmirror [optional]
# 这个是可选项的,可以忽略。这里就忽略了

7. pykickstart
[root@vm1 ~]# yum -y install pykickstart

8. default_password_crypted  #注意:这里设置的密码,也就是后面安装完系统的初始化登录密码
[root@vm1 ~]# openssl passwd -1 -salt `openssl rand -hex 4` 'admin'
$1$a11e9369$CmvARPtsJvtZ04xqK6sZg/
[root@vm1 ~]#
[root@vm1 ~]# cobbler setting edit --name=default_password_crypted --value='$1$a11e9369$CmvARPtsJvtZ04xqK6sZg/'

9. fencing tools [optional]
[root@vm1 ~]# yum -y install fence-agents

sed的用法,注意下,我们可以学习应用到PXE-Kickstart的配置中去。

解决完之后,再次查看:

[root@vm1 ~]# cobbler check
The following are potential configuration items that you may want to fix:

1 : Some network boot-loaders are missing from /var/lib/cobbler/loaders.  If you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely.  Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot.
2 : 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.

我们看下第一个问题该如何解决:

我们这段英文提示信息,是说确认下是否安装了最近新版本的syslinux。

然后执行安装syslinux。

[root@vm1 ~]# yum install -y syslinux
Loaded plugins: fastestmirror
Repository cr is listed more than once in the configuration
Repository fasttrack is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * epel: mirrors.bfsu.edu.cn
Package syslinux-4.05-15.el7.x86_64 already installed and latest version

那第一个问题,我们可以跳过。

配置DHCP:

[root@vm1 ~]# cobbler setting edit --name=manage_dhcp --value=1
[root@vm1 ~]# vim /etc/cobbler/dhcp.template

同步Cobbler的配置:

通过Cobbler配置,它会根据配置自动修改dhcp等服务。

[root@vm1 ~]# cobbler sync
task started: 2023-08-10_180857_sync
task started (id=Sync, time=Thu Aug 10 18:08:57 2023)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
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服务,可以分配到IP地址,但是从tftp服务器中获取不到系统引导文件。

没有镜像选择,只能从本地启动:

Cobbler命令帮助:

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

Cobbler配置安装Centos7.0

我这边的Cobbler服务器就是CentOS7的系统,所以直接挂载/dev/cdrom即可。

1)创建挂载点,并进行挂载:

[root@vm1 ~]# mkdir /centos7

[root@vm1 ~]# mount -o loop /dev/cdrom /centos7

2)查看挂载后的目录:

[root@vm1 centos7]# ll
total 110
-rw-r--r--  2 root root    14 Oct 30  2020 CentOS_BuildTag
drwxr-xr-x  3 root root  2048 Oct 27  2020 EFI
-rw-rw-r-- 15 root root   227 Aug 30  2017 EULA
-rw-rw-r-- 15 root root 18009 Dec 10  2015 GPL
drwxr-xr-x  3 root root  2048 Oct 27  2020 images
drwxr-xr-x  2 root root  2048 Nov  3  2020 isolinux
drwxr-xr-x  2 root root  2048 Oct 27  2020 LiveOS
drwxr-xr-x  2 root root 73728 Nov  3  2020 Packages
drwxr-xr-x  2 root root  4096 Nov  3  2020 repodata
-rw-rw-r-- 15 root root  1690 Dec 10  2015 RPM-GPG-KEY-CentOS-7
-rw-rw-r-- 15 root root  1690 Dec 10  2015 RPM-GPG-KEY-CentOS-Testing-7
-r--r--r--  1 root root  2883 Nov  3  2020 TRANS.TBL

3)导入镜像:

[root@vm1 centos7]# cobbler import --path=/centos7 --name=centos7.9 --arch=x86_64
task started: 2023-08-10_201348_import
task started (id=Media import, time=Thu Aug 10 20:13:48 2023)
Found a candidate signature: breed=suse, version=opensuse15.0
Found a candidate signature: breed=suse, version=opensuse15.1
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/centos7.9-x86_64:
creating new distro: centos7.9-x86_64
trying symlink: /var/www/cobbler/ks_mirror/centos7.9-x86_64 -> /var/www/cobbler/links/centos7.9-x86_64
creating new profile: centos7.9-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/centos7.9-x86_64 for centos7.9-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos7.9-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/centos7.9-x86_64
looking for /var/www/cobbler/ks_mirror/centos7.9-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos7.9-x86_64/repodata
*** TASK COMPLETE ***

4)查看导入后镜像信息:

[root@vm1 centos7]# cobbler distro report --name=centos7.9-x86_64
Name                           : centos7.9-x86_64
Architecture                   : x86_64
TFTP Boot Files                : {}
Breed                          : redhat
Comment                        :
Fetchable Files                : {}
Initrd                         : /var/www/cobbler/ks_mirror/centos7.9-x86_64/images/pxeboot/initrd.img
Kernel                         : /var/www/cobbler/ks_mirror/centos7.9-x86_64/images/pxeboot/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : {'tree': 'http://@@http_server@@/cblr/links/centos7.9-x86_64'}
Management Classes             : []
OS Version                     : rhel7
Owners                         : ['admin']
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Template Files                 : {}

看老师的一段配置信息。 

5)查看profile信息:

[root@vm1 centos7]# cobbler profile report --name=centos7.9-x86_64
Name                           : centos7.9-x86_64
TFTP Boot Files                : {}
Comment                        :
DHCP Tag                       : default
Distribution                   : centos7.9-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
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

6)新建一个centos7.ks文件,然后文件内容如下:

[root@vm1 kickstarts]# cat centos7.ks
# This kickstart file should only be used with EL > 5 and/or Fedora > 7.
# For older versions please use the sample.ks kickstart file.
# Install OS instead of upgrade
install
# Use text mode install
text
# System keyboard
keyboard us
# System language
lang en_US
# System timezone
timezone  Asia/ShangHai
#Root password
#rootpw --plaintext 123456
rootpw --iscrypted $default_password_crypted
# System authorization information
auth  --useshadow  --enablemd5
# Firewall configuration
firewall --disabled
# SELinux configuration
selinux --disabled
# Use network installation
url --url=$tree

# Clear the Master Boot Record
zerombr
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
part /boot --fstype=xfs --size=500
part swap --fstype=swap --size=2048
part / --fstype=xfs --grow --size=200

# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# Network information
$SNIPPET('network_config')
# Do not configure the X Window System
skipx
# Run the Setup Agent on first boot
firstboot --disable
# Reboot after installation
reboot


%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end

%packages
$SNIPPET('func_install_if_enabled')
@core

%end

%post --nochroot
$SNIPPET('log_ks_post_nochroot')
%end

%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps

sed -ri "/^#UseDNS/c\UseDNS no" /etc/ssh/sshd_config
sed -ri "/^GSSAPIAuthentication/c\GSSAPIAuthentication no" /etc/ssh/sshd_config
%end

说明:root密码就是开始的时候设置的密码,admin。

7)编辑centos7镜像所使用的kickstart文件:

[root@vm1 kickstarts]# cobbler profile edit --name=centos7.9-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7.ks


[root@vm1 kickstarts]# cobbler profile report --name=centos7.9-x86_64
Name                           : centos7.9-x86_64
TFTP Boot Files                : {}
Comment                        :
DHCP Tag                       : default
Distribution                   : centos7.9-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/centos7.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

[root@vm1 kickstarts]# cobbler profile report --name=centos7.9-x86_64 |grep Kickstart
Kickstart                      : /var/lib/cobbler/kickstarts/centos7.ks
Kickstart Metadata             : {}

8)再次同步Cobbler配置:

[root@vm1 kickstarts]# cobbler sync
task started: 2023-08-10_203333_sync
task started (id=Sync, time=Thu Aug 10 20:33:33 2023)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/centos7.9-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/images/centos7.9-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
copying distros to tftpboot
copying files for distro: centos7.9-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos7.9-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos7.9-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos7.9-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos7.9-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: centos7.9-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos7.9-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos7.9-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos7.9-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos7.9-x86_64/initrd.img
Writing template files for centos7.9-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
processing boot_files for distro: centos7.9-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 ***

 然后是新建一个虚拟机:

 使用向下箭头选择“centos7.9-x86_64”项目。

然后开始安装。

Kickstart这个配置文件的配置方法,等有时间的时候需要细细的推敲下,应该是把系统安装的更加完善。

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

即时通讯App开发:从0到1的全过程

在数字化时代&#xff0c;即时通讯已经成为人们生活中不可或缺的一部分。如果你想进入这个领域并开发属于自己的即时通讯应用程序&#xff0c;本文将为你提供从0到1的全过程指南。 1. 设想和市场研究 在着手开发之前&#xff0c;你需要明确你的应用程序的核心特点和目标用户群…

LeetCode算法递归类—验证二叉搜索树

目录 98. 验证二叉搜索树 题解&#xff1a; 代码&#xff1a; 运行结果&#xff1a;​编辑 给你一个二叉树的根节点 root &#xff0c;判断其是否是一个有效的二叉搜索树。 有效 二叉搜索树定义如下&#xff1a; 节点的左子树只包含 小于 当前节点的数。节点的右子树只包含…

C语言必会题目(1)

W...Y的主页 &#x1f60a; 代码仓库分享❤️ 在学习语言时&#xff0c;最重要的就是练习&#xff0c;光听不练假把式。下面我就推荐一些C语言必会的题。 执行下面程序&#xff0c;正确的输出是&#xff08; &#xff09; int x5,y7; void swap() { int z; zx; xy; yz; } int…

【几个python虚拟环境会遇到的问题】

几个python虚拟环境会遇到的问题 twine is not recognized as an internal or external command,operable program or batch file.setup命令不报错但不起作用pipreqs is not recognized as an internal or external command,operable program or batch file. ‘twine’ is not …

安卓中常见的字节码指令介绍

问题背景 安卓开发过程中&#xff0c;经常要通过看一些java代码对应的字节码&#xff0c;来了解java代码编译后的运行机制&#xff0c;本文将通过一个简单的demo介绍一些基本的字节码指令。 问题分析 比如以下代码&#xff1a; public class test {public static void main…

I 2C 接口控制器理论讲解

IIC系列文章&#xff1a; (1) I 2C 接口控制器理论讲解 (2) I2C接口控制设计与实现 文章目录 一、 IIC协议二、IIC协议解析1.特点2.规定3.器件地址4.存储地址 三、IIC写时序1.单字节写时序2.连续写时序&#xff08;页写时序&#xff09; 四、IIC读时序1.单字节读时序2.连续读时…

Unity3D高级编程:主程手记学习1

第一章 软件架构 Untiy 分层设计 分层后再分治

C++复习笔记——primer第五版

文章目录 一、引用和指针1.引用2.指针2.1利用指针访问对象2.2指针的值或指针所指对象的值的改变 3.赋值和指针4.指向指针的引用 二、String1.初始化String对象的方式2. string对象上的操作3.使用getline读取一整行4.字面值和字符串相加5.使用for循环改变字符串中的字符 三、Vec…

【Linux】HTTP协议——应用层

目录 HTTP协议 HTTP简介 认识URL 一、协议方案名 二、登录信息 三、服务器地址 四、服务器端口号 五、带层次的文件路径 六、查询字符串 七、片段标识符 urlencode和urldecode HTTP协议格式 HTTP请求协议格式 HTTP响应协议格式 HTTP的方法 HTTP的状态码 HTTP常见…

UX与UI设计的区别是什么?看这一篇就够了!

在产品开发和用户体验设计领域&#xff0c;UX&#xff08;用户体验&#xff09;与UI&#xff08;用户界面&#xff09;设计是两个常被提及的概念&#xff0c;其本质都是在解决产品的用户问题&#xff0c;但在实际的工作场景中&#xff0c;它们代表着不同的设计方向与职责。 简…

【MFC】05.MFC六大机制:程序启动机制-笔记

MFC程序开发所谓是非常简单&#xff0c;但是对于我们逆向人员来说&#xff0c;如果想要逆向MFC程序&#xff0c;那么我们就必须了解它背后的机制&#xff0c;这样我们才能够清晰地逆向出MFC程序&#xff0c;今天这篇文章就来带领大家了解MFC的第一大机制&#xff1a;程序启动机…

YOLOv5 、YOLOv8改进 :SimAM:无参数的注意力机制

在本文中&#xff0c;我们提出了一个用于卷积神经网络的概念简单但非常有效的注意模块。与现有的通道关注模块和空间关注模块相比&#xff0c;我们的模块无需向原始网络添加参数&#xff0c;而是在一层中推断特征图的3-D关注权重。具体来说&#xff0c;我们基于一些著名的神经科…

YOLOv5改进系列(20)——添加BiFormer注意力机制(CVPR2023|小目标涨点神器)

【YOLOv5改进系列】前期回顾: YOLOv5改进系列(0)——重要性能指标与训练结果评价及分析 YOLOv5改进系列(1)——添加SE注意力机制 YOLOv5改进系列(2)——添加CBAM注意力机制

途乐证券-美股突然跳水400点,美联储释放重磅信号

一份重磅数据来袭。 北京时间8月10日晚间&#xff0c;美国劳工部发布的7月CPI通胀数据显现&#xff0c;美国7月CPI同比涨幅从6月的3%加速至3.2%&#xff0c;为2022年6月以来首次加速上升&#xff0c;但低于预期的3.3%。美国总统拜登榜首时间表明&#xff0c;美国在通胀方面取得…

从零开始搭建个人博客网站(hexo框架)

1.工具及环境搭建 1&#xff09;注册GitHub并且新建一个repositories 2&#xff09;下载node.js以及Git 下载链接&#xff1a; 检验安装是否成功&#xff1a; 【注】&#xff1a;MacOS自带Git&#xff0c;可以直接在终端输入git --version进行检验 3&#xff09;新建一个…

Debian/Ubuntu清理硬盘空间

Debian/Ubuntu清理硬盘空间_debian清理磁盘空间_weixin_43606319的博客-CSDN博客 1. 删除残余的配置文件 通常Debian/Ubuntu删除软件包可以用两条命令 sudo apt-get remove <package-name> sudo apt-get purge <package-name> remove将会删除软件包&#xff0…

Linux Day08

内存申请与释放 前面的内存为实际内存&#xff0c;后面的交换空间为虚拟内存 当申请空间小于等于内存时&#xff0c;先使用内存。 当申请空间d大于内存时&#xff0c;使用内存虚拟内存 1、判断依据 申请1个G的空间 #include<stdio.h> #include<stdlib.h> #inc…

【redis 3.2 集群】

目录 一、Redis主从复制 1.概念 2.作用 2.1 数据冗余 2.2 故障恢复 2.3 负载均衡 2.4 高可用 3.缺点 4.流程 4.1 第一步 4.2 第二步 4.3 第三步 4.4 第四步 5.搭建 5.1 主 5.2 从 6.验证 二、Reids哨兵模式 1.概念 2.作用 2.1 监控 2.2 自动故障转移 2.…

Unreal DataTable使用

目的&#xff1a;在多个地方使用同一份结构体配置 C定义结构体 USTRUCT(BlueprintType) struct FXXX : public FTableRowBase {GENERATED_BODY()UPROPERTY(EditAnywhere, BlueprintReadWrite, Category "XXX")float XXX; }注意&#xff1a; 类的元数据加上 Bluep…

如何在docker部署一个python项目

导语&#xff1a; 我之前已经实现了在服务器上直接部署一个文件&#xff0c;但是那种部署方式有个明显的缺陷&#xff1a;我如果需要在其他机器部署该项目时&#xff0c;需要重新配置项目所依赖的环境。因此我们需要一种只需要配置一次环境依赖&#xff0c;就可以在其他机器上随…