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 Golang 1.8.3 in CentOS 7, Ubuntu 16.04, and Debian 9

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

Share

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

This article is about how to install Golang 1.8.3 in CentOS 7, Ubuntu 16.04 and Debian 9, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Golang is a programming language developed by Google. Because of its versatility, simplicity, and reliability, Golang has become one of the most popular programming languages in the open source community.

I'll show you how to install the latest stable version of Golang, including CentOS 7, Ubuntu 16.04 LTS, and Debian 9 extensions, on 64-bit and 32-bit Linux operating systems. At the time of this writing, the latest stable version of Golang is Golang 1.8.3.

Prepare:

A Vultr CentOS 7 perfect Ubuntu 16.04 LTS, or an Debian 9 extension linux server instance.

Sudo user.

Step 1: download and extract Golang 1.8.3

For 64-bit Linux operating systems

If you are using a 64-bit Linux operating system, including CentOS 7 x64, Ubuntu 16.04 amd64, and Debian 9 amd64, you need to download the 64-bit Golang version:

Cd

Wget https://www.vultrer.com/ golang/go1.8.3.linux-amd64.tar.gz

Sudo tar-zxvf go1.8.3.linux-amd64.tar.gz-C / usr/local

For 32-bit Linux operating system

If you are using a 32-bit Linux operating system, including Ubuntu 16.04 i386 and Debian 9 i386, you need to download the 32-bit Golang version:

Cdwget https://storage.googleapis.com/golang/go1.8.3.linux-386.tar.gzsudo tar-zxvf go1.8.3.linux-386.tar.gz-C / usr/local

Note: you can find the download link for the latest version of Golang on the official download page.

Step 2: set the GOROOT and PATH environment variables:

Echo 'export GOROOT=/usr/local/go' | sudo tee-a / etc/profileecho' export PATH=$PATH:/usr/local/go/bin' | sudo tee-a / etc/profilesource / etc/profile

Step 3: test the installation

Go versiongo env

In addition, you can try writing a simple Golang program:

Cdmkdir-p src/hellocd src/hellovi hello.go

Populate the file ~ / src/hello/hello.go with the following code snippet

Package main

Import "fmt"

Func main () {fmt.Printf ("hello, world\ n")}

Save and exit:

: wq!

Finally, run your first Golang program, as follows:

Go run hello.go

If all goes well, you will see the output:

Hello world above is how to install Golang 1.8.3 in CentOS 7, Ubuntu 16.04 and Debian 9. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please 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

Servers

Wechat

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

12
Report