This is a creation in Article, where the information may have evolved or changed.
PS: This article should be found on the internet a lot of, I just want to organize their own experience! Master do not spray, do not like to spray
The main point here is the standard package installation, do not need to compile!
First, check the number of bits of your operating system and use UNAME-A to see
If it is 64 bits, the x86_64 typeface will be displayed, and if it is 32 digits, the i686 will be displayed.
Then go to https://code.google.com/p/go/downloads/list here to find the corresponding package to download.
TAR-ZXVF go1.1.linux-386.tar.gz cp-r go//usr/local/go
The next thing to set is the environment variable!
the environment variables of Linux are divided into two kinds, temporary variables and permanent variables.
The variables set by the 1.vi/etc/profile file are permanently valid for all users
2.vi/User directory/.bash_profile file is permanently valid for a user
3. Use export, only valid for the current shell, Shell shutdown is invalid
the first vi/etc/profile is recommended to be added at the end of the file:
Export Goroot=/usr/local/goexport gobin= $GOROOT/binexport gopath=/root/lvxinxinexport path= $PATH: $GOBIN: $GOPATH
Disconnect the shell and reconnect or the source/etc/profile is immediately active.
then directly using Go version will show, for example:
Go version go1.1 linux/386
It means it's normal!
You can also use Go env to see other variables,
Goarch= "386" gobin= "/usr/local/go/bin" gochar= "8" goexe= "" gohostarch= "386" gohostos= "Linux" goos= "Linux" gopath= "/ Root/lvxinxin "gorace=" "goroot="/usr/local/go "gotooldir="/usr/local/go/pkg/tool/linux_386 "CC=" gcc "GOGCCFLAGS="- G-o2-fpic-m32-pthread "cgo_enabled=" 1 "
in fact, the gopath is not necessary to set up, the setting is because the next possible to talk about the Beego framework, when using go get to GitHub on the acquisition of the package, if not set Gopath, it can not be downloaded, This gopath you can understand that your project directory and/usr/local/go under the two meaning, like you use Eclips, your eclips installed on the D disk, and your project files can be built on the other disk meaning is the same
In addition, it should be noted that Linux in setting the environment variables, the variable name and the following value, that is, "=" on both sides of the space can not have, it must be compact, otherwise it will error. When I set the time, I think there is an interval will be beautiful (PS: Write code to write habits), the results of an error!