Although not mandatory, Apache Dubbo supports using Protocol Buffers (proto3) for service definitions and serialization protocols.
Within the protocol buffer framework, we use .proto
files to define services and message body formats, and the protoc
compiler to compile .proto
files. You can install protoc
in the following ways.
On Linux or macOS, you can use a package manager to install protoc
.
Be sure to check the installed version of protoc
! This can be done as described below, since some package managers might install severely outdated versions of protoc
.
The Binary Installation method mentioned in the next section ensures that you install the correct version of protoc
.
Linux, using apt
or apt-get
, for example:
$ apt install -y protobuf-compiler
$ protoc --version # Ensure compiler version is 3+
macOS, using Homebrew:
$ brew install protobuf
$ protoc --version # Ensure compiler version is 3+
Follow these steps to install the latest version of the protoc
binary package:
Manually download the binary files for your OS from github.com/google/protobuf/releases
(protoc-<version>-<os>-<arch>.zip
), or use the following commands to download directly:
$ PB_REL="https://github.com/protocolbuffers/protobuf/releases"
$ curl -LO $PB_REL/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip
Unzip the file to the $HOME/.local
directory, or any directory of your choice. For example:
$ unzip protoc-3.15.8-linux-x86_64.zip -d $HOME/.local
Modify the system PATH
to include the protoc
executable. For example:
$ export PATH="$PATH:$HOME/.local/bin"
If you want to compile from the source yourself, or if you want to install an older version of the binary package, please refer to Download Protocol Buffers