Download
Google acquired from the official installation package, do not have direct access over the wall http://golang.google.cn
, choose Linux installation package as go1.14.linux-amd64.tar.gz
download stand
Decompression (i.e., installed)
Inside is a compressed go
folder, use the following command to unzip the folder to the default (habit, but not necessarily) path
sudo tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
Configuration environment variable
Set ~/.bashrc
or ~/profile
former valid for all users, which is valid for the current user, will add three important environmental variables go to the very end of the file and save and exit
export GOROOT="/usr/local/go" //golang 安装目录
export GOPATH="/home/deepiner/golang" // 自定义的 GOPATH 路径
export PATH=$PATH:/usr/local/go/bin
Become effective
source ~/.bashrc
To take effect, go env
check the configuration is correct