This document is based on https://github.com/grpc/grpc/blob/master/BUILDING.md.

Prerequisites

gRPC-Go requires Go 1.9 or later.

How to install go in linux

and

$ [sudo] apt-get install build-essential autoconf libtool pkg-config

If we plan to build from source and run tests, install the following as well:

$ [sudo] apt-get install libgflags-dev libgtest-dev
$ [sudo] apt-get install clang-5.0 libc++-dev

Run from grpc directory after cloning the repo with --recursive or updating submodules. he following commands will clone the gRPC repository at the latest stable version.

$ git clone -b $(curl -L <https://grpc.io/release>) <https://github.com/grpc/grpc>
$ cd grpc
$ git submodule update --init

Then,

$ mkdir -p cmake/build
$ cd cmake/build
$ cmake ../..
$ make

If you want to build shared libraries (.so files), run cmake with -DBUILD_SHARED_LIBS=ON.

(not recommended)