Build the source code

Build the source code.

Note

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

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.

Note

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>. There is no need to add any of those directories to PATH.

Java

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

  • Java Development Kit (JDK) 1.8. JDK installers for Linux and macOS can be downloaded from OpenJDK, AdoptOpenJDK, or Azul Systems. Homebrew users on macOS can install using brew install openjdk.
  • Apache Maven 3.3 or later.

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

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

Build the code

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

cd ~/code/yugabyte-db
./yb_build.sh release

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

Note

If you see errors, such as 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.

For more details about building and testing, refer to Build and test.

Build release package

Run the yb_release script to build a release package:

$ ./yb_release
......
2020-10-27 20:52:27,978 [yb_release.py:283 INFO] Generated a package at '/home/user/code/yugabyte-db/build/yugabyte-2.5.1.0-8696bc05a97c4907b53d6446b5bfa7acb28ceef5-release-centos-x86_64.tar.gz'