How to install golang in linux, no need to download the package in windows

      In fact, I have installed it for a long time, and I have forgotten how to install it. Today, when I was debugging in k8s, I had to reinstall golang. I checked it on the Internet and found that too many articles are inconvenient. For example, it is now downloaded in windows. Package, and then decompress it under linux, is it so troublesome, just go to the process below

 

1. Download the golang package first

Many articles on the Internet are searched under windows, downloaded and copied, in fact, you don’t need to do this, just download directly in linux

I am a Debian 64-bit system, and the working directory is /usr/local. This way

// 如果你看到这篇文章,可能已经过了很久,go的版本自己看着修改
wget https://storage.googleapis.com/golang/go1.15.7.linux-amd64.tar.gz

// 如果没有wget, 先进行以下步骤, 然后再再下载golang
// apt-get update
// apt-get install wget

2. Unzip golang

// 你下载再哪里就在哪里解压
tar -C /usr/local -xzf go1.15.7.linux-amd64.tar.gz

3. Set environment variables

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

//这里写你自己的工作目录
export GOPATH=/usr/local/go_project

export GOROOT=/usr/local/go

Finally use go version to see if the installation is successful

Finish work.

Guess you like

Origin blog.csdn.net/banfushen007/article/details/112968644