群晖搭建Gitea教程(使用系统自带的postgresql)

基于群晖7.2.2,使用套件中心的gitea,和系统自带的postgresql

postgresql:

切换到postgres用户

sudo -I -u postgres

在想要保存数据库的磁盘路径下创建PostgreSql文件夹

初始化数据库文件夹配置

initdb -D ./PostgreSql

备份./PostgreSql路径下的postgresql.conf / pg_hba.conf / pg_ident.conf 等文件

cp postgresql.conf postgresql.conf.bak

cp pg_hba.conf pg_hba.conf.bak

cp pg_ident.conf pg_ident.conf.bak

拷贝系统postgresql默认配置文件到当前目录

cp /etc/postgresql/postgresql.conf ./

cp /etc/postgresql/pg_hba.conf ./

cp /etc/postgresql/pg_ident.conf ./

修改postgresql.conf中port为5433(如果没有则新增),以及hba_file和ident_file为PostgreSql路径下的配置文件,并屏蔽external_pid_file和include_if_exists

port = 5433

hba_file = '/xxx/PostgreSql/pg_hba.conf'

ident_file = '/xxx/PostgreSql/pg_ident.conf'

修改pg_hba.conf允许gitea远程使用gitea账号连接gitearepos数据库,以及允许本机不使用gitearepos账号免密连接gitearepos

TYPE DATABASE USER ADDRESS METHOD

local all postgres peer map=pg_root

local all all peer

host postgres postgres 127.0.0.1/32 trust

host gitearepos gitea 127.0.0.1/32 md5

使用postgres账号连接到新建立的实例

psql -h localhost -p 5433 -U gitearepos -d gitearepos

在sql命令行中输入如下命令创建gitea账户和数据库gitearepos

CREATE USER gitea WITH PASSWORD 'your password';

CREATE DATABASE gitearepos OWNER gitea;

创建开机启动脚本.startup.sh并输入如下内容

#!/bin/bash

sudo -u postgres PGDATA=/volume2/PostgreSql postgres -D /volume2/PostgreSql

使用计划任务并以root用户执行.startup.sh

gitea:

在套件中心搜索gitea并安装

重启

打开gitea web使用postgresql数据库连接刚刚创建的postgresql实例和数据库

主机填:127.0.0.1

端口号则为第二个新建的postgresql的实例端口号:5433

账户名和密码、数据库都是在新建的postgresql实例中所创建的

gitea登录成功后使用编辑器编辑gitea配置文件/volume1/@appdata/gitea/conf.ini,打开gitea内置ssh服务,并修改端口号(注意端口号需要大于1024,不然没有权限)

START_SSH_SERVER = true

SSH_PORT = 8419

重启即可使用ssh拉取仓库了

相关推荐
Domain-zhuo1 个月前
Git常用命令
前端·git·gitee·github·gitea·gitcode
落落鱼20131 个月前
以二进制形式创建gitea仓库
gitea
鲁子狄2 个月前
[笔记] Git 实战指南:Git命令大全 与 Git提交信息规范
笔记·git·gitee·gitlab·github·gitea·gitcode
鲁子狄2 个月前
[笔记] Windows 上 Git 安装详细教程:从零开始,附带每个选项解析
windows·笔记·git·gitee·github·gitea·gitcode
南东山人2 个月前
私有库gitea安装
gitea
獨枭4 个月前
Gitea 数据迁移
gitea
獨枭4 个月前
Windows 搭建 Gitea
gitea
Linux猿4 个月前
828华为云征文 | 云服务器Flexus X实例:部署 Gitea,拥有自己的Git仓库,管理本地代码
服务器·华为云·gitea·云服务器·git仓库·flexus云服务器x实例·华为云服务器
野猪佩挤5 个月前
Gitea Action注册runner
gitea