1、下载安装包
2、配置
3、测试
# wget https://storage.googleapis.com/golang/go1.7.1.linux-amd64.tar.gz
# tar zxvf go1.7.1.linux-amd64.tar.gz -C /usr/local
2、配置
# mkdir -p /mnt/wwwroot/gofile
# vim /etc/profile
export GO_HOME=/usr/local/go
export PATH=$PATH:$GO_HOME/bin
export GOPATH=/mnt/wwwroot/gofile
# source /etc/profile
# go version
3、测试
# cd /mnt/wwwroot/gofile
# vim hello.go
package main
import "fmt"
func main() {
fmt.Println("Hello, 世界")
}
# go run hello.go
Hello, 世界