centos7下配置golang1.7.1环境(自己做测试了)

环境(个人阿里云主机):

  1. # hostnamectl  
  2.    Static hostname: iZ23nwzgx3sZ  
  3.          Icon name: computer-vm  
  4.            Chassis: vm  
  5.         Machine ID: 45461f76679f48ee96e95da6cc798cc8  
  6.            Boot ID: 4022018209e04363871ed0279a30c225  
  7.     Virtualization: xen  
  8.   Operating System: CentOS Linux 7 (Core)  
  9.        CPE OS Name: cpe:/o:centos:centos:7  
  10.             Kernel: Linux 3.10.0-229.11.1.el7.x86_64  
  11.       Architecture: x86-64  
  12. # lsb_release -a  
  13. LSB Version:    :core-4.1-amd64:core-4.1-noarch  
  14. Distributor ID: CentOS  
  15. Description:    CentOS Linux release 7.2.1511 (Core)   
  16. Release:        7.2.1511  
  17. Codename:       Core  

到官方https://golang.org/dl/下载安装包
  1. </pre><pre name="code" class="plain">#wget https://storage.googleapis.com/golang/go1.7.1.linux-amd64.tar.gz  
  2.   
  3. # tar zxvf go1.7.1.linux-amd64.tar.gz -C /usr/local  
  4.   
  5. 新建GOPATH目录  
  6. # mkdir -p /mnt/wwwroot/gofile  
  7. # vim /etc/profile  
  8.   
  9. export GOROOT=/usr/local/go  
  10. export GOBIN=$GOROOT/bin  
  11. export PATH=$PATH:$GOBIN  
  12. export GOPATH=/mnt/wwwroot/gofile  
  13. :wq保存  
  14.   
  15. 使其生效  
  16. #source /etc/profile  
  17.   
  18. 查看是否配置成功  
  19. # go version  
  20. go version go1.7.1 linux/amd64  
  21.   
  22. 简单测试:  
  23. # cd /mnt/wwwroot/gofile  
  24. # vim hello.go  
  25. package main  
  26. import "fmt"  
  27. func main() {  
  28.     fmt.Println("Hello, 世界")  
  29. }  
  30. # go run hello.go  
  31. Hello, 世界 

来源:http://blog.csdn.net/ligaofeng/article/details/52671680

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值