In most cases, are installed in the server go go1.6.2 this version, for some projects do not meet the requirements. So we need to be manually updated version golang.
1. Check the version golang
root@ubuntu:/home/liu# go version
go version go1.6.2 linux/amd64
2. Download the corresponding version of the required files from the Internet
Download link , here I've finished downloading
3. Extract golang package
tar -zxvf go1.13.8.linux-amd64.tar.gz
Recompression After completing the package directory will be more of a go folders, directories, here is my /usr/local
next
4. Review the information on the original golang of env
go env
We can see GOROOT="/usr/lib/go-1.6"
, that is the location where the original golang, we enter the / usr / lib directory
cd /usr/lib/
View all documents (option al can show the address pointed to by the soft link file):
ls -al
We can find, go the soft link file points to go-1.6 folder, which is the original golang source folder. If we replace the version, which is the replacement of the go-1.6, we have to change this soft link to the address at the same time.
5. Modify the environment variables GOROOT
vim /etc/profile
Then in the final document by adding the following two sentences:
export GOROOT="/usr/local/go"
export PATH=$PATH:$GOROOT/bin
Use the source command allows to modify the configuration to take effect:
source /etc/profile
5. Modify go soft link address
在这里插入代码片
Then go see the link address again:
ls -al
Can be found, go the link address has been modified
6. Verify whether the modified version of the successful
It should be noted that, if done the steps above, go version or not modified, the proposed restart the computer, or check back later on command, or multi-source several times.