How to install Go for Linux

Source: Internet
Author: User
Tags install go linux mint

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:

  1. Sudo apt-get install golang

To view the Go language version installed on the current system, run the following command:

  1. 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.

  1. Mkdir ~ /Workspace
  2. Echo 'export GOPATH = "$ HOME/workspace" '> ~ /. Bashrc
  3. Source ~ /. Bashrc

You can use apt-get to install Go tools as needed:

  1. 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:

  1. Sudo yum install golang

To view the Go language version installed on the current system, run the following command:

  1. 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.

  1. Mkdir ~ /Workspace
  2. Echo 'export GOPATH = "$ HOME/workspace" '> ~ /. Bashrc
  3. Source ~ /. Bashrc

We can use yum to install Go tools according to different needs:

  1. 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

  1. Wget http://www.golangtc.com/static/go/go1.4.2.linux-amd64.tar.gz

32-bit Linux

  1. 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.

  1. 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:

  1. Export PATH = $ PATH:/usr/local/go/bin

4. Check the Go language version.

  1. Go version

5 define GOPATH environment variables to the workspace directory

  1. 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:

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.