go环境安装升级整理

go环境安装升级整理

五月 10, 2019

安装新的go环境 go version >= 1.5
$HOME = /usr/local/bin

  1. 下载go1.4 wget https://studygolang.com/dl/golang/go1.4.linux-amd64.tar.gz
    解压安装 $ tar -zxvf go1.4.tar.gz && cd go1.4/src && ./make.bash
  2. 准备临时环境变量
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    # vim .bashrc
    #go runtime
    #go install path
    export GOROOT=$HOME/go.11.2
    #go complier and linker installation locaition |default:$GOROOT/bin
    export PATH=$PATH:GOROOT/bin
    #go src|bin:dir|myworkdir|default:$HOME/go
    export GOPATH=$HOME/Applications/Go
    #go bootstrap|go>=1.5|must
    export GOROOT_BOOTSTRAP=$HOME/go1.4
    $ source $HOME/.bashrc 使配置生效
  3. 下载go1.11.2 wget https://studygolang.com/dl/golang/go1.11.2.linux-amd64.tar.gz
    解压安装 $ tar -zxvf go.1.11.2 && cd src && ./all.bash
  4. $ go version
    $ go version go1.11.2 linux/amd64

原来有go环境,升级go的版本

1
2
3
4
5
6
7
# cat go_install.sh
#!/bin/bash
cd /mnt
wget https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz && tar zxvf go1.11.2.linux-amd64.tar.gz
mv /usr/local/go /tmp
mv /mnt/go /usr/local/
go version

因为开发go版本的升级,内网jenkins编包时所用go环境需要升级

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# yum --enablerepo=epel search procinfo
# yum --enablerepo=epel install procinfo
# yum install gcc gcc-c++ vim* ntpdate xinetd wget make cmake gd gd-devel openssl sysstat lrzsz net-snmp net-snmp-devel net-snmp-utils snmp* bc openssh-clients
# yum install nrpe
# yum install gcc-c++

# tar czvf ~/ssdb_1.9.3.tar.gz ./
# cd /usr/local/ssdb
# ./ssdb-server ssdb.conf
# ./ssdb-server ssdb.conf

# yum search golang --enablerepo=epel
# mkdir go_1.9
# cd go_1.9/
# wget https://www.golangtc.com/static/go/1.9.2/go1.9.2.linux-amd64.tar.gz
# tar xvf go1.9.2.linux-amd64.tar.gz
# mv go /usr/local/bin/go1.9
# /usr/local/bin/go1.9/bin/go version