Preface

The installation procedure has been explained in its official repo here. However, there are several tools we need to install before installing the gRCP Gateway plugin.

Installing prerequisite tools

Run the following commands:

sudo apt update
sudo apt install build-essential libtool autoconf automake

Installing ProtocolBuffers

Run the following commands to install ProtocolBuffers:

mkdir tmp
cd tmp
git clone https://github.com/protocolbuffers/protobuf
cd protobuf
./autogen.sh
./configure
make
make check
sudo make install

Installing packages

Run the following commands to clone the repos to $GOPATH\src then install them:

go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u github.com/golang/protobuf/protoc-gen-go

Update LD_LIBRARY_PATH

After installing gRPC Gateway, Proto Compiler (protoc) may not be able to find shared libraries. Run one of the following commands:

sudo ldconfig

or

export LD_LIBRARY_PATH=/usr/local/lib

Source links:
gRCP Gateway installation guide
Solution of undefined macro
Protobuf cannot find shared libraries