在CentOS 7.9上,/usr/local/go/bin路径不存在。

huangapple go评论95阅读模式
英文:

Go: /usr/local/go/bin does not exist on CentOS 7.9

问题

我正在一台运行CentOS 7.9的虚拟机上,尝试按照这个步骤安装Go(参考链接:https://computingforgeeks.com/install-go-golang-on-centos-rhel-linux/)

sudo yum -y install wget

wget https://go.dev/dl/go1.19.3.src.tar.gz

sha256sum go1.19.3.src.tar.gz

sudo tar -C /usr/local -xzf go*.src.tar.gz

然后我添加了以下内容:

export PATH=$PATH:/usr/local/go/bin

到以下文件中:

  • $HOME/.profile
  • /etc/profile

最后执行了以下命令:

source $HOME/.profile

source /etc/profile

但是当我尝试运行命令

go version

时,结果显示

-bash: go: command not found

我注意到在/usr/local/go路径下没有bin目录,如下图所示:

在CentOS 7.9上,/usr/local/go/bin路径不存在。

非常感谢,期待您的建议。

英文:

I'm on a CentOS 7.9 virtual machine and I'm trying to install Go following this procedure (rif. https://computingforgeeks.com/install-go-golang-on-centos-rhel-linux/)

sudo yum -y install wget

wget https://go.dev/dl/go1.19.3.src.tar.gz

sha256sum go1.19.3.src.tar.gz

sudo tar -C /usr/local -xzf go*.src.tar.gz

Then I've added

export PATH=$PATH:/usr/local/go/bin

in

  • $HOME/.profile
  • /etc/profile

and finally

source $HOME/.profile

source /etc/profile

But when I try the command

go version

the result is

-bash: go: command not found

I've seen that no bin directory is under /usr/local/go path as shown in the picture

在CentOS 7.9上,/usr/local/go/bin路径不存在。

Any suggestion will be appreciated and thank you in advance

答案1

得分: 1

看起来你正在下载源代码,而不是二进制文件。你应该执行以下命令:

wget https://go.dev/dl/go1.19.3.linux-amd64.tar.gz

而不是

wget https://go.dev/dl/go1.19.3.src.tar.gz
英文:

Looks like you are downloading the source, not the binary. You should be doing

wget https://go.dev/dl/go1.19.3.linux-amd64.tar.gz

not

wget https://go.dev/dl/go1.19.3.src.tar.gz

huangapple
  • 本文由 发表于 2022年11月18日 01:04:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/74479389.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定