1、下载git、golang
sudo apt-get install git
sudo apt-get install golang
2、下载go语言的protobuf
获取 goprotobuf 提供的 Protobuf 编译器插件 protoc-gen-go
cd ~/go/src/
go get github.com/golang/protobuf/protoc-gen-go
cd github.com/golang/protobuf/protoc-gen-go
go build
将bin/protoc-gen-go加入环境变量
export GOPATH=/home/zhaojunyan/go
export PATH=/usr/local/go/bin:$GOPATH/bin
vim ~/.profile
source ~/.profile
获取 goprotobuf 提供的支持库,包含诸如编码(marshaling)、解码(unmarshaling)等功能
go get github.com/golang/protobuf/proto
cd ~/go/src/github.com/golang/protobuf/proto
go build
go install
去https://github.com/google/protobuf/releases下载对应的protoc二进制执行文件,如protoc-3.5.1-linux-x86_64.zip,解压将bin下protoc放到go/bin下即可