1. Uninstall the old version
Uninstall go 1.6.2 that has been installed with the secondary package
sudo apt-get remove golang-go
2. Download and unzip
# 建议下载1.13.8以上的版本,否则编译fabric的时候会报错
wget https://dl.google.com/go/go1.13.8.linux-amd64.tar.gz
tar -xvf go1.13.8.linux-amd64.tar.gz
mv ./go /usr/local
3. Create GO working directory
mkdir -p /home/go/src
4. Set environment variables
vim /etc/profile
# 在最下面添加下面三行代码
export GOROOT=/usr/local/go
export GOPATH=/home/go
export PATH=$PATH:$GOROOT/bin
source /etc/profile
5. Check environment variables