下载gogs
cd /home/git
wget https://dl.gogs.io/0.11.66/gogs_0.11.66_linux_amd64.tar.gz
tar -xf gogs_0.11.66_linux_amd64.tar.gz
修改Gogs service配置文件
vim /home/git/gogs/scripts/init/centos/gogs
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Go Git Service"
NAME=gogs
SERVICEVERBOSE=yes
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
WORKINGDIR=/home/git/gogs #这个根据自己的目录修改
DAEMON=$WORKINGDIR/$NAME
DAEMON_ARGS="web"
USER=root #如果运行gogs不是用的这个用户,修改对应用户
复制到/etc/init.d/
sudo cp /home/git/gogs/scripts/init/centos/gogs /etc/init.d/
增加执行权限
sudo chmod +x /etc/init.d/gogs
复制service
cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/
启动:systemctl start gogs
开机自启动: systemctl enable gogs
查看运行状态 : systemctl status gogs
启动Gogs
cd /home/git/gogs/
nohup ./gogs web &
在自己浏览器上配置Gogs, localhost替换成自己的ip地址
http://localhost:3000/install
有关Gogs的配置文件在/home/git/gogs/custom/conf/app.ini里面,相关配置在https://gogs.io/docs中有。