Gitea
Overview
This installation happens on the
dsb-hub
.
According to Gitea's documentation, Gitea is a painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD. It's open source under MIT license. It is designed to be lightweight, easy to use, and highly customizable, making it an ideal choice for both small teams and large organizations.
Prerequisites
-
Install PostgreSQL:
-
Run the following command to install PostgreSQL and its contrib package:
sudo apt install postgresql postgresql-contrib
-
Switch to the PostgreSQL user:
sudo -i -u postgres
-
Update the PostgreSQL configuration files:
sudo nano /etc/postgresql/16/main/postgresql.conf
-
Scroll down and uncomment the
listen_addresses
setting, then set it tolocalhost
:listen_addresses = 'localhost'
-
Scroll down and uncomment the
password_encryption
setting, then set it toscram-sha-256
:password_encryption = scram-sha-256
-
-
Log into PostgreSQL:
-
Log into the PostgreSQL command line as the
postgres
user:psql
-
-
Configure the Database:
-
Create a new role (user) for Gitea with a secure password and a new database owned by that role:
CREATE ROLE gitea WITH LOGIN PASSWORD 'your_password';
CREATE DATABASE giteadb WITH OWNER gitea TEMPLATE template0 ENCODING 'UTF8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8'; -
Update the
pg_hba.conf
file to allow thegitea
user to connect to thegiteadb
database usingscram-sha-256
:sudo nano /etc/postgresql/16/main/pg_hba.conf
Add the following line:
local giteadb gitea scram-sha-256
-
-
Test Database Connection:
-
Restart the PostgreSQL service and test the connection to the Gitea database:
sudo systemctl restart postgresql.service
psql -U gitea -d giteadb
-
-
Install Nginx:
-
Install Nginx using the following command:
sudo apt install nginx
-
-
Configure Nginx:
-
Unlink the default configuration file:
sudo unlink /etc/nginx/sites-enabled/default
-
Create a new configuration file for the reverse proxy:
sudo nano /etc/nginx/sites-available/reverse-proxy
-