• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

centos安装git,go,shasum,okexchain环境

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

 

一、安装git

$ yum -y install git

# 把diff导出成文件

git diff dev > error.patch

 

二、安装go

1,下载

方式1:直接wget下载

https://golang.org/doc/install

因为FQ问题,无法下载

 

方式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.

  1. 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
    
  2. 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.

  3. Verify that you've installed Go by opening a command prompt and typing the following command:
    $ go version
    
  4. 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"  # 设置代理

如果设置之后还是超时,则可以增加FQ代理(以我的为例)

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了

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Go异常处理发布时间:2022-07-10
下一篇:
go基础第七篇:字符串发布时间:2022-07-10
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap