可说欢喜
DevOps

Centos7更新curl及libcurl

by 温柔, 2019-06-21


今天安装aliyun-log-c-sdk-lite make的时候报错

make error.png

问了下群里的大哥是缺少curl但是我curl和libcurl全都装过了的,然后去github看了下aliyun-log-c-sdk-lite的官方文档

发现文档说libcurl建议 7.49.0 及以上版本然后我看了下机子上的版本才7.29

于是上网搜索了一下怎么更新curl及libcurl

方法如下:

1.安装libcurl的yum源

rpm -ivh http://mirror.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-2-1.rhel7.noarch.rpm

2.执行yum upgrade更新

yum upgrade libcurl curl

然后这里你会发现什么都没有发生要把编辑city-fa源把enabled=0改为enabled=1

vi /etc/yum.repos.d/city-fan.org.repo

在执行
libnghttp2 so error.png

Error: Package: libcurl-7.65.1-1.0.cf.rhel7.x86_64 (city-fan.org)
       Requires: libnghttp2.so.14()(64bit)

解决方法:

1.安装epel源

yum install epel-release -y

2.重新执行上面的安装命令然后依然报错Requires: libnghttp2.so.14()(64bit)

最终解决方法执行:

yum --enablerepo=epel install libnghttp2 -y && yum install libcurl -y

curl更新成功make成功.png

总结

aliyun-log-c-sdk-lite 官方文档说是libcurl建议 7.49.0 及以上版本其实是必须要libcurl>=7.49 不然编译会报错
网上大部分都是Centos6的教程还有对着改一下才行

懒人一键脚本:

https://github.com/Seevil/uplibcurl

git clone https://github.com/Seevil/uplibcurl.git 

cd uplibcurl && chmod u+x uplibcurl.sh && ./uplibcurl.sh 
libcurl
温柔

作者: 温柔

2024 © typecho & elise