This article mainly introduced in the Linux system to install the Go language detailed tutorial, because many people in the country blindly sought after Google, resulting in the go language in the domestic popularity far beyond foreign ... Need friends can refer to the following
Go (also known as "Golang") is a programming language originally developed by Google. It has several design principles since its birth: simplicity, security, and speed. The go language release has a variety of debugging, testing, tuning, and code review tools. Now the Go language and its tool chains are available in most Linux distribution base warehouses and can be installed with the default Package manager.
Install the Go language on Ubuntu, Debian, or Linux mint
The following is the use of apt-get on a Debian-based distribution to install the Go language and its development tools.
?
1 |
$ sudo apt-get install Golang |
Check the Go language version to verify the installation.
?
1 2 3 |
$ go version go version go1.2.1 linux/amd64 |
Depending on your needs, you may want to use Apt-get to install additional go tools.
?
1 |
$ sudo apt-cache search Golang |
Install the go language in Fedora and Centos/rhel
The following command installs the Go language and its tools in the distribution based on Red Hat.
?
1 |
$ sudo yum install Golang |
Check the Go language version to verify the installation.
?
1 2 3 |
$ go version go version go1.3.3 linux/amd64 |
Depending on your needs, you may want to use Yum to install additional go tools.
?
Install go language from official website
Sometimes the go language version in the release is not up to date. To avoid this, you can install the latest go language from the official website. Here is the step.
Enter the official source of the Go language, and download the precompiled binary code.
For 64-bit Linux:
?
1 |
$ wget https://storage.googleapis.com/golang/go1.4.1.linux-amd64.tar.gz |
For 32-bit Linux:
?
1 |
$ wget https://storage.googleapis.com/golang/go1.4.1.linux-386.tar.gz |
Install the program under/usr/local
?
1 |
$ sudo tar-xzf go1.4.1.linux-xxx.tar.gz-c/usr/local |
Add the system-wide PATH environment variable to the/etc/profile.
?
1 2 3 |
$ sudo vi/etc/profile export path= $PATH:/usr/local/go/bin |
If you install go in a custom location other than/usr/local, you will also need to set the GOROOT environment variable to point to the custom installation location.
?
1 2 3 |
$ sudo vi/etc/profile export goroot=/path/to/custom/location |
Check the version of the Go language
?
|
$ go V Ersion Go version go1.4.1 linux/amd64 |