centos下安装go以及websocket

  • A+
所属分类:Linux

centos下安装go以及websocket

1.使用yum安装go

yum install golang

2.修改环境

echo 'export PATH=$PATH:/usr/lib/golang/bin'>>/etc/profile
echo 'export PATH=$PATH:/home/gopath/bin'>>/etc/profile
echo 'export GOPATH=/home/gopath'>>/etc/profile

3.重新加载环境

source /etc/profile

4.安装gopm包

go get -u github.com/gpmgo/gopm

5.下载net包,并设置好环境

go get github.com/golang/net #下载net模块
mkdir /home/gopath/src/golang.org
mkdir /home/gopath/src/golang.org/x
ln -s /home/gopath/src/github.com/golang/net /home/gopath/src/golang.org/x/net #软连接过去,因为库路径需要

6.安装websocket模块

go install golang.org/x/net/websocket

PS:由于墙的原因导致安装websocket比较麻烦.

百分购

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: