下载二进制文件: https://dl.gogs.io
wget https://dl.gogs.io/0.11.66/gogs_0.11.66_linux_amd64.zip
解压
unzip gogs_0.11.66_linux_amd64.zip
创建数据库
mysql -uroot -p
create database gogs;
启动(指定端口)
./gogs/gogs web -port=30033
访问页面安装和配置
配置系统服务
cp ./gogs/scripts/systemd/gogs.service /etc/systemd/system/
sudo vim /etc/systemd/system/gogs.service
编辑如下:
[Unit]
Description=Gogs
After=syslog.target
After=network.target
After=mysqld.service # 此处删除其它非依赖应用
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
Type=simple
User=root # 更改为自己的启动用户
Group=root # 更改为自己的启动用户组
WorkingDirectory=/root/gogs # 更改为自己的工作目录
ExecStart=/root/gogs/gogs web # 更改为自己的启动文件位置
Restart=always
Environment=USER=root HOME=/root # 更改为自己的启动用户和位置
# Some distributions may not support these hardening directives. If you cannot start the service due
# to an unknown option, comment out the ones not supported by your version of systemd.
# 这部分配置都删掉
[Install]
WantedBy=multi-user.target