美文网首页
centos安装golang

centos安装golang

作者: 百里江山 | 来源:发表于2020-03-26 15:11 被阅读0次

    下载golang包

    golang1.14 https://studygolang.com/dl

    cd /usr/local/src
    wget https://studygolang.com/dl/golang/go1.15.6.linux-amd64.tar.gz
    tar -zxvf go1.15.6.linux-amd64.tar.gz -C /usr/local/
    

    设置环境变量

    vim /etc/profile
    # 设置golang的环境变量
    
    
    # 设置GO安装目录 
    export GOROOT=/usr/local/go
    # 设置gopath
    export GOPATH=/home/gopath
    # 设置gobin
    export GOBIN=/home/gopath/bin
    # 设置代理,代理没有数据,则直接拉取
    export GOPROXY=https://goproxy.io,direct
    # 忽略公司git走代理
    export GOPRIVATE=*.xx.com
    # 加入PATH
    export PATH=$PATH:$GOROOT/bin:$GOBIN
    

    source /etc/profile

    设置代理,加速go get

    https://goproxy.io/zh/

    go env -w GO111MODULE=on
    go env -w GOPROXY=https://goproxy.io,direct
    

    相关文章

      网友评论

          本文标题:centos安装golang

          本文链接:https://www.haomeiwen.com/subject/uoccuhtx.html