This section takes Linux as an example to introduce the installation process. Other systems are similar;

System Requirements

  • The Linux kernel should be not lower than 2.6.9, 64-bit version;
  • The gcc version is not less than 5.4.0;
  • Use cmake as the build tool, and the cmake version should be not less than 3.5;
  • Use git as the version management tool;

Library Dependencies

  • trantor, a non-blocking I/O C++ network library, also developed by the author of Drogon, has been used as a git repository submodule, no need to install in advance;
  • jsoncpp, JSON's c++ library, the version should be no less than 1.7;
  • libuuid, generating c library of uuid;
  • zlib, used to support compressed transmission;
  • OpenSSL, not mandatory, if the OpenSSL library is installed, drogon will support HTTPS as well, otherwise drogon only supports HTTP.
  • c-ares, not mandatory, if the c-ares library is installed,drogon will be more efficient with DNS;
  • libbrotli, not mandatory, if the libbrotli library is installed, drogon will support brotli compression when sending HTTP responses;
  • boost, the version should be no less than 1.61, is required only if the C++ compiler does not support C++ 17.
  • the client development libraries of postgreSQL, mariadb and sqlite3, not mandatory, if one or more of them is installed, drogon will support access to the according database.
  • gtest, not mandatory, if the gtest library is installed, the unit tests can be compiled.

System Preparation Examples

Ubuntu 18.04


sudo apt install git
sudo apt install gcc
sudo apt install g++
sudo apt install cmake


sudo apt install libjsoncpp-dev


sudo apt install uuid-dev


sudo apt install openssl
sudo apt install libssl-dev


sudo apt install zlib1g-dev

CentOS 7.5


yum install git
yum install gcc
yum install gcc-c++

The default installed cmake version is too low, use source installation

git clone
cd CMake/
./bootstrap && make && make install

Upgrade gcc

yum install centos-release-scl
yum install devtoolset-8
scl enable devtoolset-8 bash

Note: Command scl enable devtoolset-8 bash only active the new gcc temporarily until the session is end. If you want to always use the new gcc, you could run command echo "/opt/rh/devtoolset-8/enable" >>/etc/profile.d/, system will active the new gcc automatic after reboot.


git clone
cd jsoncpp/
mkdir build
cd build
cmake ..
make && make install


yum install libuuid-devel


yum install openssl-devel


yum install zlib-devel

Database Environment

Note: These libraries below are not mandatory. You could choose to install one or more database according to your actual needs.

Note: If you want to develop you webapp with database, please install the database develop environment first, then install drogon, otherwise you will encount NO DATABASE FOUND issue.


PostgreSQL's native C library libpq needs to be installed. The installation is as follows:

  • ubuntu 16: sudo apt-get install postgresql-server-dev-all
  • ubuntu 18: sudo apt-get install postgresql-all
  • centOS 7: yum install postgresql-devel
  • MacOS: brew install postgresql


MySQL's native library does not support asynchronous read and write. Fortunately, MySQL also has a version of MariaDB maintained by the original developer community. This version is compatible with MySQL, and its development library supports asynchronous read and write. Therefore, Drogon uses the MariaDB development library to provide the right MySQL support, as a best practice,your operating system shouldn't install both Mysql and MariaDB at the same time.

MariaDB installation is as follows:

  • ubuntu: sudo apt install libmariadbclient-dev
  • centOS 7: yum install mariadb-devel
  • MacOS: brew install mariadb


  • ubuntu: sudo apt-get install libsqlite3-dev
  • centOS: yum install sqlite-devel
  • MacOS: brew install sqlite3

Note: Some of the above commands only install the development library. If you want to install a server also, please use Google search yourself.

Drogon Installation

Assuming that the above environment and library dependencies are all ready, the installation process is very simple;

git clone
cd drogon
git submodule update --init
mkdir build
cd build
cmake ..
make && sudo make install

The default is to compile the debug version. If you want to compile the release version, the cmake command should take the following parameters:

cmake -DCMAKE_BUILD_TYPE=Release .. 

After the installation is complete, the following files will be installed in the system(One can change the installation location with the CMAKE_INSTALL_PREFIX option):

  • The header file of drogon is installed into /usr/local/include/drogon;
  • The drogon library file libdrogon.a is installed into /usr/local/lib;
  • Drogon's command line tool drogon_ctl is installed into /usr/local/bin;
  • The trantor header file is installed into /usr/local/include/trantor;
  • The trantor library file libtrantor.a is installed into /usr/local/lib;

Include drogon source code locally

Of course, you can also include the drogon source in your project. Suppose you put the drogon under the third_party of your project directory (don't forget to update submodule in the drogon source directory). Then, you only need to add the following two lines to your project's cmake file:

target_link_libraries(${PROJECT_NAME} PRIVATE drogon)

Use vcpkg

The easiest way to install drogon on windows is to use vcpkg

vcpkg.exe install drogon


vcpkg.exe install drogon:x64-windows

Use Docker Image

We also provide a pre-build docker image on the docker hub. All dependencies of Drogon and Drogon itself are already installed in the docker environment, where users can build Drogon-based applications directly.

03 Quick Start

Add Discussion as Guest

Log in to DocsForge