Centos编译升级libcurl

Centos编译升级libcurl

‌下载最新版源码包

访问curl官网获取最新版本(如8.12.1):

bash 复制代码
wget https://curl.se/download/curl-8.12.1.tar.gz
tar -zxvf curl-8.12.1.tar.gz && cd curl-8.12.1

安装编译依赖

bash 复制代码
yum groupinstall 'Development Tools' -y
yum install openssl-devel libnghttp2-devel -y

配置编译选项

bash 复制代码
./configure --prefix=/usr/local/curl --with-brotli --with-openssl

若需禁用特定功能(如LDAP),可添加--disable-ldap等参数‌

如果报错:

configure: error: libpsl libs and/or directories were not found where specified!

通过 EPEL 仓库安装

bash 复制代码
# 安装 EPEL 仓库
yum install epel-release -y

# 更新仓库缓存
yum clean all && yum makecache

# 安装 libpsl-devel
yum install libpsl-devel -y

手动源码编译安装

bash 复制代码
# 安装编译依赖
yum install wget gcc make pkg-config -y

# 下载 libpsl 源码
wget https://github.com/rockdaboot/libpsl/releases/download/0.21.5/libpsl-0.21.5.tar.gz
# 解压并编译
tar -zxvf libpsl-0.21.5.tar.gz
cd libpsl-0.21.5
./configure
make
sudo make install

# 更新动态库缓存
sudo ldconfig

如果报错:

configure: error: BROTLI libs and/or directories were not found where specified!

安装Brotli 开发库

bash 复制代码
yum install brotli-devel -y

如果报错:

configure: error: libpsl libs and/or directories were not found where specified!

方法一:安装 libpsl-devel 依赖

通过 EPEL 仓库安装
bash 复制代码
# 确保已启用 EPEL 仓库
yum install epel-release -y

# 安装 libpsl-devel
yum install libpsl-devel -y
重新运行 configure
bash 复制代码
./configure --prefix=/usr/local/curl --with-brotli --with-openssl

方法二:禁用 PSL 支持

如果不需要 ‌Public Suffix List‌ 功能(例如域名后缀解析),可在配置时直接禁用:

bash 复制代码
./configure --prefix=/usr/local/curl --with-brotli --with-openssl

‌编译并安装

bash 复制代码
make && make install

替换系统旧版本

bash 复制代码
mv /usr/bin/curl /usr/bin/curl.bak  # 备份旧版本
cp /usr/local/curl/bin/curl /usr/bin/curl
echo "/usr/local/curl/lib" > /etc/ld.so.conf.d/curl.conf
ldconfig  # 更新动态库缓存
相关推荐
阿黎021420 分钟前
Linux驱动
linux
tjjingpan24 分钟前
HCIP-Datacom Core Technology V1.0_20 IPv6概述
linux·服务器·网络
云泽80841 分钟前
Linux基础开发工具(三):Vim高级配置、Swap恢复机制与Sudo权限白名单详解
linux·运维·vim
Urbano1 小时前
服装厂入局自动化开袋设备:市场前景、机型选型与落地实效科普
运维·自动化
tju23331 小时前
Gitee Test是什么:从测试资产管理到自动化执行的工程化实践
运维·gitee·自动化
名字还没想好☜1 小时前
Kubernetes Pod 调度实战:nodeSelector、亲和性与 taint/toleration 把 Pod 放到指定节点
运维·云原生·容器·kubernetes·调度
qetfw1 小时前
CentOS 7 vsftpd.conf 配置文件详解:监听、用户、权限、被动模式与 TLS
linux·运维·centos·ftp·vsftpd
风曦Kisaki1 小时前
Kubernetes(K8s)笔记Day04:控制器(ReplicaSet 与Deployment),滚动更新及回滚,滚动更新策略,Pod 的 DNS 策略
linux·运维·笔记·docker·容器·kubernetes
code_whiter1 小时前
初阶linux2环境基础开发工具完整教程
linux
薛定e的猫咪1 小时前
零基础选型指南:Make / 扣子 Coze/n8n/Dify 四大自动化平台完整对比
运维·自动化