当前位置: 首页 > news >正文

ubuntu上申请Let‘s Encrypt HTTPS 证书

Ubuntu 16.04及以上版本通常自带Snapd,如果你的系统还没有安装,可以通过以下命令安装:
安装Certbot#
使用Snap安装Certbot,确保你获得的是最新版本:

bash
sudo snap install --classic certbot
  1. 准备Certbot命令#
    确保Certbot命令可以通过创建一个符号链接到/usr/bin目录中的命令来运行:
bash
sudo ln -s /snap/bin/certbot /usr/bin/certbot

实例

root@mail:~# apt-get install cerbot
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package cerbot
root@mail:~# exit
logout
wqbboy@mail:~$ sudo apt-get install cerbot
[sudo] password for wqbboy:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package cerbot
wqbboy@mail:~$ sudo apt install snapd
[sudo] password for wqbboy:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:zenity | kdialog
The following packages will be upgraded:snapd
1 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
Need to get 26.4 MB of archives.
After this operation, 2,134 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu jammy-updates/main amd64 snapd d64 2.65.3+22.04 [26.4 MB]
Fetched 26.4 MB in 3s (9,407 kB/s)
(Reading database ... 89736 files and directories currently installed.)
Preparing to unpack .../snapd_2.65.3+22.04_amd64.deb ...
Unpacking snapd (2.65.3+22.04) over (2.63+22.04ubuntu0.1) ...
Setting up snapd (2.65.3+22.04) ...
Installing new version of config file /etc/apparmor.d/usr.lib.snapd.snap-nfine.real ...
snapd.failure.service is a disabled or a static unit not running, not staing it.
snapd.snap-repair.service is a disabled or a static unit not running, nottarting it.
Processing triggers for dbus (1.12.20-2ubuntu4.1) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for man-db (2.10.2-1) ...
Scanning processes... [                                                  Scanning processes... [                                                  Scanning processes... [                                                  Scanning processes... [                                                  Scanning processes... [=                                                 Scanning processes... [=                                                  Scanning linux images... [=================================              Scanning linux images...                                                 Running kernel seems to be up-to-date.No services need to be restarted.No containers need to be restarted.No user sessions are running outdated binaries.No VM guests are running outdated hypervisor (qemu) binarie              s on this host.

查看版本


wqbboy@mail:~$ snap version
snap    2.65.3+22.04
snapd   2.65.3+22.04
series  16
ubuntu  22.04
kernel  5.15.0-124-generic
wqbboy@mail:~$ sudo snap install --classic certbot
certbot 2.11.0 from Certbot Project (certbot-eff✓) installed
wqbboy@mail:~$ ln -s /snap/bin/certbot /usr/bin/certbot
ln: failed to create symbolic link '/usr/bin/certbot': Permission denied
wqbboy@mail:~$ sudo ln -s /snap/bin/certbot /usr/bin/certbot
[sudo] password for wqbboy:
wqbboy@mail:~$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

安装openssl


wqbboy@mail:~$ sudo apt-get install openssl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
openssl is already the newest version (3.0.2-0ubuntu1.18).
openssl set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.wqbboy@mail:~$ cd /etc/nginx/
wqbboy@mail:/etc/nginx$ ls
conf-available  modules-available               sites-available.bak
conf.d          modules-enabled                 sites-enabled
conf-enabled    netdata.users                   sites-enabled.bak
fastcgi.conf    nginx.conf                      snippets
fastcgi_params  nginx.conf.2024.10.20.03.13.29  templates
koi-utf         proxy_params                    uwsgi_params
koi-win         scgi_params                     win-utf
mime.types      sites-available

生成私钥和 CSR(证书签名请求):

wqbboy@mail:/etc/nginx$ sudo openssl req -newkey rsa:2048 -nodes -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.csr
.+......+.....+.+......+..+...............+...............+......+.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.+....+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*......+...+......+......+.+............+..+.+.....+...+.......+.....+....+.....+..........+........+.+..+...+.+...+...+...+......+......+........+.......+........+.+...+...............+............+.....+....+.....+.........+.+..........................+.+...+..+..........+.....+...+...............+......+......+.......+........+...+............+...+.+.....+.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.....+..........+.....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.........+.+.....+...+.+........+.............+........+....+..+...+...+............+......................+...+......+...............+.....+....+.......................+...+................+...+............+......+..+.+..+.......+...+.................+.+......+...+..+..........+...+..................+..+.+...............+............+...+..+....+.....+...............+.+..+.+.....+......+.+.....+..................................+...+......+..+...+.........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
req: Can't open "/etc/nginx/ssl/nginx.key" for writing, No such file or directory
wqbboy@mail:/etc/nginx$ sudo mkdir ssl
wqbboy@mail:/etc/nginx$ ls
conf-available  modules-available               sites-available.bak
conf.d          modules-enabled                 sites-enabled
conf-enabled    netdata.users                   sites-enabled.bak
fastcgi.conf    nginx.conf                      snippets
fastcgi_params  nginx.conf.2024.10.20.03.13.29  ssl
koi-utf         proxy_params                    templates
koi-win         scgi_params                     uwsgi_params
mime.types      sites-available                 win-utf
wqbboy@mail:/etc/nginx$ sudo openssl req -newkey rsa:2048 -nodes -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.csr
..+...+..........+...............+......+..+............+.+..+.............+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*...+.+.....+....+.........+..+..........+.....+....+..+..........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*...+..+.+...+.........+........+...+....+......+...........+.+..+...............+............+.+...............+........+......+...+............+...+...+....+...+...........+.+...+...+..+......+......+.+...+......+...............+.....+.+.....+...+.......+...+..............+.+.....+........................+......+.+........+.......+...+...+..............+......+...+..........+..+...............+....+...+...+...+..+....+......+..................+.....+.+...+...........+......+.+...+.........+..+...+..........+..+.....................+..........+..+......+..........+......+........+...+...+...................+..+...+............+....+.........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...+.....+.+...........+....+.....+...+.......+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..+.+.........+.....+.+..+......+.........+..........+......+..+...+....+......+..............+...+......................+.....+.+...........+...+.+......+...........+...............+...+.......+..+.+...........+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CN
State or Province Name (full name) [Some-State]:HUBEI
Locality Name (eg, city) []:XGS
Organization Name (eg, company) [Internet Widgits Pty Ltd]:GA
Organizational Unit Name (eg, section) []:ZHZX
Common Name (e.g. server FQDN or YOUR name) []:mail.xgpolice.com
Email Address []:Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

生成自签名 SSL 证书:

wqbboy@mail:/etc/nginx$ sudo openssl x509 -req -days 3650 -in /etc/nginx/ssl/nginx.csr -signkey /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt
Certificate request self-signature ok
subject=C = CN, ST = HUBEI, L = XGS, O = GA, OU = ZHZX, CN = mail.xgpolice.com
wqbboy@mail:/etc/nginx$ sudo vi /etc/nginx/sites-available/00-default
00-default.conf      00-default-ssl.conf
wqbboy@mail:/etc/nginx$ sudo vi /etc/nginx/sites-available/00-default
00-default.conf      00-default-ssl.conf
wqbboy@mail:/etc/nginx$ sudo vi /etc/nginx/sites-available/00-default-ssl.conf

让我们在 /etc/nginx/snippets 目录下创建一个新的 Nginx 配置片段。

为了正确区分该文件的目的,让我们将其命名为 self-signed.conf:

在这个文件中,我们只需要将 ssl_certificate 指令设置为我们的证书文件,将

ssl_certificate_key 设置为相关的密钥。在我们的情况下,这将如下所示:

wqbboy@mail:/etc/nginx$ sudo nano /etc/nginx/snippets/self-signed.conf
wqbboy@mail:/etc/nginx$ sudo cat /etc/nginx/snippets/self-signed.conf
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
wqbboy@mail:/etc/nginx$ ls
conf-available  modules-available               sites-available.bak
conf.d          modules-enabled                 sites-enabled
conf-enabled    netdata.users                   sites-enabled.bak
fastcgi.conf    nginx.conf                      snippets
fastcgi_params  nginx.conf.2024.10.20.03.13.29  ssl
koi-utf         proxy_params                    templates
koi-win         scgi_params                     uwsgi_params
mime.types      sites-available                 win-utf
wqbboy@mail:/etc/nginx$ cd ssl
wqbboy@mail:/etc/nginx/ssl$ ls
nginx.crt  nginx.csr  nginx.key
wqbboy@mail:/etc/nginx/ssl$ cd /etc/nginx/sites-available
wqbboy@mail:/etc/nginx/sites-available$ ls
00-default.conf  00-default-ssl.conf
wqbboy@mail:/etc/nginx/sites-available$ sudo cp 00-default-ssl.conf 00-default-ssl.conf.bak
wqbboy@mail:/etc/nginx/sites-available$ ls
00-default.conf  00-default-ssl.conf  00-default-ssl.conf.bak
wqbboy@mail:/etc/nginx/sites-available$ sudo nano 00-default-ssl.conf

调整 Nginx 配置以使用 SSL

wqbboy@mail:/etc/nginx/sites-available$ cd ..
wqbboy@mail:/etc/nginx$ ls
conf-available  modules-available               sites-available.bak
conf.d          modules-enabled                 sites-enabled
conf-enabled    netdata.users                   sites-enabled.bak
fastcgi.conf    nginx.conf                      snippets
fastcgi_params  nginx.conf.2024.10.20.03.13.29  ssl
koi-utf         proxy_params                    templates
koi-win         scgi_params                     uwsgi_params
mime.types      sites-available                 win-utf
wqbboy@mail:/etc/nginx$ ls
conf-available  modules-available               sites-available.bak
conf.d          modules-enabled                 sites-enabled
conf-enabled    netdata.users                   sites-enabled.bak
fastcgi.conf    nginx.conf                      snippets
fastcgi_params  nginx.conf.2024.10.20.03.13.29  ssl
koi-utf         proxy_params                    templates
koi-win         scgi_params                     uwsgi_params
mime.types      sites-available                 win-utf
wqbboy@mail:/etc/nginx$ ls snippets/
fastcgi-php.conf  self-signed.conf  snakeoil.conf
wqbboy@mail:/etc/nginx$ ls ssl/
nginx.crt  nginx.csr  nginx.key
wqbboy@mail:/etc/nginx$ ls sites-available
00-default.conf  00-default-ssl.conf  00-default-ssl.conf.bak
wqbboy@mail:/etc/nginx$ cd sites-available
wqbboy@mail:/etc/nginx/sites-available$ ls
00-default.conf  00-default-ssl.conf  00-default-ssl.conf.bak
wqbboy@mail:/etc/nginx/sites-available$ sudo nano 00-default-ssl.conf

配置 Nginx 以使用自签名 SSL 证书:

wqbboy@mail:/etc/nginx/sites-available$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
wqbboy@mail:/etc/nginx/sites-available$ sudo systemctl restart nginx
wqbboy@mail:/etc/nginx/sites-available$

修改这个文件的ssl证书的key和crt文件路径。

wqbboy@mail:/etc/nginx/sites-available$ sudo vi /etc/nginx/templates/ssl.tmpl
[sudo] password for wqbboy:
wqbboy@mail:/etc/nginx/sites-available$ sudo vi /etc/nginx/templates/ssl.tmpl

修改完后需要重新加载一下nginx配置

wqbboy@mail:/etc/nginx/sites-available$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
wqbboy@mail:/etc/nginx/sites-available$ sudo nginx -s reload
wqbboy@mail:/etc/nginx/sites-available$ systemctl reload nginx
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to reload 'nginx.service'.
Authenticating as: wqbboy
Password:
==== AUTHENTICATION COMPLETE ===
wqbboy@mail:/etc/nginx/sites-available$

配置 postfix

编辑 /etc/postfix/main.cf 文件以使用 SSL 证书。

wqbboy@mail:/etc/nginx/sites-available$ sudo vi /etc/postfix/main.cf
wqbboy@mail:/etc/nginx/sites-available$ cat /etc/postfix/main.cf | grep smtpd
smtpd_tls_key_file = /etc/nginx/ssl/nginx.key
smtpd_tls_cert_file = /etc/nginx/ssl/nginx.crt
smtpd_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtpd_tls_CApath = /etc/ssl/certs
smtpd_tls_protocols = !SSLv2 !SSLv3 !TLSv1 !TLSv1.1
smtpd_tls_mandatory_protocols = !SSLv2 !SSLv3 !TLSv1 !TLSv1.1
smtpd_tls_dh512_param_file = /etc/ssl/dh512_param.pem
smtpd_tls_dh1024_param_file = /etc/ssl/dh2048_param.pem
smtpd_tls_loglevel = 1
smtpd_tls_security_level = may
#smtpd_tls_received_header = yes
# Use the same CA file as smtpd.
smtpd_reject_unlisted_recipient = yes
smtpd_reject_unlisted_sender = yes
smtpd_command_filter = pcre:/etc/postfix/command_filter.pcre
smtpd_helo_required = yes
smtpd_helo_restrictions =
smtpd_sender_restrictions =
smtpd_recipient_restrictions =
smtpd_end_of_data_restrictions =
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_discard_ehlo_keywords = chunking
proxy_read_maps = $canonical_maps $lmtp_generic_maps $local_recipient_maps $mydestination $mynetworks $recipient_bcc_maps $recipient_canonical_maps $relay_domains $relay_recipient_maps $relocated_maps $sender_bcc_maps $sender_canonical_maps $smtp_generic_maps $smtpd_sender_login_maps $transport_maps $virtual_alias_domains $virtual_alias_maps $virtual_mailbox_domains $virtual_mailbox_maps $smtpd_sender_restrictions $sender_dependent_relayhost_maps
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
#smtpd_tls_auth_only = yes
smtpd_sender_login_maps =
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/dovecot-auth
wqbboy@mail:/etc/nginx/sites-available$ cat /etc/postfix/main.cf | grep smtpd_tls
smtpd_tls_key_file = /etc/nginx/ssl/nginx.key
smtpd_tls_cert_file = /etc/nginx/ssl/nginx.crt
smtpd_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtpd_tls_CApath = /etc/ssl/certs
smtpd_tls_protocols = !SSLv2 !SSLv3 !TLSv1 !TLSv1.1
smtpd_tls_mandatory_protocols = !SSLv2 !SSLv3 !TLSv1 !TLSv1.1
smtpd_tls_dh512_param_file = /etc/ssl/dh512_param.pem
smtpd_tls_dh1024_param_file = /etc/ssl/dh2048_param.pem
smtpd_tls_loglevel = 1
smtpd_tls_security_level = may
#smtpd_tls_received_header = yes
#smtpd_tls_auth_only = yes
wqbboy@mail:/etc/nginx/sites-available$ sudo systemctl restart postfix

配置 dovecot
编辑 /etc/dovecot/dovecot.conf文件以使用 SSL 证书。

wqbboy@mail:/etc/nginx/sites-available$ sudo vi /etc/dovecot/dovecot.conf
wqbboy@mail:/etc/nginx/sites-available$ cat /etc/dovecot/dovecot.conf | greep ssl_
Command 'greep' not found, did you mean:command 'grep' from deb grep (3.7-1build1)command 'greed' from deb greed (4.2-1)
Try: sudo apt install <deb name>
wqbboy@mail:/etc/nginx/sites-available$ cat /etc/dovecot/dovecot.conf | grep ssl_
ssl_min_protocol = TLSv1.2
#ssl_ca = </path/to/ca
ssl_cert = </etc/nginx/ssl/nginx.crt
ssl_key = </etc/nginx/ssl/nginx.key
ssl_dh = </etc/ssl/dh2048_param.pem
ssl_cipher_list = EECDH+CHACHA20:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH
ssl_prefer_server_ciphers = yes
wqbboy@mail:/etc/nginx/sites-available$

重启 Dovecot


wqbboy@mail:/etc/nginx/sites-available$ sudo systemctl restart dovecot
wqbboy@mail:/etc/nginx/sites-available$

相关文章:

ubuntu上申请Let‘s Encrypt HTTPS 证书

Ubuntu 16.04及以上版本通常自带Snapd&#xff0c;如果你的系统还没有安装&#xff0c;可以通过以下命令安装&#xff1a; 安装Certbot# 使用Snap安装Certbot&#xff0c;确保你获得的是最新版本&#xff1a; bash sudo snap install --classic certbot准备Certbot命令# 确保C…...

解决VMware虚拟机的字体过小问题

前言&#xff1a; &#xff08;1&#xff09;先装VMware VMware17Pro虚拟机安装教程(超详细)-CSDN博客 &#xff08;2&#xff09;通过清华等镜像网站安装好Ubuntu镜像&#xff0c;下面贴上链接 教程虚拟机配置我没有做&#xff0c;因为学校给了现成的虚拟机~~大家需要的自己…...

java-web-day6-下-知识点小结

JDBC JDBC --是sun公司定义的一套操作所有关系型数据库的规范, 也就是接口api 数据库驱动 --是各个数据库厂家根据JDBC规范的具体实现, 例如mysql的驱动依赖 Lombok 简介 Lombok是一个实用的java类库, 通过注解的方式自动生成构造器, getter/setter, equals, hashcode, toStr…...

Cisco Packet Tracer 8.0 路由器静态路由配置

文章目录 静态路由简介一、定义与特点二、配置与命令三、优点与缺点四、应用场景 一&#xff0c;搭建拓扑图二&#xff0c;配置pc IP地址三&#xff0c;pc0 ping pc1 timeout四&#xff0c;配置路由器Router0五&#xff0c;配置路由器Router1六&#xff0c;测试 静态路由简介 …...

Unity3D学习FPS游戏(3)玩家第一人称视角转动和移动

前言&#xff1a;上一篇实现了角色简单的移动控制&#xff0c;但是实际游戏中玩家的视角是可以转动的&#xff0c;并根据转动后视角调整移动正前方。本篇实现玩家第一人称视角转动和移动&#xff0c;觉得有帮助的话可以点赞收藏支持一下&#xff01; 玩家第一人称视角 修复小问…...

引领数字未来:通过企业架构推动数字化转型的策略与实践

在全球经济迅速数字化的背景下&#xff0c;企业正面临日益复杂的挑战。为了保持竞争优势&#xff0c;企业必须迅速调整其业务模式&#xff0c;采用先进的技术&#xff0c;推动业务创新。企业架构&#xff08;EA&#xff09;作为企业转型的战略工具&#xff0c;在这一过程中发挥…...

计算机毕业设计Python+大模型恶意木马流量检测与分类 恶意流量监测 随机森林模型 深度学习 机器学习 数据可视化 大数据毕业设计 信息安全 网络安全

温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; Python大模型恶意木马流量检…...

ApsaraMQ Serverless 能力再升级,事件驱动架构赋能 AI 应用

本文整理于 2024 年云栖大会阿里云智能集团高级技术专家金吉祥&#xff08;牟羽&#xff09;带来的主题演讲《ApsaraMQ Serverless 能力再升级&#xff0c;事件驱动架构赋能 AI 应用》 云消息队列 ApsaraMQ 全系列产品 Serverless 化&#xff0c;支持按量付费、自适应弹性、跨可…...

Xcode 16.1 (16B40) 发布下载 - Apple 平台 IDE

Xcode 16.1 (16B40) 发布下载 - Apple 平台 IDE IDE for iOS/iPadOS/macOS/watchOS/tvOS/visonOS 发布日期&#xff1a;2024 年 10 月 28 日 Xcode 16.1 包含适用于 iOS 18.1、iPadOS 18.1、Apple tvOS 18.1、watchOS 11.1、macOS Sequoia 15.1 和 visionOS 2.1 的 SDK。Xco…...

使用ONNX Runtime对模型进行推理

今天的深度学习可谓是十分热门&#xff0c;好像各行各业的人都会一点。而且特别是Hinton获得诺奖后&#xff0c;更是给深度学习添了一把火。星主深知大家可能在平时仅仅将模型训练好后就不会去理会它了&#xff0c;至于模型的部署&#xff0c;很多人都没有相关经验。由于我最近…...

五款pdf转换成word免费版,谁更胜一筹?

作为一名在都市丛林中奋斗的打工人&#xff0c;每天处理各种文件是家常便饭。尤其是PDF和Word文档之间的转换&#xff0c;简直是日常工作中不可或缺的一部分。今天&#xff0c;我就来和大家分享一下我使用过的几款PDF转Word免费版工具&#xff0c;看看它们的表现如何。 一、福…...

【C++】踏上C++学习之旅(四):细说“内联函数“的那些事

文章目录 前言1. "内联函数"被创造出来的意义2. 内联函数的概念2.1 内联函数在代码中的体现2.2 普通函数和内联函数的汇编代码 3. 内联函数的特性&#xff08;重点&#xff09;4. 总结 前言 本章来聊一聊C的创作者"本贾尼"大佬&#xff0c;为什么要创作出…...

SVN克隆或更新遇到Error: Checksum mismatch for xxx

文章目录 前言问题的产生探索解决方案正式的解决方法背后的故事总结 前言 TortoiseSVN 作为版本控制常用的工具&#xff0c;有一个更为人们熟知的名字 SVN&#xff0c;客观的讲SVN的门槛相比Git而言还是低一些的&#xff0c;用来存储一些文件并保留历史记录比较方便&#xff0…...

QT交互界面:实现按钮运行脚本程序

一.所需运行的脚本 本篇采用上一篇文章的脚本为运行对象&#xff0c;实现按钮运行脚本 上一篇文章&#xff1a;从0到1&#xff1a;QT项目在Linux下生成可以双击运用的程序&#xff08;采用脚本&#xff09;-CSDN博客 二.调用脚本的代码 widget.cpp中添加以下代码 #include &…...

驱动和芯片设计哪个难

驱动和芯片设计哪个难 芯片设计和驱动开发 芯片设计和驱动开发 都是具有挑战性的工作&#xff0c;它们各自有不同的难点和要求。 对于芯片设计&#xff0c;它是一个集高精尖于一体的复杂系统工程&#xff0c;涉及到从需求分析、前端设计、后端设计到流片的全过程。 芯片设计的…...

【云原生】云原生后端:监控与观察性

目录 引言一、监控的概念1.1 指标监控1.2 事件监控1.3 告警管理 二、观察性的定义三、实现监控与观察性的方法3.1 指标收集与监控3.2 日志管理3.3 性能分析 四、监控与观察性的最佳实践4.1 监控工具选择4.2 定期回顾与优化 结论参考资料 引言 在现代云原生架构中&#xff0c;监…...

在 ubuntu20.04 安装 docker

1、替换清华源 替换 sources.list 里面的内容 sudo vim /etc/apt/sources.list# 默认注释了源码镜像以提高 apt update 速度&#xff0c;如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse # deb-src htt…...

前端开发设计模式——观察者模式

目录 一、定义和特点 1. 定义 2. 特点 二、实现方式 1. 使用 JavaScript 实现观察者模式的基本结构 2. 实际应用中的实现示例 三、使用场景 1. 事件处理 2. 数据绑定 3. 异步通信 4. 组件通信 四、优点 1. 解耦和灵活性 2. 实时响应和数据一致性 3. 提高代码的可…...

永磁同步电机高性能控制算法(17)——无差拍预测转速控制

1.前言 前期写了比较多的关于无差拍预测电流控制的东西。 https://zhuanlan.zhihu.com/p/659205719https://zhuanlan.zhihu.com/p/659205719 https://zhuanlan.zhihu.com/p/660266190https://zhuanlan.zhihu.com/p/660266190 https://zhuanlan.zhihu.com/p/719591343https://z…...

【GIT】Visual Studio 中 Git 界面中, 重置 和 还原

在 Visual Studio 的 Git 界面中&#xff0c;“重置” 和 “还原” 是两个常用的 Git 操作。它们的主要区别在于应用场景和影响范围。 1. 重置&#xff08;Reset&#xff09; 重置用于更改当前分支的提交历史&#xff0c;通常用于撤销或删除某些提交。重置操作可能会更改 Git…...

Linux应用开发之网络套接字编程(实例篇)

服务端与客户端单连接 服务端代码 #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <pthread.h> …...

ES6从入门到精通:前言

ES6简介 ES6&#xff08;ECMAScript 2015&#xff09;是JavaScript语言的重大更新&#xff0c;引入了许多新特性&#xff0c;包括语法糖、新数据类型、模块化支持等&#xff0c;显著提升了开发效率和代码可维护性。 核心知识点概览 变量声明 let 和 const 取代 var&#xf…...

Prompt Tuning、P-Tuning、Prefix Tuning的区别

一、Prompt Tuning、P-Tuning、Prefix Tuning的区别 1. Prompt Tuning(提示调优) 核心思想:固定预训练模型参数,仅学习额外的连续提示向量(通常是嵌入层的一部分)。实现方式:在输入文本前添加可训练的连续向量(软提示),模型只更新这些提示参数。优势:参数量少(仅提…...

DeepSeek 赋能智慧能源:微电网优化调度的智能革新路径

目录 一、智慧能源微电网优化调度概述1.1 智慧能源微电网概念1.2 优化调度的重要性1.3 目前面临的挑战 二、DeepSeek 技术探秘2.1 DeepSeek 技术原理2.2 DeepSeek 独特优势2.3 DeepSeek 在 AI 领域地位 三、DeepSeek 在微电网优化调度中的应用剖析3.1 数据处理与分析3.2 预测与…...

Oracle查询表空间大小

1 查询数据库中所有的表空间以及表空间所占空间的大小 SELECTtablespace_name,sum( bytes ) / 1024 / 1024 FROMdba_data_files GROUP BYtablespace_name; 2 Oracle查询表空间大小及每个表所占空间的大小 SELECTtablespace_name,file_id,file_name,round( bytes / ( 1024 …...

《从零掌握MIPI CSI-2: 协议精解与FPGA摄像头开发实战》-- CSI-2 协议详细解析 (一)

CSI-2 协议详细解析 (一&#xff09; 1. CSI-2层定义&#xff08;CSI-2 Layer Definitions&#xff09; 分层结构 &#xff1a;CSI-2协议分为6层&#xff1a; 物理层&#xff08;PHY Layer&#xff09; &#xff1a; 定义电气特性、时钟机制和传输介质&#xff08;导线&#…...

【HTML-16】深入理解HTML中的块元素与行内元素

HTML元素根据其显示特性可以分为两大类&#xff1a;块元素(Block-level Elements)和行内元素(Inline Elements)。理解这两者的区别对于构建良好的网页布局至关重要。本文将全面解析这两种元素的特性、区别以及实际应用场景。 1. 块元素(Block-level Elements) 1.1 基本特性 …...

企业如何增强终端安全?

在数字化转型加速的今天&#xff0c;企业的业务运行越来越依赖于终端设备。从员工的笔记本电脑、智能手机&#xff0c;到工厂里的物联网设备、智能传感器&#xff0c;这些终端构成了企业与外部世界连接的 “神经末梢”。然而&#xff0c;随着远程办公的常态化和设备接入的爆炸式…...

C++使用 new 来创建动态数组

问题&#xff1a; 不能使用变量定义数组大小 原因&#xff1a; 这是因为数组在内存中是连续存储的&#xff0c;编译器需要在编译阶段就确定数组的大小&#xff0c;以便正确地分配内存空间。如果允许使用变量来定义数组的大小&#xff0c;那么编译器就无法在编译时确定数组的大…...

【UE5 C++】通过文件对话框获取选择文件的路径

目录 效果 步骤 源码 效果 步骤 1. 在“xxx.Build.cs”中添加需要使用的模块 &#xff0c;这里主要使用“DesktopPlatform”模块 2. 添加后闭UE编辑器&#xff0c;右键点击 .uproject 文件&#xff0c;选择 "Generate Visual Studio project files"&#xff0c;重…...