centos 7 golang gogs 部署
很久没有时间记录一些东西了,用起来的时候就很麻烦,
golang 的安装
yum install go
这个原生安装但是 似乎docker 的环境有问题,主要是gorootpath的问题,会导致后面 go get 报错(import path does not begin with hostname),
cd /tmp
curl -LO https://storage.googleapis.com/golang/go1.7.linux-amd64.tar.gz
shasum -a 256 go1.7*.tar.gz
sudo tar -C /usr/local -xvzf go1.7.linux-amd64.tar.gz
mkdir -p ~/projects/{bin,pkg,src}
sudo vi /etc/profile.d/path.sh
export PATH=$PATH:/usr/local/go/bin
vi ~/.bash_profile
#export GOBIN="$HOME/projects/bin"
#export GOPATH="$HOME/projects/srcexport"
#GOROOT="/path/to/go"
source /etc/profile && source ~/.bash_profile
以下是我出错的处理方式:
I think you installed Go in /usr/local/go.
So change your GOROOT path to the value of /usr/local/go/bin.
It seems that you meant to have your workspace (GOPATH) located at /home/me/go.
This might fix your problem.
Add this to the bottom of your bash profile, located here => $HOME/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin
这里涉及到链接数据库权限的命令:
grant all privileges on *.* to root@'%' identified by "mima";
flush privileges;
gogs官方源码安装[1]: https://gogs.io/docs/installation/install_from_source.html
go安装[2]: https://www.digitalocean.com/community/tutorials/how-to-install-go-1-7-on-centos-7
报错的解决[3]: http://stackoverflow.com/questions/20458796/unrecognized-import-path-with-go-get
有疑问加站长微信联系(非本文作者)