This is a creation in Article, where the information may have evolved or changed.
Don't talk nonsense, go straight on ~
Install GO1.8 under Linux
1, download the version of Go
Domestic address Source: https://dl.gocn.io/
Choose the source code here to install, in the installation of Go is required gcc, so your Linux system needs to install GCC first. If you install the 1.8 version directly, you will be prompted with the word >=1.4. This is because when you install a high version, you need to provide a basic version, which is like "chicken or Egg first" situation. So we have to provide a "hen" first. The choice here is 1.4.3 as the base version, because this version of Go is still pure C, so there is no need to rely on it.
2. Compile and install
Unpack the package under your Linux system.
Here, we first define the directory specification, the home directory to create a new/local/directory, the download of 1.4 and 1.8 two versions into which to unzip the renaming.
- Compile and install version 1.4.3, run the make.bash file under src
Installation Complete
You can see the version 1.4.3
- Continue compiling version 1.8
The procedure is the same, run the Make.bash file under the 1.8 version of SRC
However, you will still receive a prompt after running:
Note that the $GOROOT _bootstrap here will require you to set the environment variables for the installation directory, and then continue to execute
Export goroot_bootstrap= $HOME/local/go1.4
Installation is complete!
3. Setting Environment variables
Not fully finished after compiling go1.8, three environment variables needed to be set
So. We need to change the directory name before go1.8.
Modify our BASHRC file to write environment variables
Vim ~/.BASHRC
Export goroot= $HOME/local/go
Export Gopath= $HOME/go
Export path= $GOROOT/bin: $GOPATH/bin: $PATH
Save after exit effective configuration
SOURCE ~/.BASHRC
perform go env to see configuration information
4. Run Hello Golang
Edit File Hello.go
Save exit, run go run hello.go See effect
At this point, if the operation is successful, the go environment has been built successfully ~ ~ ~