2023-03-30

Installation of Gitea on a home server. The ssh solution was fine, but gitea adds issues and collaboration as well as package management in the latest version.

Application Installation

The snap installation runs as root, not comfortable with that setup so switching to the binary running as git. Found Gitea on Ubuntu 20.04.

ubuntu@netservice:~$ VERSION=1.16.1
ubuntu@netservice:~$ sudo wget -O /tmp/gitea https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-linux-amd64
ubuntu@netservice:~$ sudo mv /tmp/gitea /usr/local/bin
ubuntu@netservice:~$ sudo chmod +x /usr/local/bin/gitea

Create the directories that we will need.

ubuntu@netservice:~$ sudo mkdir -p /var/lib/gitea/{custom,data,log}
ubuntu@netservice:~$ sudo chown -R git:git /var/lib/gitea/
ubuntu@netservice:~$ sudo chmod -R 750 /var/lib/gitea/
ubuntu@netservice:~$ sudo mkdir /etc/gitea
ubuntu@netservice:~$ sudo chown root:git /etc/gitea
ubuntu@netservice:~$ sudo chmod 770 /etc/gitea

Open the configuration page at http://netservice:3000

PostgreSQL User and Database

Log into PostgreSQL host (appserver01). Become postgres user and open a sql session.

sudo su -c "psql" - postgres

Create the database for gitea.

postgres=# CREATE DATABASE giteadb WITH OWNER gitea TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';

Reload the database configuration.

Create directories on RAID

git@netservice:~$ mkdir /mnt/raid1/gitea/common
git@netservice:~$ mkdir /mnt/raid1/gitea/common/data
git@netservice:~$ mkdir /mnt/raid1/gitea/common/data/gitea-repositories
git@netservice:~$ mkdir /mnt/raid1/gitea/common/data/lfs
git@netservice:~$ cd /var/snap/gitea/common/conf

Fill in the form on netservice.