Install
Release Policy
As of April 2023, we have ceased to release versions. Rather, the each commit to master branch is considered stable and ready for general use except for the features marked as experimental.
Dependencies
H2O requires the following softwares to be installed:
- C/C++ compiler (GCC or Clang)
- CMake
- pkg-config
- OpenSSL 1.0.2 or later, or a TLS stack compatible with OpenSSL1
- zlib
Additional softwares may be required for using certain features. As an example, to build the mruby handler, bison and ruby have to be installed.
Installing from Source
First, clone the master branch from the source repository as well as the submodules.
% git clone --recurse-submodules https://github.com/h2o/h2o.git
Then, build the obtained source using CMake2.
% cd h2o
% mkdir -p build
% cd build
% cmake ..
% make
% sudo make install
When complete, H2O will be installed under /usr/local
.
Start the installed server using the example configuration to confirm that it actually works (note: without the use of -m
option the server runs as a foreground process; press Ctrl-C
to stop).
% /usr/local/bin/h2o -c examples/h2o/h2o.conf
Or if you'd like to start H2O without installing it, you can use the H2O_ROOT
environment variable.
% H2O_ROOT=$PWD build/h2o -c examples/h2o/h2o.conf
The example configuration starts a server that listens to port 8080 (HTTP) and port 8081 (HTTPS). Try to access the ports using the protocols respectively (note: when accessing via HTTPS it is likely that you would see hostname mismatch errors reported by the web browsers).
When complete, proceed to Configure section for how to setup the server.
CMake Options
Following list shows the interesting arguments recognized by CMake.
-DCMAKE_INSTALL_PREFIX=directory
-
This option specifies the directory to which H2O will be installed (default:
/usr/local
). -DWITH_MRUBY=on|off
- This option instructs whether or not to build the standalone server with support for scripting using mruby. It is turned on by default if the prerequisites (bison, ruby and the development files3) are found.
-DWITH_DTRACE=on|off
-DWITH_H2OLOG=on|off
h2olog(1)
> support.
It is turned on by default if the prerequisites are found.
See also h2olog for details.
-DOPENSSL_ROOT_DIR=/path/to/openssl
-DCMAKE_C_FLAGS=...
-DCMAKE_C_FLAGS="-fsanitize=address -fno-stack-protector -fno-omit-frame-pointer"
.
-DCMAKE_BUILD_TYPE=Release|Debug
Release
or Debug
.
The default is Release
.
Installing a Binary Package
Thanks to others, H2O is provided as a binary package on some environments. Up-to-date versions of H2O might be found at the following locations.
Notes:
- At the time of writing, H2O can be built with libressl and boringssl.
- CMake is a popular build tool that can be found as a binary package on most operating systems.
mkmf
- a program for building ruby extensions is required. In many distributions, the program is packaged as part ofruby-dev
or
ruby-devel
package.