How to install Go for Linux
The Go language, also known as golang, is an open-source programming language originally developed by Google. It follows the three principles of simplicity, security, and speed. The Go language provides a variety of debugging, testing, analysis, and code review tools. Currently, the Go language and tool are provided in the source library of most Linux releases, this article describes how to install the Go language in Linux.
Install Go in Ubuntu, Debian, or Linux Mint
Debian-based Linux versions can all be installed using the apt-get command:
- Sudo apt-get install golang
To view the Go language version installed on the current system, run the following command:
- Go version
Since the Go code must be saved in the workspace, we must ~ /Workspace) create a workspace directory and define the GOPATH environment variable pointing to this directory. This directory will be used by the Go tool to save and edit binary files.
- Mkdir ~ /Workspace
- Echo 'export GOPATH = "$ HOME/workspace" '> ~ /. Bashrc
- Source ~ /. Bashrc
You can use apt-get to install Go tools as needed:
- Sudo apt-cache search golang
Install Go language for Fedora, CentOS, or RHEL
Red Hat-based Linux versions can all be installed using the yum command:
- Sudo yum install golang
To view the Go language version installed on the current system, run the following command:
- Go version
In the Home directory (for example ~ /Workspace) create a workspace directory and define the GOPATH environment variable pointing to this directory. This directory will be used by the Go tool to save and edit binary files.
- Mkdir ~ /Workspace
- Echo 'export GOPATH = "$ HOME/workspace" '> ~ /. Bashrc
- Source ~ /. Bashrc
We can use yum to install Go tools according to different needs:
- Yum search golang
Install Go language manually for Linux
Since the Linux sources are different and not necessarily the latest version or the required Go Language Pack, let's talk about how to manually install the specified version.
1. 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
Golang download
2. decompress the binary file to the/usr/local directory.
- Sudo tar-xzf go1.4.2.linux-xxx.tar.gz-C/usr/local
3. Use vi to add the following content to the environment variable configuration file/etc/profile:
- Export PATH = $ PATH:/usr/local/go/bin
4. Check the Go language version.
- Go version
5 define GOPATH environment variables to the workspace directory
- Export GOPATH = "$ HOME/workspace
Getting started with Linux-installing Go in Linux
Install Go Language Pack in Ubuntu
Go language programming (HD) full-version ebook
Go language and beauty-surpassing "Hello World"
Why do I like the Go language?
Implementation of the Go language memory distributor
This article permanently updates the link address: