「Gogs」- 安装(Linux、CentOS)

  CREATED BY JENKINSBOT

问题描述

该笔记将记录:在 CentOS 7.x 中,安装 Gogs 0.11 的方法,以及相关问题的解决方法。

第一步、安装环境依赖

安装数据库服务

MySQL Version >= 5.7 / PostgreSQL / TiDB / NOTHING with SQLite3

由于我们用户量较小,所以我们使用 SQLite3 数据库,因此无需安装任何数据库服务。

安装 Git 命令

# apt-get install -y git

# yum install -y git

第二步、安装并运行服务(CentOS 7.5)

From packages – Gogs
Installation of gogs/gogs v0.11.91 for CentOS / RHEL 7 64 bits

# 安装 Gogs 服务
wget -O /etc/yum.repos.d/gogs.repo https://dl.packager.io/srv/gogs/gogs/master/installer/el/7.repo
yum install -y gogs

# 配置 Nginx 服务
cat > /etc/nginx/conf.d/gogs.conf <<EOF
server {
  listen          80;
  server_name     gogs.example.com;

  client_max_body_size   20m;

  location / {
    proxy_pass      http://127.0.0.1:6000;
  }
}
EOF

systemctl enable nginx.service
systemctl start nginx.service

# 初始化配置
# 浏览器访问 http://gogs.example.com

如果使用该方法安装,则配置文件位于 /etc/gogs/ 目录中(请勿修改 /opt/gogs/conf/app.ini 配置文件)。

# 08/06/2021 当时,我们安装 Gogs 0.11 版本的时候,忘记在文档中记录如何设置管理员帐号。后来,我们测试 0.12.3 版本时,首个注册的用户将成为管理员。所以,今天在这里进行补充记录。

相关链接

通过二进制包安装:From binary – Gogs
修改配置并运行:Config and run – Gogs

我们安装的版本:

# yum info gogs.x86_64
...
Installed Packages
Name        : gogs
Arch        : x86_64
Version     : 0.11.91
Release     : 1598527633.016d9d8c.centos7
Size        : 101 M
Repo        : installed
From repo   : gogs
Summary     : Gogs is a painless self-hosted Git service
URL         : http://example.com/no-uri-given
License     : unknown
Description : Gogs is a painless self-hosted Git service

参考文献

Installation – Gogs
Gogs/Install from packages