How to install the Go language for Linux

Source: Internet
Author: User
Tags install go linux mint

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 repository for most Linux distributions, so I'll show you how to do this. Linux installs the Go language.

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

: 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

Free to provide the latest Linux technology tutorials Books, for open-source technology enthusiasts to do more and better: http://www.linuxprobe.com/

How to install the Go language for Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.