GO二进制和YUM安装
二进制安装
Linux 2.6.23 or later with glibc, Intel 64-bit processor
go1.14.4.linux-amd64.tar.gz (118MB)
https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz
SHA256 Checksum aed845e4185a0b2a3c3d5e1d0a35491702c55889192bb9c30e67a3de6849c067
http://aws.as4k.top/chfs/shared/go1.14.4.linux-amd64.tar.gz
tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
tar -C /usr/local -xzf go1.14.4.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile
echo 'export GOROOT=/usr/local/go' >> /etc/profile
退出重新登陆一下,使环境变量生效
YUM安装
#1 开启base和epel源
========================
https://blog.csdn.net/xys2015/article/details/109378741
#2 安装
========================
yum install go
go version
#3 相关冗余信息
========================
Installed:
golang.x86_64 0:1.15.5-1.el7
Dependency Installed:
golang-bin.x86_64 0:1.15.5-1.el7
golang-src.noarch 0:1.15.5-1.el7
mercurial.x86_64 0:2.6.2-11.el7
[root@192_168_31_100 ~]# go version
go version go1.15.5 linux/amd64
hello world 测试
#1 书写代码
========================
#cat hello.go
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
#2 编译
========================
go build hello.go
#3 运行
========================
./hello
#4 一些冗余信息
========================
[root@192_168_31_100 ~]# ls
hello hello.go
[root@192_168_31_100 ~]# file hello
hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
https://blog.csdn.net/xys2015/article/details/113770562