一、安装git
$ yum -y install git
# 把diff导出成文件
git diff dev > error.patch
二、安装go
1,下载
方式1:直接wget下载
https://golang.org/doc/install
因为翻墙问题,无法下载
方式2:在自己电脑下载
https://golang.org/doc/install?download=go1.15.2.linux-amd64.tar.gz
再把tar.gz文件上传到centos机器上
2,安装
If you have a previous version of Go installed, be sure to remove it before installing another.
- Download the archive and extract it into /usr/local, creating a Go tree in /usr/local/go.
For example, run the following as root or through
sudo
:tar -C /usr/local -xzf go1.15.2.linux-amd64.tar.gz
- Add /usr/local/go/bin to the
PATH
environment variable.You can do this by adding the following line to your $HOME/.profile or /etc/profile (for a system-wide installation):
export PATH=$PATH:/usr/local/go/bin
Note: Changes made to a profile file may not apply until the next time you log into your computer. To apply the changes immediately, just run the shell commands directly or execute them from the profile using a command such as
source $HOME/.profile
. - Verify that you've installed Go by opening a command prompt and typing the following command:
$ go version
- Confirm that the command prints the installed version of Go.
go root #就是解压后的go文件目录
export GOROOT="/usr/local/go"
go path #Go项目存放的位置,我们自定义,相当于workspace
export GOPATH=$HOME/go
go bin #想方便的使用go
export GOBIN=$GOROOT/bin
添加到PATH中:export PATH=$GOROOT/bin;$PATH
export PATH=$PATH;$GOBIN
三、安装shasum
当shasum命令不存在时,可执行命令安装
$ yum install perl-Digest-SHA
四、安装okexchain
$ export GO111MODULE=on
$ cd okexchain
$ export GOPROXY="https://goproxy.io" # 设置代理
如果设置之后还是超时,则可以增加翻墙代理(以我的为例)
export https_proxy=http://10.0.x.y:9999 http_proxy=http://10.0.x.y:9999 all_proxy=socks5://10.0.x.y:10000
$ make install
如果出现下面错误
# github.com/okex/okexchain/cmd/okexchaind
flag provided but not defined: -L
usage: link [options] main.o
...
make: *** [install] Error 2
Unset this environment variable and try again. LDFLAGS="" make install
|
$ yum -y install gcc
$ yum -y install gcc-c++
如果 okexchaincli version --long没有出来
把okexchaincli和okexchaind加到环境变量
vi ~/.bash_profile
export GOPATH=/Users/yourname/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
export GO111MODULE=on
export GOPROXY=http://goproxy.io
$ source ~/.bash_profile
然后就可以使用okexchaincli和okexchaind了