5
Linux下安装Go环境
source link: https://studygolang.com/articles/13957?fr=sidebar
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
- VPS:VirMach $1.25一个月的VPS
- 系统:Ubuntu Server 16.04 LTS 64bit Minimal
- 可以自己创建个虚拟机安装一个Server版的Linux,或者在这里选一个共享主机
登录Linux
Mac或Linux的用户可以用命令ssh [email protected]
登录主机
Window的用户可以使用SecureCRT登录主机
虚拟机用户直接打开你的虚拟机
安装Go环境
Golang官网下载地址:https://golang.org/dl/
- 打开官网下载地址选择对应的系统版本, 复制下载链接
这里我选择的是go1.10.3.linux-amd64.tar.gz
:https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz
-
cd
进入你用来存放安装包的目录。嫌麻烦就直接输入cd ~
。
然后执行
wget https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz
- 执行
tar
解压到/usr/loacl
目录下,得到go
文件夹
tar -C /usr/local -zxvf go1.10.3.linux-amd64.tar.gz
- 添加
/usr/loacl/go/bin
目录到PATH变量中。添加到/etc/profile
或$HOME/.profile
都可以
// 习惯用vim,没有的话可以用命令`sudo apt-get install vim`安装一个
vim /etc/profile
// 在最后一行添加
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
// wq保存退出后source一下
source /etc/profile
- 执行
go version
,如果现实版本号,则Go环境安装成功。是不是很简单呢?
运行第一个程序
先留个坑,后面再填
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK