# go安装

linux下的go安装脚本

#!/bin/sh
set -e
VERSION=1.15.7
OS=linux
ARCH=amd64
curl -L https://studygolang.com/dl/golang/go$VERSION.$OS-$ARCH.tar.gz -o go$VERSION.$OS-$ARCH.tar.gz
tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin">>/etc/profile
echo "Please reboot or run this command: export PATH=\$PATH:/usr/local/go/bin"

CentOS一键安装(涉及环境变量配置,建议安装后重启)

yum install -y wget &&
 wget -O install-golang.sh https://gcslaoli.gitee.io/script/install-golang.sh &&
  sh install-golang.sh

判断安装是否成功

go version
Last Updated: 2022/11/13 12:30:47