I’ve been running a heavily outdated version of Gitea. Rather than doing an update on it, I just reinstalled it.
This applies to installing Gitea version 1.24.3 on Void Linux with PostgreSQL as the backend.
installation procedure
I just list the commands with some short notes.
Stick to one shell session, or run
and in any new shell session.
create group and user gitea
I’m using a group for services like gitea, grafana and whatever.
If you want the user gitea to be in a group that does not exist yet, run i.e.
.
export giteaVersion=1.24.3 <-- adapt that to your gitea version
export giteaInstallDir=/opt/intra/srv/gitea-${giteaVersion} <-- adapt that to your install dir
root@idoru:/$ useradd -g intra -d ${giteaInstallDir}/home -r -s /bin/bash gitea
root@idoru:/$ passwd gitea
the parameters for are
create <home dir> as home dir.
create a system account.
database preparation
create role and database Gitea
create role gitea with login password 'your password here';
create database gitea with owner gitea template template0 encoding UTF8 LC_COLLATE 'en_US.UTF-8' LC_TYPE 'en_US.UTF-8';
Aside: typing SQL code in all upper case looks like 70’s code.
configure access for database user gitea in pg_hba.conf
Adapt the host line to the IP of the machine on which Gitea is running in PostgreSQL’s .
local gitea gitea scram-sha-256
host gitea gitea 192.0.2.10/32 scram-sha-256
test database access
With you should get a psql console with the database gitea as the current
database to use.
set up the directories for Gitea
Gitea uses odd locations for the installation (see Installation from binary).
I rather have Gitea installed in the standard directories, i.e.,
programs that are not installed and managed by the OS’ package manager, usually get installed in .
is the base dir of the installation.
By default, gitea uses as the custom folder. You can set it explicitly with
something like .
run Gitea binary
Run .
Do not run the Gitea binary as root. but as a less privileged user, i.e. user gitea or some user in the group
you used for the Gitea installation. Run gitea with
gitea web -c ${giteaInstallDir}/conf/gitea.conf --port 3000 --pid /var/run/gitea/gitea.pid
installer screens
If the binary is fired up for the first time with the installation dirs being empty, the web installer comes up.
Open in your browser. localhost can be replaced with hostname.
When the installer comes up, it offers to set up an administrative user account. Create this administrative user
account. For most settings in the installer, the defaults are sane. Some notable installer screen follow:
database setup
Initial Configuration click on image to enlarge
x
Nothing special here. The proposed values are ok. 127.0.0.1* can be replaced with the hostname of the machine.
If PostgreSQL runs on another machine you have to change the IP, or use the hostname or FQDN.
general settings
General Settings click on image to enlarge
x
Adapt the Site Title and check the rest of the settings.
optional settings
Optional Settings click on image to enlarge
x
The optional settings are the settings for the SMTP host where Gitea sends emails for notifications.
fix retarded file paths
The installation procedure dumps the dir into … WTF.
In , section there is the line
and in section
, there is the line .
After stopping the Gitea server, change the data dir in both sections to :
I fiddled with the runit coreservices scripts on my machine, so the startup deviates from default Void start-up.
On Void, make sure to use the right number prefix for script,
so that gitea is started when all dependencies like filesystems, network, etc are available.