Protocol Buffer Compiler Installation

How to install the protocol buffer compiler.

While not mandatory, gRPC applications often leverage Protocol Buffers for service definitions and data serialization. Most of the example code from this site uses version 3 of the protocol buffer language (proto3).

The protocol buffer compiler, protoc, is used to compile .proto files, which contain service and message definitions. Choose one of the methods given below to install protoc.

Install pre-compiled binaries (any OS)

To install the latest release of the protocol compiler from pre-compiled binaries, follow these instructions:

  1. Manually download from github.com/google/protobuf/releases the zip file corresponding to your operating system and computer architecture (protoc-<version>-<os>-<arch>.zip), or fetch the file using commands such as the following:

    # cd /root
    # curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v22.0/protoc-22.0-linux-x86_64.zip
    
  2. Unzip the file under $HOME/.local or a directory of your choice. For example:

    # unzip protoc-22.0-linux-x86_64.zip -d $HOME/.local
    
  3. Update your environment’s path variable to include the path to the protoc executable and add below line in php.ini file. For example:

    # export PATH="$PATH:$HOME/.local/bin"
    echo "extension=protobuf.so" >> /etc/php.ini

Other installation options

If you’d like to build the protocol compiler from sources, or access older versions of the pre-compiled binaries, see Download Protocol Buffers.

  • protoc, install protoc on centos 7
  • 0 Usuários acharam útil
Esta resposta lhe foi útil?

Artigos Relacionados

How to upgrade PHP to 7.4 in centos 7?

Enter the following commands on the terminal to upgrade PHP:      1 . To install the latest...

How to Install Go on CentOS 7

Go, often referred to as golang is a modern open-source programming language created by Google....

Configure gRPC for go and protoc

Quick start This guide gets you started with gRPC in Go with a simple working example....

Installing Bazel on CentOS 7

Download the corresponding .repo file from Fedora COPR and copy it to /etc/yum.repos.d/....