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  # 更新动态库缓存
相关推荐
两斤半11 分钟前
Debian TTY环境乱码
linux·debian
xmode29 分钟前
centos7.9安装ffmpeg6.1和NASM、Yasm、x264、x265、fdk-aac、lame、opus解码器
ffmpeg·centos
还是奇怪1 小时前
Linux - 安全排查 2
linux·运维·安全
牛奶咖啡132 小时前
Linux系统的常用操作命令——文件远程传输、文件编辑、软件安装的四种方式
运维·服务器·软件安装·linux云计算·scp文件远程传输·vi文件编辑·设置yum的阿里云源
难受啊马飞2.02 小时前
如何判断 AI 将优先自动化哪些任务?
运维·人工智能·ai·语言模型·程序员·大模型·大模型学习
会又不会2 小时前
Jenkins-Email Extension 插件插件
运维·jenkins
电脑能手3 小时前
[保姆级教程] 解决不同局域网电脑无法SSH的问题
运维·ssh·电脑
tan77º3 小时前
【Linux网络编程】Socket - UDP
linux·服务器·网络·c++·udp
czhc11400756633 小时前
Linux 76 rsync
linux·运维·python
你不知道我是谁?4 小时前
负载均衡--四层、七层负载均衡的区别
运维·服务器·负载均衡