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 Go in Linux

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

Share

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

Editor to share with you how to install Go in Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Go (also known as Golang,wiki Chinese) is an open source programming language (github) developed by Google that is statically strongly typed, compiled, concurrent, and has garbage collection functions. It supports windows, linux, macOS and other operating systems.

Install the go language for Ubuntu, Debian, or Linux Mint

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

Sudo apt-get install golang

To view the Go language version of the current system installation, 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 environment variable to point to this 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 install Go tools using apt-get:

Install the go language for sudo apt-cache search golangFedora, CentOS, or RHEL

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

Sudo yum install golang

To view the Go language version of the current system installation, you can use the following command:

Go version

Next, create a workspace directory in the 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 install Go tools using yum:

Yum search golang manually installs the go language for Linux

Since you use different Linux sources, do not necessarily have the latest version or require a version of the Go language pack, so let's talk about how to manually install the specified version.

Download Go language 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: http://golangtc.com/download

Extract 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 to the environment variable configuration file / etc/profile: export PATH=$PATH:/usr/local/go/bin check Go language version go version defines GOPATH environment variables to the workspace directory export GOPATH= "$HOME/workspace is all the contents of this article" how to install Go in Linux ", thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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