golang安装 :
1:https://www.golangtc.com/static/go/1.9.2/
选择对应版本下载(go1.9.2.linux-amd64.tar.gz)
2: tar xzvf go1.9.2.linux-amd64.tar.gz -C /usr/local/
3:vim etc/profile(添加环境变量)
export GOPATH = /usr/local/go
export PATH=$PATH:/usr/local/go/bin
保存
4:source /etc/profile
5:go env(检查是否安装成功)
protobuf安装:
1:https://github.com/google/protobuf/releases?after=v3.0.0-alpha-4.1
选择对应版本下载(protobuf-2.5.0.tar.bz2)
2:tar -xjvf protobuf-2.5.0.tar.bz2(确保bz2已安装 如果没有安装 yum -y install bzip2进行安装 )
3:cd protobuf-2.5.0
4:yum install gcc-c++ (如果已经安装 ,跳过该步骤)
5: ./configure
6:make
7:make install
8:protoc –version(检查是否安装成功)
protoc-gen-go
1:yum install git(如果已经安装请跳过)
2:go get github.com/golang/protobuf/protoc-gen-go
3:find / -name protoc-gen-go
4:cd /root/go/src/github.com/golang/protobuf/protoc-gen-go
5:go build
6:go install
7:vi /etc/profile(添加$GOPATH/bin)
8:source /etc/profile
Proto:
1:go get github.com/golang/protobuf/proto
2:find / -name proto
3:cd /root/go/src/github.com/golang/protobuf/proto
4:go build
5:go install