## linux环境搭建 ### golang下载地址 https://studygolang.com/dl - 下载完后解压到 usr/local目录 ``` tar zxvf xxxx.tar.gz -C /usr/local ``` ### 配置 ![](https://img.kancloud.cn/ac/d2/acd299c969a3f56e6936f2c1326cafc9_2400x1080.png) - 创建 gopath 目录 - 环境配置 * `vim ~/.bashrc` 加入一下几行 ``` export GOROOT = /usr/local/go export GOPATH = /data/go/path export GO111MODULE = on export GOPROXY = https://goproxy.cn export PATH=$PATH:$GOROOT/bin::$GOPATH/bin ``` * `source ~/.bashrc` 使刚才配置的患病变量生效 * `go env` 查看相关环境变量 ### 配置说明 ![](https://img.kancloud.cn/73/a2/73a273b820cc64386c1fbd6a79b3a530_2400x1080.png)