linux 编译 etcd

本文介绍如何在Linux系统中搭建Go运行环境,并详细展示了从下载源码到编译etcd的具体步骤。通过配置环境变量,确保Go环境正确设置;利用git工具下载etcd源码并选择特定版本进行编译。

搭建linux go 环境

tar -zxvf go1.12.1.linux-amd64.tar.gz -C /opt/

 

[root@localhost linux]# go version

go version go1.12.1 linux/amd64

[root@localhost linux]# go env

GOARCH="amd64"

GOBIN=""

GOCACHE="/root/.cache/go-build"

GOEXE=""

GOFLAGS=""

GOHOSTARCH="amd64"

GOHOSTOS="linux"

GOOS="linux"

GOPATH="/opt/go_test"

 

vi  /etc/profile

 

添加

 export GOROOT=/opt/go

 export GOPATH=/opt/go_test

 export PATH=$GOROOT/bin:$GOPATH/bin:$PATH

 

source /etc/profile  生效

 

 

下载 etcd 源码  

路径 /opt/go_test/src/github.com/etcd_git

 

 

linux 编译etcd

 

git clone 下载源码

git tag 列出所有版本号

git checkout +某版本号

 

 

下载源码  这里是成功的原因 使用 git下载源码

git clone git@github.com:etcd-io/etcd.git

 

git tag

 

git checkout -b  v3.3.12 //切换分支

 

 git checkout   v3.3.12 进入分支

 

./build

 

[root@localhost etcd_git]# ./bin/etcd -version

etcd Version: 3.3.12

Git SHA: 07d1eb0

Go Version: go1.12.1

Go OS/Arch: linux/amd64

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值