Home >Backend Development >Golang >Detailed explanation of ubuntu golang installation method
Under the Ubuntu system, the installation of Golang is very simple. This article will provide Golang installation methods under Ubuntu 18.04 system to make your development process more comfortable.
Go to the official website https://golang.org/dl/ and download the version that suits you. This article takes the go1.14.4.linux-amd64.tar.gz version as an example.
Get to the point and move the downloaded go1.14.4.linux-amd64.tar.gz installation package to the specified directory (for example, move to / usr/local directory), and decompress:
$ sudo mv go1.14.4.linux-amd64.tar.gz /usr/local $ cd /usr/local $ sudo tar -xzvf go1.14.4.linux-amd64.tar.gz
Here, we decompress go to the /usr/local directory, which is also the officially recommended installation location.
In order for the system to find the Go running environment, the Go installation path needs to be added to the PATH path. This can be achieved by adding the following general configuration to the .bashrc file:
$ echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
In order to make the modification of environment variables take effect, you can execute the following command:
$ source ~/.bashrc
This command will make the changes to the environment variables take effect so that the newly installed Go can be used.
We can check the installation status by verifying whether the version number of Go or the modified system variable $PATH is effective:
$ go version
If something similar to the following appears:
go version go1.14.4 linux/amd64
, it means that Golang has been installed.
If you no longer want to use Go, you can delete /usr/local/go (ie, the installation directory) directly.
Summary:
Through the above steps, we can install Golang into the Ubuntu system, and the Golang dependencies during the development process can also be satisfied. At the same time, Golang also has relatively excellent performance in terms of performance, which is worthy of developers to try. I hope the above content can help everyone.
The above is the detailed content of Detailed explanation of ubuntu golang installation method. For more information, please follow other related articles on the PHP Chinese website!