若是是Ubuntu18.04, 系統自己已經帶了nghttp2了, 直接apt安裝就能夠. python
下載源代碼 https://github.com/nghttp2/nghttp2c++
若是是在Ubuntu下編譯nghttp2, 按官網上的說明安裝這一堆依賴就能夠了git
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, 須要本身摸索. 首先是各類依賴github
yum install libev-devel libevent-devel c-ares-devel jemalloc-devel jansson-devel python-devel zlib-devel
而後centos
./configure make make install
若是在make的過程當中遇到這樣的錯誤bash
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.ui
說明系統的編譯器版本過舊, 須要安裝Red Hat Developer Toolset https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/c++11
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 就能夠經過了server
最後記得運行ldconfig更新動態連接庫xml
sudo ldconfig
.