Project: YugabyteDB (App Definition and Development / Database)
File: build-from-src-centos.md

title: Build from source code on CentOS headerTitle: Build the source code linkTitle: Build the source description: Build YugabyteDB from source code on CentOS. headcontent: Build the source code. menu: preview: identifier: build-from-src-3-centos parent: core-database weight: 2912 type: docs <ul class="nav nav-tabs-alt nav-tabs-yb"> <li > <a href="{{< relref "./build-from-src-almalinux.md" >}}" class="nav-link"> <i class="fa-brands fa-linux" aria-hidden="true"></i> AlmaLinux </a> </li> <li > <a href="{{< relref "./build-from-src-macos.md" >}}" class="nav-link"> <i class="fa-brands fa-apple" aria-hidden="true"></i> macOS </a> </li> <li > <a href="{{< relref "./build-from-src-centos.md" >}}" class="nav-link active"> <i class="fa-brands fa-linux" aria-hidden="true"></i> CentOS </a> </li> <li > <a href="{{< relref "./build-from-src-ubuntu.md" >}}" class="nav-link"> <i class="fa-brands fa-linux" aria-hidden="true"></i> Ubuntu </a> </li> </ul> {{< note title="Note" >}} AlmaLinux 8 is the recommended Linux development platform for YugabyteDB. {{< /note >}} The following instructions are for CentOS 7. {{% readfile "includes/tldr.md" %}} ```sh shellrc=~/.bashrc sudo yum update -y sudo yum groupinstall -y 'Development Tools' sudo yum install -y centos-release-scl epel-release packages=( ccache cmake3 devtoolset-11 devtoolset-11-libatomic-devel git golang java-1.8.0-openjdk libatomic ninja-build npm patchelf rh-maven35 rh-python38 rsync which ) sudo yum install -y "${packages[@]}" sudo ln -s /usr/bin/cmake3 /usr/local/bin/cmake sudo ln -s /usr/bin/ctest3 /usr/local/bin/ctest sudo mkdir /opt/yb-build sudo chown "$USER" /opt/yb-build source <(echo 'source /opt/rh/rh-python38/enable' \ | tee -a "$shellrc") source <(echo 'source /opt/rh/rh-maven35/enable' \ | tee -a "$shellrc") source <(echo 'export YBCCACHEDIR="$HOME/.cache/yb_ccache"' \ | tee -a "$shellrc") git clone https://github.com/yugabyte/yugabyte-db cd yugabyte-db ./yb_release ``` Update and install basic development packages as follows: ```sh sudo yum update -y sudo yum groupinstall -y 'Development Tools' sudo yum install -y centos-release-scl epel-release git libatomic rsync which ``` {{% readfile "includes/opt-yb-build.md" %}} {{% readfile "includes/python.md" %}} The following example installs Python 3.8. ```sh sudo yum -y install rh-python38 source /opt/rh/rh-python38/enable ``` {{% readfile "includes/cmake.md" %}} The package manager has that, but we still need to link the name `cmake` to `cmake3`. Do similarly for `ctest`. ```sh sudo yum install -y cmake3 sudo ln -s /usr/bin/cmake3 /usr/local/bin/cmake sudo ln -s /usr/bin/ctest3 /usr/local/bin/ctest ``` {{% readfile "includes/java.md" %}} Install the following packages to satisfy the preceding requirements: ```sh sudo yum install -y java-1.8.0-openjdk rh-maven35 source /opt/rh/rh-maven35/enable ``` {{% readfile "includes/yugabyted-ui.md" %}} ```sh sudo yum install -y npm golang ``` {{% readfile "includes/ninja.md" %}} ```sh sudo yum install -y ninja-build ``` {{% readfile "includes/ccache.md" %}} ```sh sudo yum install -y ccache export YBCCACHEDIR="$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. ```sh sudo yum install -y devtoolset-11 devtoolset-11-libatomic-devel ``` Note: there may be compilation issues (). {{% readfile "includes/build-the-code.md" %}} Perform the following steps to build a release package: . Install patchelf: ```sh sudo yum install -y patchelf ``` Run the `yb_release` script using the following command: ```sh ./yb_release ``` ```output.sh ...... 2023-02-10 23:19:46,459 [ybrelease.py:299 INFO] Generated a package at '/home/user/code/yugabyte-db/build/yugabyte-2.17.2.0-44b735cc69998d068d561f4b6f337b318fbc2424-release-clang15-centos-x8664.tar.gz' ``` {{% readfile "includes/ulimit.md" %}}