Use the sudo apt-get install go installation version is older, to install the latest version, only manual installation, nonsense not to say, directly listed installation steps.
1, download the source code
wget http://golangtc.com/static/go/go1.3.1.linux-amd64.tar.gz
Note: If a non 64-bit system is available, the corresponding version can be found above the http://golangtc.com/download.
When the download is complete, execute TAR-XF go1.3.1.linux-amd64.tar.gz and move the entire Go folder to the/usr/local directory to execute the command sudo mv go/usr/local
2, installation of related tools
sudo apt-get install Bison gawk gcc Libc6-dev make
Depending on the installation of the system itself, there will be a need to confirm whether to install, enter Y return.
3, modify the configuration
sudo vi ~/.BASHRC
At the end of the file, add the following:
#Golang environment variable
Export Goroot=/usr/local/go
Export GORACH=AMD64
Export Goos=linux
Export Path=${path}:/usr/local/go/bin
Export Gopath=/usr/local/go/application
Create a file sudo vi ~/.bash_profile
Content:
If [f ~/.BASHRC]; Then
. ~/.bashrc
Fi
4. Compile and install
Cd/usr/local/go/src
./all.bash
After compiling, testing, packaging, installing, and ending, you can run the Go version view to verify that the installation is completed correctly.
5, testing
CD ~
VI Hello.go
Copy the following content:
Package Main
Import (
"FMT"
)
Func Main () {
Fmt. Println ("Hello, World.") Http://itelite.com. ")
}
Save, exit, execute go run hello.go, and output:
Hello, world. Http://itelite.com.
Description installation OK, Kaniko open dry it!