- golang版本:1.16.3
- 下载目录:/root/software/Go
- 安装目录:/root/software/Go/setup
mkdir -p "安装目录"
cd "下载目录"
wget https://dl.google.com/go/go1.16.3.linux-amd64.tar.gz
tar -zxvf go1.16.3.linux-amd64.tar.gz
mv go "安装目录"
cd "安装目录"/go
mkdir gopath
vi ~/.bashrc
#添加该语句
export GOROOT="安装目录"/go
export GOPATH="安装目录"/go/gopath
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
source ~/.bashrc
go version
二. golang快速使用(输出Hello world!)
vim hello.go
package main
import "fmt"
func main(){
fmt.Println("Hello, world!")
}