Build the source code
NoteAlmaLinux 8 is the recommended Linux development platform for YugabyteDB.
Install necessary packages
Update packages on your system, install development tools and additional packages:
sudo yum update -y sudo yum groupinstall -y 'Development Tools' sudo yum -y install epel-release libatomic rsync
Python 3.7 or higher is required.
The following example installs Python 3.9.
sudo yum install -y python39
In case there is more than one Python 3 version installed, ensure that
python3 refers to the right one.
sudo alternatives --set python3 /usr/bin/python3.9 sudo alternatives --display python3 python3 -V
CMake 3.17.3 or higher is required.
sudo yum install -y cmake3
By default, when running build, third-party libraries are not built, and pre-built libraries are downloaded.
We also use Linuxbrew to provide some of the third-party dependencies.
The build scripts automatically install these in directories under
In order for the build script to write under those directories, it needs proper permissions.
One way to do that is as follows:
sudo mkdir /opt/yb-build sudo chown "$(whoami)" /opt/yb-build
Alternatively, specify the build options
Note that those options may require additional, undocumented steps.
Use Ninja for faster builds.
The latest release can be downloaded:
latest_zip_url=$(curl -Ls "https://api.github.com/repos/ninja-build/ninja/releases/latest" \ | grep browser_download_url | grep ninja-linux.zip | cut -d \" -f 4) curl -Ls "$latest_zip_url" | zcat | sudo tee /usr/local/bin/ninja >/dev/null sudo chmod +x /usr/local/bin/ninja
Use Ccache for faster builds.
sudo yum install -y ccache # Also add the following line to your .bashrc or equivalent. export YB_CCACHE_DIR="$HOME/.cache/yb_ccache"
To compile with GCC, install the following packages, and adjust the version numbers to match the GCC version you plan to use.
sudo yum install -y gcc-toolset-11 gcc-toolset-11-libatomic-devel
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) 8 or 11.
- Apache Maven 3.3 or later.
Both requirements can be satisfied by the package manager.
sudo yum install -y java-1.8.0-openjdk maven
yugabyted-ui is a UI for yugabyted. By default, it is not built unless the corresponding build option is specified or a release package is being built. To build it, npm and Go 1.18 or higher are required.
sudo yum install -y npm golang
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.
NoteIf 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,
For more details about building and testing, refer to Build and test.
Build release package (optional)
Satisfy requirements for building yugabyted-ui.
yb_release script to build a release package:
$ ./yb_release ...... 2023-02-14 04:14:16,092 [yb_release.py:299 INFO] Generated a package at '/home/user/code/yugabyte-db/build/yugabyte-18.104.22.168-b8e42eecde0e45a743d51e244dbd9662a6130cd6-release-clang15-centos-x86_64.tar.gz'
The build may fail with "too many open files".
In that case, increase the nofile limit in
/etc/security/limits.conf as follows:
echo "* - nofile 1048576" | sudo tee -a /etc/security/limits.conf
Start a new shell session, and check the limit increase with