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

CentOS手工升级curl记

笔者一台服务器装有 CentOS 7.9 系统,运行 curl -V 查询 curl 的版本是 7.29,这个老版本的 curl 不支持 HTTP/2 协议。为了使 curl 能连接HTTP/2,curl 必须升级到至少7.46.0版本以上。查询 curl的官网得知当前最新版本是 8.8.0,然而再仔细看,适用于 CentOS 系统的却是7.76.1版,
在这里插入图片描述

经过一番摸索,CentOS 是可以安装 8.8.0的,需要手动编译才成功,下面记录一下我手工升级的过程:

1. 安装依赖:

sudo yum groupinstall -y 'Development Tools'
sudo yum install -y libnghttp2 libnghttp2-devel openssl-devel

2. 下载并安装最新版本的curl:

wget https://curl.se/download/curl-8.8.0.zip
unzip curl-8.8.0.zip
cd curl-8.8.0
./configure

运行 ./configure 而不带参数的话,大概率会报错,如:
在这里插入图片描述
于是按提示,把这些 --with 开头的参数都加到 ./configure,尝试运行:

./configure  --with-amissl  --with-bearssl  --with-gnutls  --with-mbedtls  --with-nss  --with-openssl  --with-rustls  --with-schannel  --with-secure-transport  --with-wolfssl

嗯,报了另一个错:NSS use must be confirmed using --with-nss-deprecated. NSS support will be dropped from curl in August 2022. See docs/DEPRECATE.md
在这里插入图片描述

NSS是一个提供网络安全相关服务的库,系统检测到正在尝试使用NSS(Network Security Services)库,而 curl
计划不再支持 NSS 。因此,如确实要使用NSS,就必须通过–with-nss-deprecated 参数显式指定这一点。

好吧,调整一下configure参数:

./configure  --with-amissl  --with-bearssl  --with-gnutls  --with-mbedtls  --with-nss  --with-nss-deprecated --with-openssl  --with-rustls  --with-schannel  --with-secure-transport  --with-wolfssl

在这里插入图片描述
又来报错:–with-wolfssl but wolfSSL was not found or doesn’t work
暂时不用 wolfSSL 的话,就去掉这个参数,再尝试运行:

./configure  --with-amissl  --with-bearssl  --with-gnutls  --with-mbedtls  --with-nss  --with-nss-deprecated --with-openssl  --with-rustls  --with-schannel  --with-secure-transport

在这里插入图片描述
又是报错:error: --with-rustls was specified but could not find rustls.
再尝试去掉 --with-rustls 参数:

./configure  --with-amissl  --with-bearssl  --with-gnutls  --with-mbedtls  --with-nss  --with-nss-deprecated --with-openssl  --with-schannel  --with-secure-transport

这样,编译过程开始有了进展,不再报错。

在这里插入图片描述

编译成功了,但是从上面截图的编译结果看来,倒数第6行显示:HTTP2: No (–with-nghttp2, --with-hyper),如果要启用 HTTP/2,必须要再加多 --with-nghttp2, --with-hyper 参数,再次编译。

./configure  --with-amissl  --with-bearssl  --with-gnutls  --with-mbedtls  --with-nss  --with-nss-deprecated --with-openssl  --with-schannel  --with-secure-transport  --with-nghttp2  --with-hyper

编译如果没有报错,就应该出现下图的样子,HTTP2已经是 enabled 的状态。
在这里插入图片描述

3. 收尾工作

make
make install
sudo ldconfig

4. 确认curl版本和HTTP/2支持:

curl -V

输出应包括类似以下内容:
在这里插入图片描述

恭喜贺喜,CentOS 可以破格用上最新版 curl 了。。

相关文章:

  • 电子电气架构 --- 智能座舱功能应用
  • 华为云下Ubuntu20.04中Docker的部署
  • 单片机第五季-第八课:STM32CubeMx和FreeRTOS
  • AWS无服务器 应用程序开发—第十三章 小结2
  • 基于CentOS Stream 9平台 安装/卸载 Redis7.0.15
  • 增强大型语言模型(LLM)可访问性:深入探究在单块AMD GPU上通过QLoRA微调Llama 2的过程
  • 学习记录:VS2019+OpenCV3.4.1实现SURF库函数的调用
  • 手机照片免费数据恢复软件EasyRecovery2024免费版下载
  • C 语言连接MySQL 数据库
  • 【面试干货】String、StringBuilder、StringBuffer 的区别
  • 双指针【1】两数之和基础版 归并排序
  • 【LC刷题】DAY09:232 225 20 1047
  • 考研计组chap3存储系统
  • Python爬虫实现“自动重试”机制的方法(2)
  • uniapp 展示地图,并获取当前位置信息(精确位置)
  • 分享的文章《人生如棋》
  • (ckeditor+ckfinder用法)Jquery,js获取ckeditor值
  • android 一些 utils
  • Android开发 - 掌握ConstraintLayout(四)创建基本约束
  • AzureCon上微软宣布了哪些容器相关的重磅消息
  • DataBase in Android
  • DOM的那些事
  • Javascript编码规范
  • Java的Interrupt与线程中断
  • jquery ajax学习笔记
  • learning koa2.x
  • PAT A1092
  • React-redux的原理以及使用
  • vagrant 添加本地 box 安装 laravel homestead
  • 翻译--Thinking in React
  • 技术:超级实用的电脑小技巧
  • 解析带emoji和链接的聊天系统消息
  • 前端知识点整理(待续)
  • 浅谈web中前端模板引擎的使用
  • 再谈express与koa的对比
  • 正则表达式小结
  • Unity3D - 异步加载游戏场景与异步加载游戏资源进度条 ...
  • 回归生活:清理微信公众号
  • ​MPV,汽车产品里一个特殊品类的进化过程
  • #ifdef 的技巧用法
  • #常见电池型号介绍 常见电池尺寸是多少【详解】
  • (+4)2.2UML建模图
  • (01)ORB-SLAM2源码无死角解析-(66) BA优化(g2o)→闭环线程:Optimizer::GlobalBundleAdjustemnt→全局优化
  • (11)MSP430F5529 定时器B
  • (6) 深入探索Python-Pandas库的核心数据结构:DataFrame全面解析
  • (delphi11最新学习资料) Object Pascal 学习笔记---第8章第2节(共同的基类)
  • (搬运以学习)flask 上下文的实现
  • (二)PySpark3:SparkSQL编程
  • (二)七种元启发算法(DBO、LO、SWO、COA、LSO、KOA、GRO)求解无人机路径规划MATLAB
  • (非本人原创)我们工作到底是为了什么?​——HP大中华区总裁孙振耀退休感言(r4笔记第60天)...
  • (附源码)springboot金融新闻信息服务系统 毕业设计651450
  • (附源码)ssm基于jsp的在线点餐系统 毕业设计 111016
  • (六)vue-router+UI组件库
  • (七)Knockout 创建自定义绑定
  • (已解决)vue+element-ui实现个人中心,仿照原神