1. Download the installation package
First look at whether CentOS or Ubuntu is 64-bit or 32-bit, showing that 64 is 64-bit:
Then download the go-linux-64 bit source package, you can manually wget installation:
wget http://www.golangtc.com/static/go/1.10.1/go1.10.1.linux-amd64.tar.gz
当然也可以去官网下载,建议安装go1.10.1,是目前比较稳定的版本:
- 1
Https://golangtc.com/download
- 2
Https://studygolang.com/dl
2, decompression installation, configuration environment
Unpacking the installation package
sudo tar-xzf go1.10.1.linux-amd64.tar.gz-c/usr/local
Use VI to add the following in the environment variable configuration file/etc/profile:
Vi/etc/profile or VI $HOME/.profile
Add the following content
# GO PATHexport PATH=$PATH:/usr/local/go/bin#GO GOPATHexport GOPATH=/home/golang
Make the profile configuration effective immediately:
SOURCE $HOME/.profile (for current user)
Source Etc/profile (for root)
View go version or environment variables
Go version #查看go版本
Go env #查看go环境变量
Summary:
In the Linux installation will encounter the configuration environment path problems, such as Gopath and Gopath not set up the problem, there is sudo go
no command to find the problem, so find the problem to learn to find ideas to solve the problem.
Linux Go language Download installation