如何在CentOS 8| CentOS 7上安装1.14

时间:2020-02-23 14:30:40  来源:igfitidea点击:

GO,通常称为Golang是一种现代开源编程语言,用于构建可靠,简单高效的软件应用程序。
Go Powers Power Provinces,如Kubernetes,Prometheus,Docker,Terraform,Sensu等许多其他。

本教程将在CentOS 8/CentOS 7 Linux系统上浏览Go 1.14的安装。

在CentOS 8| CentOS 7上安装Go 1.14

在本教程中,我们将使用Jorge Canha创建的简单Bash脚本来安装Go On CentOS 8/CentOS 7 Linux机器。
该脚本将下载并安装我们自己的用户帐户的Go语言。

下载脚本。

--- With curl --
curl -O https://raw.githubusercontent.com/canha/golang-tools-install-script/master/goinstall.sh
--- With wget --
wget https://raw.githubusercontent.com/canha/golang-tools-install-script/master/goinstall.sh

使脚本可执行。

$chmod +x goinstall.sh

如果在未通过版本的情况下运行脚本,则将下载最新版本。

./goinstall.sh

要安装特定版本,请将版本号传递给-version参数。

--- Install Go 1.14 --
$./goinstall.sh --version  1.14
--- Install Go 1.13 --
$./goinstall.sh --version  1.13

安装

...
esolving storage.googleapis.com (storage.googleapis.com)... 2a00:1450:400f:808::2010, 216.58.211.144
Connecting to storage.googleapis.com (storage.googleapis.com)|2a00:1450:400f:808::2010|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 120050424 (114M) [application/octet-stream]
Saving to: ‘/tmp/tmp.vlZUgncsKp/go.tar.gz’
100%[==============================================================================================================>] 120,050,424 34.4MB/s   in 3.3s   
2017-06-12 00:46:12 (34.4 MB/s) - ‘/tmp/tmp.vlZUgncsKp/go.tar.gz’ saved [120050424/120050424]
Extracting File...
Go 1.14 was installed into /root/.go.
Make sure to relogin into your shell or run:
	source /root/.bashrc
to update your environment variables.
Tip: Opening a new terminal window usually just works. :)

来源Bashrc文件。

source /root/.bashrc

配置GOPATH配置。

$echo $GOPATH
/root/.bashrc

确认在CentOS 7上安装的Go版本:

$go version
go version go1.14 linux/amd64

CentOS 8 | CentOS 7卸载go

$./goinstall.sh  --remove
Go removed.