我是靠谱客的博主 丰富大神,最近开发中收集的这篇文章主要介绍centos 7 golang gogs 部署centos 7 golang gogs 部署,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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

最后

以上就是丰富大神为你收集整理的centos 7 golang gogs 部署centos 7 golang gogs 部署的全部内容,希望文章能够帮你解决centos 7 golang gogs 部署centos 7 golang gogs 部署所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(47)

评论列表共有 0 条评论

立即
投稿
返回
顶部