Installing Bazel
Bazel is a fast and scalable build tool. Before compiling TF-Serving, install Bazel.
- Use PuTTY to log in to a server as the root user.
- Go to the installation path of the Bazel source code.
cd /path/to/bazel
- Install the Bazel dependencies.
yum install java-11-openjdk java-11-openjdk-devel
Check whether OpenJDK 11 is successfully installed.
java -version

If the preceding information is displayed, the installation is successful.
An earlier OpenJDK version may cause an error during Bazel compilation.
- (Optional) If the preceding command output displays an incorrect version, configure environment variables.
- Search for the installation directory.
find / -name java
- Configure environment variables. Assume that the installation directory is /usr/lib/jvm/java-11-openjdk-11.0.21.9-1.oe2203sp3.aarch64.
- Method 1 (permanently effective):
echo "export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.21.9-1.oe2203sp3.aarch64" >> /etc/profile echo "export PATH=\${JAVA_HOME}/bin:\${PATH}" >> /etc/profile source /etc/profile - Method 2 (temporarily effective on the current session terminal):
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.21.9-1.oe2203sp3.aarch64 export PATH=/usr/lib/jvm/java-11-openjdk-11.0.21.9-1.oe2203sp3.aarch64/bin:$PATH
- Method 1 (permanently effective):
- Check the OpenJDK version.
java -version
- Search for the installation directory.
- Download the Bazel 6.5.0 source code to the server.
wget https://releases.bazel.build/6.5.0/release/bazel-6.5.0-dist.zip --no-check-certificate
- Decompress the Bazel source package and go to the decompressed directory.
unzip bazel-6.5.0-dist.zip -d bazel-6.5.0 cd bazel-6.5.0
- Install, decompress, and compile Bazel.
env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" bash ./compile.sh
- After the build is successful, the generated executable file bazel is stored in the bazel-6.5.0/output path. Configure the path in the environment variable PATH for subsequent TF-Serving compilation.
export PATH=/path/to/bazel/bazel-6.5.0/output:$PATH
- Check whether the installation is successful.
bazel --help

If the correct version is displayed, the installation is successful.
Parent topic: Configuring the Compilation Environment