https://blog.csdn.net/hwm_life/article/details/82969005
CentOS 7 64位
需要安装的依赖有Nginx,Git,MySQL
1.安装Nginx(这里不做讲解)和配置反向代理
vim nginx.conf include vhost/*.conf; # 引入vhost目录下的所有以conf结尾的文件 vim vhost/gogs.conf # 输入如下内容 server { listen 80; server_name gogs.upupoo.com; ## 域名,根据自己实际情况填写 error_log /home/abc.log; access_log /home/abc_access.log; location / { proxy_pass http://127.0.0.1:3000/; ## gogs默认服务端口为3000 } } 重启nginx ./sbin/nginx -s reload
2.安装Git(这里不讲解)
3.安装MySQL,并添加gogs数据库(这里不讲解MySQL的安装)
CREATE DATABASE gogs CHARACTER SET utf8 COLLATE utf8_bin; GRANT ALL PRIVILEGES ON gogs.* TO ‘root’@‘localhost’ IDENTIFIED BY ‘123456‘; FLUSH PRIVILEGES; QUIT;
1.下载gogs
wget https://dl.gogs.io/0.11.66/gogs_0.11.66_linux_amd64.zip -------------------------------------------------------------------------------------------- unzip gogs_0.11.66_linux_amd64.zip # 解压之后得到gogs文件夹 mv gogs /usr/local cd /usr/local/gogs vim /usr/local/gogs/scripts/init/debian/gogs # 修改关键配置 DESC="Go Git Service" NAME=gogs SERVICEVERBOSE=yes PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME WORKINGDIR=/usr/local/gogs #这个根据自己的目录修改 DAEMON=$WORKINGDIR/$NAME DAEMON_ARGS="web" USER=root #如果运行gogs不是用的这个用户,修改对应用户
3.复制gogs配置文件到/etc/init.d/
cp /usr/local/gogs/scripts/init/debian/gogs /etc/init.d/
chmod +x /etc/init.d/gogs
4.复制service
cp /usr/local/gogs/scripts/systemd/gogs.service /etc/systemd/system/
5.启动gogs
cd /usr/local/gogs ./gogs web # 非守护进程启动 关闭终端,服务停止 nohup ./gogs web & #以守护进程方式启动
6.重启gogs
ps -ef|grep gogs kill -9 gogs nohup ./gogs web &
7.gogs初始化配置
浏览器输入 http://gogs.upupoo.com 首次进入需要进行配置
【end】
原文:https://www.cnblogs.com/yeyu1314/p/10591212.html