Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install GE language in Linux system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to install Go language on Linux system. Xiaobian thinks it is quite practical, so share it with you as a reference. I hope you can gain something after reading this article.

One of Google's first open source programming languages was Go, which was designed to follow three principles: simplicity, security, and speed. The Go language and tools are now available in the source libraries of most Linux distributions.

Ubuntu, Debian or Linux Mint Install Go

Debian-based Linux distributions can be installed using the apt-get command:

sudo apt-get install golang

To see which version of Go is currently installed, use the following command:

go version

Since Go code must be stored in a workspace, we must create a workspace directory in the Home directory (e.g.~/workspace) and define the GOPATH environment variable to point to that directory, which will be used by Go tools to save and edit binaries.

mkdir ~/workspaceecho 'export GOPATH="$HOME/workspace"' >> ~/.bashrcsource ~/.bashrc

Depending on your needs, we can install Go tools using apt-get:

sudo apt-cache search golang

Fedora, CentOS or RHEL install Go

Red Hat-based Linux distributions can be installed using the yum command:

sudo yum install golang

To see which version of Go is currently installed, use the following command:

go version

Next, create a workspace directory in the Home directory (e.g.~/workspace) and define the GOPATH environment variable to point to this directory, which will be used by Go tools to save and edit binary files.

mkdir ~/workspaceecho 'export GOPATH="$HOME/workspace"' >> ~/.bashrcsource ~/.bashrc

Depending on your needs, we can install Go tools using yum:

yum search golang

Manually Install Go for Linux

Since everyone is using different Linux sources, and not necessarily the latest version or the version of the Go package you want, let's talk about how to manually install a specific version.

Download Go files

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: golangtc.com/download

Unzip the binary file to/usr/local directory

sudo tar -xzf go1.4.2.linux-xxx.tar.gz -C /usr/local

Use vi to add the following to the environment variable configuration file/etc/profile:

export PATH=$PATH:/usr/local/go/bin

Check Go language version

go version

Define GOPATH environment variable to workspace directory

export GOPATH="$HOME/workspace About"Linux system how to install Go language "This article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report