This is a creation in Article, where the information may have evolved or changed.
Get the source list address and choose the one that suits your system (my is go1.3.1.linux-amd64.tar.gz)
http://golang.org/dl/
Unzip
Tar zxvf go1.3.1.linux-amd64.tar.gz
Move (to have root privileges)
MV Go/usr/local/go
Root permission is required for all of the following
1.ubuntu 14.04 Install a go Lang (go language)
1.1 Setting System environment variables
Vi/etc/profile
At the end of the add (press I key to enter the editing state, put the cursor down the last, add the following, and finally press: Wq key to save the exit, where: q! is not saved forced exit)
Export Goroot=/usr/local/goexport gobin= $GOROOT/binexport gopkg= $GOROOT/pkg/tool/linux_amd64export GOARCH= Amd64export goos=linuxexport path=.: $PATH: $GOBIN: $GOPKG
1.2 Compile to make it effective
Source/etc/profile
1.3 Testing
If you can see the version number, then the configuration is successful!
Go version
Go version go1.2.2 linux/amd64
1.4 Other git and mercurial installations
sudo apt-get install gitsudo apt-get Install mercurial
Found in use, if you do not install the above two, you have to manually download some files
2.CentOS 6.5 Install Go Lang (Go language)
2.1 Setting System Environment variables
Vi/etc/profile
At the end of the add (press I key to enter the editing state, put the cursor down the last, add the following, and finally press: Wq key to save the exit, where: q! is not saved forced exit)
Export Goroot=/usr/local/goexport gobin= $GOROOT/binexport gopkg= $GOROOT/pkg/tool/linux_amd64export GOARCH= Amd64export goos=linuxexport path=.: $PATH: $GOBIN: $GOPKG
2.2 Compile to make it effective
Source/etc/profile
2.3 Testing
If you can see the version number, then the configuration is successful!
Go version
Go version go1.2.2 linux/amd64
3. Source code compilation and installation (general)
Read this article: http://my.oschina.net/fishman/blog/121915
A few additional explanations
3.1 Download speed is very slow, and sometimes can not download
You know. [by the Wall].
3.2 Only install the following to
sudo apt-get install gitsudo apt-get Install mercurial
3.3 When the environment variable is added, it takes effect immediately without restarting
SOURCE ~/.BASHRC