gogs服务器搭建
下载gogs :
-
下载安装包
wget https://dl.gogs.io/0.13.0/gogs_0.13.0_linux_amd64.tar.gz
- 官网地址
-
解压安装包
tar -zxvf gogs_0.13.0_linux_amd64.tar.gz
mysql创建数据库

配置gogs参数
-
设置gogs进程守护启动
- 复制gogs.service到/etc/systemd/system
mv /root/gogs/scripts/systemd/gogs.service /etc/systemd/system
- 修改启动项文件(gogs.service)
[Unit] Description=Gogs After=syslog.target After=network.target After=mariadb.service mysql.service mysqld.service postgresql.service memcached.service redis.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 -p 3001 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. ProtectSystem=full PrivateDevices=yes PrivateTmp=yes NoNewPrivileges=true
[Install] WantedBy=multi-user.target
- 启动 - 重新加载systemctl >systemctl daemon-reload - 启动gogs >systemctl start gogs - 配置开机自启动 >systemctl enable gogs -
修改ip地址
- 修改参数
vi /root/gogs/custom/conf/app.ini
server参考块如下
[server] DOMAIN = 106.14.162.203 HTTP_PORT = 3001 EXTERNAL_URL = http://106.14.162.203:3001/ DISABLE_SSH = false SSH_PORT = 22 START_SSH_SERVER = false OFFLINE_MODE = false- 重启gogs
systemctl restart gogs
- 修改参数