Build the source code

Build the source code.


CentOS 7 is the recommended Linux development and production platform for YugabyteDB.

Install necessary packages

Update packages on your system, install development tools and additional packages:

sudo yum update
sudo yum groupinstall -y 'Development Tools'
sudo yum install -y ruby perl-Digest epel-release ccache git python2-pip python-devel python3 python3-pip python3-devel which
sudo yum install -y cmake3 ctest3 ninja-build

Prepare build tools

Make sure cmake/ctest binaries are at least version 3. On CentOS, one way to achieve this is to symlink them into /usr/local/bin.

sudo ln -s /usr/bin/cmake3 /usr/local/bin/cmake
sudo ln -s /usr/bin/ctest3 /usr/local/bin/ctest

You could also symlink them into another directory that is on your PATH.


We also use Linuxbrew to provide some of the third-party dependencies on CentOS. Linuxbrew allows us to create a portable package that contains its own copy of glibc and can be installed on most Linux distributions. However, we are transitioning away from using Linuxbrew and towards native toolchains on various platforms.

Our build scripts may automatically install Linuxbrew in a directory such as /opt/yb-build/brew/linuxbrew-<version> or ~/.linuxbrew-yb-build/linuxbrew-<version>. There is no need to add any of those directories to PATH.

Building the code

Assuming this repository is checked out in ~/code/yugabyte-db, do the following:

cd ~/code/yugabyte-db
./ release


If you see errors, such as g++: internal compiler error: Killed, the system has probably run out of memory. Try again by running the build script with less concurrency, for example, -j1.

The command above will build the release configuration, add the C++ binaries into the build/release-gcc-dynamic-ninja directory, and create a build/latest symlink to that directory.


You can find the binaries you just built in build/latest directory, which would be a symbolic link to build/release-gcc-dynamic-ninja in this case.

For Linux, it will first make sure our custom Linuxbrew distribution is installed into ~/.linuxbrew-yb-build/linuxbrew-<version>.

Build Java code

YugabyteDB core is written in C++, but the repository contains Java code needed to run sample applications. To build the Java part, you need:

Also make sure Maven's bin directory is added to your PATH (for example, by adding to your ~/.bashrc). See the example below (if you've installed Maven into ~/tools/apache-maven-3.6.3)

export PATH=$HOME/tools/apache-maven-3.6.3/bin:$PATH

For building YugabyteDB Java code, you'll need to install Java and Apache Maven.

Build release package

You can build a release package by executing:

$ ./yb_release
2020-10-27 20:52:27,978 [ INFO] Generated a package at '/home/user/code/yugabyte-db/build/yugabyte-'