参考网站https://docs.bazel.build/versions/master/install-ubuntu.html进行。
使用Bazel custom APT安装
首先,安装jdk8。
安装JDK8
sudo apt-get install openjdk-8-jdk
在包资源中增加Bazel的发布源
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
安装和更新Bazel
sudo apt-get update && sudo apt-get install bazel
sudo apt-get upgrade bazel