Ubunt下安装H2O

更新系统

apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get autoremove --purge -y && apt-get autoclean -y

安装必备软件

apt-get install locate git cmake build-essential checkinstall autoconf pkg-config libtool python-sphinx wget libcunit1-dev nettle-dev libyaml-dev libuv-dev -y

安装wslay

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

安装完成后检查lib文件,如下所示:

ls /usr/local/lib/
libuv.a   libuv.so.1      libwslay.la    libwslay.so.0.0.1  python3.4
libuv.la  libuv.so.1.0.0  libwslay.so    pkgconfig
libuv.so  libwslay.a      libwslay.so.0  python2.7

安装最新版OpenSSL

删除旧版OpenSSL

apt-get remove --purge openssl libssl-dev

下载新版OpenSSL

wget https://www.openssl.org/source/openssl-1.0.2.tar.gz --no-check-certificate
tar -xvzf openssl-1.0.2.tar.gz
mv openssl-1.0.2 openssl
cd openssl/

建立openssl.ld文件,内容如下:

vi openssl.ld

OPENSSL_1.0.0 {
	global:
		*;

	local:
		*;
};

OPENSSL_1.0.1 {
} OPENSSL_1.0.0;

OPENSSL_1.0.1d {
} OPENSSL_1.0.1;

OPENSSL_1.0.2 {
} OPENSSL_1.0.1d;

接下开始安装OpenSSL

./config -fPIC shared -Wl,--version-script=/root/openssl/openssl.ld -Wl,-Bsymbolic-functions
make
make test
make install

检查安装结果

/usr/local/ssl/bin/openssl version
OpenSSL 1.0.2 22 Jan 2015

设置环境变量

export OPENSSL_INCLUDE_DIR=/usr/local/ssl/include/
export OPENSSL_LIBRARIES='/usr/local/ssl/lib/libssl.so;/usr/local/ssl/lib/libcrypto.so'
export LD_LIBRARY_PATH=/usr/local/ssl/lib/

安装H2O

新建FindOpenSSL.cmake文件

cd h2o/
vi cmake/FindOpenSSL.cmake
FIND_PATH(OPENSSL_INCLUDE_DIR NAMES openssl/ssl.h)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENSSL DEFAULT_MSG OPENSSL_LIBRARIES
OPENSSL_INCLUDE_DIR)

编译安装H2O

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/h2o -DOPENSSL_LIBRARIES='/usr/local/ssl/lib/libssl.so;/usr/local/ssl/lib/libcrypto.so' -DOPENSSL_INCLUDE_DIR=/usr/local/ssl/include/
make
make install

运行H2O

/usr/local/h2o/bin/h2o -c examples/h2o/h2o.conf
发布于