英文:
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
目录,如下图所示:
非常感谢,期待您的建议。
英文:
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
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论