Install and Use Gitea

Student
Search for a command to run...

Student
No comments yet. Be the first to comment.
If you've ever faced the challenge of running graphical user interface (GUI) programs within a container, fear not! While it may seem like a daunting task at first, with this comprehensive guide, we'll walk through the process using Incus Container. ...

When working with containers, managing file sharing between the host system and container can often pose a challenge. However, there is an easy-to-use solution that simplifies this process using just one line of code! This blog post will guide you on...

Incus, a manager and hypervisor for system containers (LXC) and virtual machines (QEMU), is an excellent tool for managing and orchestrating your applications and services. It is a fork of LXD by the original maintainers. I found the documentation re...

Using ble.sh and Starship. Bash by itself is pretty basic. Syntax highlighting, auto-suggestion and history matching are pretty helpful features in any shell. Users might be worried about the bloat these features bring and add delay to the startup of...

The ability to run virtual machines (VMs) and docker containers is an integral part of today’s modern computing landscape. However, issues with internet connectivity inside these environments often cause significant inconvenience for users who depend...

Here I document my steps to get Gitea up and running on a Debian server.
Gitea is a self-hosted service to host and accept contributions to your git repositories on the web.
git
curl/wget to obtain the binary
MySQL/PostgreSQL/MSSQL/SQLite3/TiDB
Go to Gitea's official website for installation instructions.
It usually boils down to
Obtaining and verifying the binary
Creating a user
Creating directory structure
Creating a service file
Setting up a databse
Configuring Gitea
Create a user to run Gitea. Here we name it 'gitea' for the sake of our convenience.
adduer \
--system \
--shell /bin/bash \
--gecos 'Gitea' \
--group \
--disabled-password \
--home /home/gitea \
gitea
mkdir -p /var/lib/gitea/{custom,data.log}
chown -R gitea:gitea /var/lib/gitea
chmod -R 750 /var/lib/gitea
mkdir /etc/gitea
chown root:gitea /etc/gitea
chmod 770 /etc/gitea
cp gitea /usr/local/bin/gitea
Copy the sample gitea.service to /etc/systemd/system/gitea.service, then edit the file with a text editor.
Replace the lines starting with --- to +++.
--- #Wants=postgresql.service
--- #After=postgresql.service
+++ Wants=postgresql.service
+++ After=postgresql.service
--- User=git
--- Group=git
+++ User=gitea
+++ Group=gitea
As user postgres, run the following
createuser gitea
createdb gitea
psql
alter user gites with encrypted password 'super-secure-password';
grant all privileges on database gitea to gitea;
\q
Put the following configuration in /etc/caddy/Caddyfile
gitea.adityakumar.com {
reverse_proxy localhost:3000
}
Now reload caddy
systemctl reload caddy
Enable and start Gitea
systemctl enable --now gitea.service
Head to the website, or go to localhost:3000 if you have physical access to the server. Alternatively you can use port forwarding to configure Gitea using your local machine.
On the page,
enter database username, password and database name.
change Site Title to whatever you prefer.
enter gitea in Run As Username field.
change Gitea Base URL to the site's URL
Rest of the options should be left as is unless you have other requirements.
Click on Install Gitea. It should write the configuration to /etc/gitea/app.ini and be ready for use.
Now change permissions on /etc/gitea to make it read-only.
chmod 750 /etc/gitea
chmod 640 /etc/gitea/app.ini