转载于:https://www.cnblogs.com/huangweimin/articles/15882913.html
CentOS 7 默认的 curl 版本最新就到 7.29 ,它是不支持http2的
# curl --version curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.53.1 zlib/1.2.7 libidn/1.28 libssh2/1.8.0 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz unix-sockets # curl --http2 https://www.baidu.com curl: option --http2: is unknown curl: try 'curl --help' or 'curl --manual' for more information
最近业务上有需求,需要curl支持http2,其实是php依赖的libcurl扩展,本质上是libcurl的版本低了。所以需要升级curl,但是网上的文章都是说要编译curl安装,比较麻烦,容易出错。且还要区分安装openSSL还是NSS, 所以建议使用rpm的yum update来更新curl
一、添加city-fan.org的源
vim /etc/yum.repos.d/city-fan.org.repo # 编辑文件添加如下
[city-fan.org] name=city-fan.org repository for Red Hat Enterprise Linux (and clones) $releasever ($basearch) #baseurl=http://mirror.city-fan.org/ftp/contrib/yum-repo/rhel$releasever/$basearch mirrorlist=http://mirror.city-fan.org/ftp/contrib/yum-repo/mirrorlist-rhel$releasever enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-city-fan.org [city-fan.org-debuginfo] name=city-fan.org debuginfo repository for Red Hat Enterprise Linux (and clones) $releasever ($basearch) #baseurl=http://www.city-fan.org/ftp/contrib-debug/rhel$releasever/$basearch mirrorlist=http://www.city-fan.org/ftp/contrib-debug/mirrorlist-rhel$releasever enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-city-fan.org [city-fan.org-source] name=city-fan.org source repository for Red Hat Enterprise Linux (and clones) $releasever #baseurl=http://mirror.city-fan.org/ftp/contrib/yum-repo/rhel$releasever/source mirrorlist=http://mirror.city-fan.org/ftp/contrib/yum-repo/source-mirrorlist-rhel$releasever enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-city-fan.org
二、更新curl
# yum update curl
三、测试,发现curl已经更新了,支持http2
标签:city,8.2,releasever,update,centos7,fan,yum,org,curl From: https://www.cnblogs.com/zinging/p/17934351.html