Install go1.5 for CentOS7

rootarvin · · 8331 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

https://golang.org/doc/install
下载好后,通过FTPS,传递到Linux里去,放哪里随便你自己,因为被墙了,所以在Windows通过旋风下载了这个玩意儿。
你也可以:
wget https://storage.googleapis.com/golang/go1.5.linux-amd64.tar.gz

//将go解压到/opt,个人喜好罢了
[root@localhost ~]# tar -C /opt -xzf ./go1.5.linux-amd64.tar.gz 

/*在末尾增加一下两行,
GOPATH是工作目录,
GOROOT表示指出go的根目录位置  ps:在自定义程序的安装位置后,需要设置这个
export GOROOT=/opt/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=$HOME/goTest */ [root@localhost ~]# vim /etc/profile [root@localhost ~]# source /etc/profile [root@localhost ~]# mkdir ./goTest/src/test [root@localhost test]# touch ./hello.go 写入内容到hello.go: package main import "fmt" func main() { fmt.Printf("hello, world\n") } [root@localhost src]# cd .. //出现这个错误了,叫我们设置一个.go文件安装后,生成的可执行二进制文件存储在哪个目录,这个通过GOBIN设置地址, export GOBIN=$GOPATH/bin把这段写到/etc/profile的后面去吧。 [root@localhost src]# go install test/hello.go go install: no install location for .go files listed on command line (GOBIN not set) [root@localhost src]# source /etc/profile [root@localhost src]# go install test/hello.go [root@localhost src]# $GOBIN/hello hello, world 到这里,你的go就算安装好了。

  


有疑问加站长微信联系(非本文作者)

本文来自:博客园

感谢作者:rootarvin

查看原文:Install go1.5 for CentOS7

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

8331 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传