Build the source code

Build the source code on macOS, CentOS, and Ubuntu.

Note

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

Install necessary packages

First, install Homebrew, if you do not already have it. Homebrew is used to install the other required packages.

/usr/bin/ruby -e "$(
  curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install the following packages using Homebrew:

brew install autoconf automake bash ccache cmake coreutils gnu-tar libtool \
             maven ninja pkg-config pstree wget python

Note

YugabyteDB build scripts require at least Bash version 4. Make sure that bash --version outputs a version of 4 or higher before proceeding. You may need to put /usr/local/bin (Intel) or /opt/homebrew/bin (Apple Silicon) as the first directory on PATH in your ~/.bashrc to achieve that.

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 13:55:40,856 [yb_release.py:283 INFO] Generated a package at '/Users/me/code/yugabyte-db/build/yugabyte-2.5.1.0-6ab8013159fdca00ced7e6f5d2f98cacac6a536a-release-darwin-x86_64.tar.gz'