This is a creation in Article, where the information may have evolved or changed.
Guide |
The Go language, also known as Golang, is an open-source programming language originally developed by Google, which is designed to follow the 3 principles of simplicity, security, and speed. The go language has a variety of debugging, testing, analysis, and code review tools, and now the go language and tools are available in the source library of most Linux distributions, and I'll show you how to install the Go language for Linux. |
Ubuntu, Debian or Linux Mint install go language
Debian-based Linux distributions can be installed using the Apt-get command:
sudo apt-get install Golang
To view the current system installation of the Go language version, you can use the following command:
Go version
Since the Go code must be saved in the workspace (workspace), we must create a workspace directory in the Home directory (for example, ~/workspace) and define the Gopath The environment variable points to the directory, which is used by the Go tool to save and edit the binaries.
mkdir ~/workspaceecho ' export gopath= "$HOME/workspace" ' >> ~/.bashrcsource ~/.BASHRC
Depending on the needs, we can use Apt-get to install Go tools:
sudo apt-cache search Golang
Fedora, CentOS, or Rhel installation go language
Red Hat-based Linux distributions can be installed using the Yum command:
sudo yum install Golang
To view the current system installation of the Go language version, you can use the following command:
Go version
Next, create a workspace directory in your Home directory (for example, ~/workspace) and define the GOPATH environment variable to point to that directory, which will be used by the Go tool to save and edit binaries.
mkdir ~/workspaceecho ' export gopath= "$HOME/workspace" ' >> ~/.bashrcsource ~/.BASHRC
Depending on your needs, we can use Yum to install Go tools:
Yum Search Golang
manually install the Go language for Linux
Since you are using different Linux sources, it is not necessarily the latest version or a required version of the Go language pack, so let's say how to manually install the specified version.
Download the Go language file
64-bit Linux
wget http://www.golangtc.com/static/go/go1.4.2.linux-amd64.tar.gz
32-bit Linux
wget http://www.golangtc.com/static/go/go1.4.2.linux-386.tar.gz
Download Address: Http://golangtc.com/download
unzip the binaries to the/usr/local directory
sudo tar-xzf go1.4.2.linux-xxx.tar.gz-c/usr/local
use VI to add the following in the environment variable configuration file/etc/profile:
Export path= $PATH:/usr/local/go/bin
Check the Go language version
Go version
defining Gopath environment variables to the workspace directory
Export gopath= "$HOME/workspace