centos7 升級curl版本

curl的官網: http://www.city-fan.org/

1、安裝repo

rpm -Uvh  http://www.city-fan.org/ftp/contrib/yum-repo/rhel6/x86_64/city-fan.org-release-2-1.rhel6.noarch.rpm

3、修改該repo的enable爲1

 

vim /etc/yum.repos.d/city-fan-for-curl.repo
[CityFanforCurl]
name=City Fan Repo
baseurl=http://www.city-fan.org/ftp/contrib/yum-repo/rhel7/x86_64/
enabled=0
gpgcheck=0

4、安裝最新的curl

yum update curl --enablerepo=CityFanforCurl -y

5、如果提示缺少依賴 libnghttp2.so.14()(64bit)

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/Packages/l/libnghttp2-1.6.0-1.el6.1.x86_64.rpm
然後重複第4步即可

6、查看curl版本

# curl -V
curl 7.62.0 (x86_64-redhat-linux-gnu) libcurl/7.62.0 NSS/3.36 zlib/1.2.7 libpsl/0.7.0 (+libicu/50.1.2) libssh2/1.8.0 nghttp2/1.31.1
Release-Date: 2018-10-31
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy PSL Metalink 

或者源碼安裝

下載7.63的源碼

wget http://curl.haxx.se/download/curl-7.69.1.tar.gz

解壓

tar -xvf curl-7.69.1.tar.gz
cd curl.7.69.1


指定安裝目錄

./configure --prefix=/usr/local/curl

編譯安裝
sudo make
sudo make install
 
添加命令的環境變量
export PATH=$PATH:/usr/local/curl/bin
 
C或者C++調用使用的頭文件
#include <curl/curl.h>
 
 
複製頭文件到系統目錄,也可以自己添加
sudo cp -R /usr/local/curl/include/curl /usr/include

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章