广告

本站里的文章大部分经过自行整理与测试

2017年10月28日星期六

CentOS - CURL - HTTP1.1 改为 HTTP2

1) 准备

$ sudo yum -y groupinstall "Development Tools"
$ sudo yum -y install libev libev-devel zlib zlib-devel openssl openssl-devel git
$ sudo yum -y install jansson-devel libxml2-devel libevent-devel python-devel

$ wget https://c-ares.haxx.se/download/c-ares-1.12.0.tar.gz -O /tmp/c-ares.tar.gz
$ mkdir -p /tmp/c-ares
$ tar -zxvf /tmp/c-ares.tar.gz -C /tmp/c-ares --strip-components=1
$ cd /tmp/c-ares
$ ./configure --libdir=/usr/lib64
$ make
$ sudo make install

$ git clone https://github.com/jemalloc/jemalloc.git
$ cd jemalloc
$ ./autogen.sh
$ make
$ sudo make install

2) nghttp2

$ cd ~/Downloads

$ git clone https://github.com/tatsuhiro-t/nghttp2.git
$ cd nghttp2
$ autoreconf -i
$ automake
$ autoconf
$ ./configure
$ make
$ sudo make install

3) CURL

$ cd ~/Downloads

$ git clone https://github.com/bagder/curl.git
$ cd curl
$ ./buildconf
$ ./configure --with-nghttp2=/usr/local --with-ssl
$ make 
$ sudo make install

4) 将 /usr/local/lib 写入 /etc/ld.so.conf.d/custom-libs.conf

$ su root
$ echo '/usr/local/lib' > /etc/ld.so.conf.d/custom-libs.conf
$ ldconfig
$ ldconfig -p| grep libnghttp2

5) 测试

$ su user
$ cd ~/Downloads/curl

$ ./src/curl -V
$ ./src/curl --http2 -I https://nghttp2.org/

没有评论:

发表评论