三. protoc的安装:
1. 安装grpc的相关依赖,执行以下命令:
yum install -y gcc-c++ autoconf libtool
yum groupinstall -y "Development Tools"
2. 下载源码:
是用wget下载protobuf包
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.10.0/protobuf-all-3.10.0.tar.gz
tar zvxf protobuf-all-3.10.0.tar.gz
cd protobuf-3.10.0/
./autogen.sh
./configure -prefix=/usr/local/
make
make install
ldconfig
3. protoc-gen-go插件安装
go get -u github.com/golang/protobuf/protoc-gen-go
cd /home/gopath/pkg/mod/github.com/golang/protobuf@v1.5.2/protoc-gen-go
go build
cp protoc-gen-go /usr/local/bin/
至此protoc已经安装完成。