在Centos7下安装nghttp2
如果是Ubuntu18.04, 系统本身已经带了nghttp2了, 直接apt安装就可以.
下载源代码 https://github.com/nghttp2/nghttp2
如果是在Ubuntu下编译nghttp2, 按官网上的说明安装这一堆依赖就可以了
sudo apt install g++ make binutils autoconf automake autotools-dev libtool pkg-config \ zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev libjansson-dev \ libc-ares-dev libjemalloc-dev libsystemd-dev \ cython python3-dev python-setuptools
如果是Centos7, 需要自己摸索. 首先是各种依赖
yum install libev-devel libevent-devel c-ares-devel jemalloc-devel jansson-devel python-devel zlib-devel
然后
./configure make make install
如果在make的过程中遇到这样的错误
error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
说明系统的编译器版本过旧, 需要安装Red Hat Developer Toolset https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/
sudo yum install centos-release-scl # 这行不运行貌似也可以 sudo yum-config-manager --enable rhel-server-rhscl-7-rpms # 安装 sudo yum install devtoolset-7 # 检查已安装的列表 sudo yum list devtoolset-7\* # 这一步才会启用新安装的编译器, 之后运行./configure能看到 C++ compilern 增加了-std=c++14参数 scl enable devtoolset-7 bash
.然后再./configure 和 make 就可以通过了
最后记得运行ldconfig更新动态链接库
sudo ldconfig
.