TSSC_go_install_linux
- 下载地址
https://golang.org/dl/
https://golang.org/dl/go1.16.3.linux-amd64.tar.gz
https://golang.org/dl/go1.16.3.windows-amd64.msi
https://golang.org/dl/go1.16.3.darwin-amd64.pkg
https://golang.org/dl/go1.16.3.src.tar.gz
1.下载安装 go 软件
mkdir -p /opt/tools
cd /opt/tools
# wget https://golang.org/dl/go1.16.3.linux-amd64.tar.gz
wget https://studygolang.com/dl/golang/go1.16.3.linux-amd64.tar.gz
mkdir -p /usr/local/go
tar -xvf go1.16.3.linux-amd64.tar.gz -C /usr/local/go
2.设置环境变量
vim /etc/profile
---------------------------------
export GOROOT=/usr/local/go
export GOPATH=/usr/local/go
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
---------------------------------
3.测试环境是否安装成功
mkdir -p /opt/tools/helloworld
cd /opt/tools/helloworld
vim helloworld.go
------------------------
package main
import "fmt"
func main() {
fmt.Println("HelloWorld!")
}
------------------------
# 测试配置
go run ./helloworld.go
- 完毕,呵呵呵