Blogger Information
Blog 143
fans 1
comment 0
visits 439843
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
centos7 安装gogs
弘德誉曦的博客
Original
1075 people have browsed it

创建git用户

sudo adduser git

切换到 git 用户,并在其账户所在家目录,下载 Gogs

su git
cd ~
wget https://dl.gogs.io/0.11.86/gogs_0.11.86_linux_amd64.tar.gz
tar -zxvf gogs_0.11.86_linux_amd64.tar.gz

执行 gogs 数据库文件

cd /home/git/gogs/scripts
mysql -u root -p
source mysql.sql
show databases;

配置与运行

vim /home/git/gogs/scripts/init/centos/gogs

核对文件信息

19 PATH=/sbin:/usr/sbin:/bin:/usr/bin
20 DESC=”Gogs”
21 NAME=gogs
22 SERVICEVERBOSE=yes
23 PIDFILE=/var/run/$NAME.pid
24 SCRIPTNAME=/etc/init.d/$NAME
25 WORKINGDIR=/home/git/gogs # 仓库地址,可以自行修改
26 DAEMON=$WORKINGDIR/$NAME
27 DAEMON_ARGS=”web”
28 USER=git # 如果运行 gogs 不是名为 git 的账户,则需要修改。

如是用 root 账户运行 gogs,则这里修改成 root

切换到 root 账户,然后复制到 /etc/init.d/ 目录下

su root
sudo cp /home/git/gogs/scripts/init/centos/gogs /etc/init.d/
sudo chmod +x /etc/init.d/gogs
cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/

开启服务 运行

service gogs start
cd /home/git/gogs
./gogs web >/dev/null 2>&1 & //后台运行

配置反向代理

server {

  1. listen 80;
  2. server_name xxxx;
  3. location / {
  4. proxy_pass http://127.0.0.1:3000/;
  5. }

}

浏览器访问 http:// 远程主机 IP 地址 :3000

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post