Build from source code¶
Build Percona Server for MongoDB 9.0 from the v9.0 source branch.
For a reproducible release build, select the corresponding release tag from the
source repository.
Build options¶
Manual build¶
The 9.0 source tree uses Bazel. Use the 9.0 build requirements for compiler, Python, and operating system dependencies.
Build steps¶
-
Clone the 9.0 source tree:
git clone --branch v9.0 https://github.com/percona/percona-server-mongodb.git cd percona-server-mongodb -
(Recommended) Create and activate a Python virtual environment:
python3 -m venv .venv source .venv/bin/activateYou can skip the virtual environment in a temporary container or other temporary build environment. In that case, make sure
python3points to Python 3.13 or later. -
Install the Python dependencies:
buildscripts/poetry_sync.shIf you skipped the virtual environment, run
buildscripts/poetry_sync.sh -fin the temporary environment. -
Install Bazel with the repository helper:
python3 buildscripts/install_bazel.py export PATH="$HOME/.local/bin:$PATH" -
Build the server binaries:
bazel build --config=psmdb_opt_release install-mongod install-mongos -
Check the built server version:
bazel-bin/install-mongod/bin/mongod --versionThe version comes from the Git metadata of your checkout. A release tag gives a release version, and a branch build shows a development version string.
The build creates target-specific installation directories under bazel-bin.
For other targets, see Bazel targets.
Use the build script¶
The 9.0 packaging script creates source archives, binary tarballs, and DEB or RPM packages. Use a disposable build environment for the target operating system. The dependency installation step requires root access.
The examples use version 9.0.8-1 as the package version.
The v9.0 branch selects branch sources, rather than an immutable release snapshot.
For release builds, use the matching release tag for both the script and --branch.
Prepare the build environment¶
-
Create separate script and build directories:
mkdir -p /tmp/psmdb/scripts /tmp/psmdb/build cd /tmp/psmdb/scripts -
Download the script for the source branch:
curl -fL https://raw.githubusercontent.com/percona/percona-server-mongodb/v9.0/percona-packaging/scripts/psmdb_builder.sh -o psmdb_builder.sh -
Install dependencies in the build environment:
sudo bash ./psmdb_builder.sh --builddir=/tmp/psmdb/build --install_deps=1
Tarballs¶
Build a binary tarball from the 9.0 source branch:
bash ./psmdb_builder.sh \
--builddir=/tmp/psmdb/build \
--repo=https://github.com/percona/percona-server-mongodb.git \
--branch=v9.0 --psm_ver=9.0.8 --psm_release=1 \
--get_sources=1 --build_tarball=1
Find the generated tarballs in /tmp/psmdb/build/tarball/.
Packages¶
Build packages in an environment that matches the target package format:
bash ./psmdb_builder.sh \
--builddir=/tmp/psmdb/build \
--repo=https://github.com/percona/percona-server-mongodb.git \
--branch=v9.0 --psm_ver=9.0.8 --psm_release=1 \
--get_sources=1 --build_src_deb=1 --build_deb=1
Find source packages in /tmp/psmdb/build/source_deb/ and binary packages in /tmp/psmdb/build/deb/.
bash ./psmdb_builder.sh \
--builddir=/tmp/psmdb/build \
--repo=https://github.com/percona/percona-server-mongodb.git \
--branch=v9.0 --psm_ver=9.0.8 --psm_release=1 \
--get_sources=1 --build_src_rpm=1 --build_rpm=1
Find source packages in /tmp/psmdb/build/srpm/ and binary packages in /tmp/psmdb/build/rpm/.