How to Install Gitea on AlmaLinux 10 – Complete Guide

Gitea is a lightweight, self-hosted Git service with features similar to GitHub, GitLab, and Bitbucket. It's great for small teams or personal projects.

Prerequisites

  • AlmaLinux 10 server (minimal installation preferred)
  • Root access (or a sudo-enabled user)
Update Your Server

First, update your system packages and install epel-release using the following command

dnf update -y
dnf install epel-release -y
Install SQLite (for Gitea Database)

Gitea supports many databases (SQLite, PostgreSQL, MariaDB, MySQL, etc.). Here, we’ll use SQLite because it’s simple and works well for small Gitea instances.

If you want to use a different database (like PostgreSQL or MariaDB), you can install it here instead of SQLite.

dnf install sqlite -y

Verify SQLite Installation using the following Command:

sqlite3 --version

Output:

3.46.1 2024-08-13 09:16:08 c9c2ab54ba1f5f46360f1b4f35d849cd3f080e6fc2b6c60e91b16c63f69aalt1 (64-bit)
Install Git

Gitea relies on Git, as it’s the core version control system used to manage your repositories. If you haven’t already installed Git, you’ll need to install it first.

Run the following command to install Git:

dnf install git -y

You can check the installed version to confirm it’s working:

git --version

Output:

git version 2.47.1
Create the git System User

For security reasons, it is recommended to run Gitea under a dedicated system user. This ensures that Gitea has only the permissions it needs, reducing the risk in case of a security breach.

Run the following command to create a system user named git:

adduser \
  --system \
  --shell /bin/bash \
  --comment 'Git Version Control' \
  --create-home \
  --home /home/git \
  git
Download the Gitea binary

Download the latest Gitea release from Gitea Downloads.

For example, for version 1.23.8:

dnf install wget
wget -O /tmp/gitea https://dl.gitea.com/gitea/1.23.8/gitea-1.23.8-linux-amd64
mv /tmp/gitea /usr/local/bin/gitea
chmod +x /usr/local/bin/gitea

Replace the version number in the command with the version of Gitea you want to install

Set Up Directories and Permissions

Gitea needs a directory structure to store its data, logs, configurations, and repositories.

Here’s what we’ll do:

  • Create necessary folders for data storage (custom, data, indexers, public, log).

  • Set ownership so that the git system user can read/write to them.

  • Set permissions to control access and enhance security.
mkdir -p /var/lib/gitea/{custom,data,indexers,public,log}
chown git: /var/lib/gitea/{data,indexers,log}
chmod 750 /var/lib/gitea/{data,indexers,log}

mkdir /etc/gitea
chown root:git /etc/gitea
chmod 770 /etc/gitea
Create Systemd Service

A Systemd service lets you easily manage the Gitea application as a background service. This means you can start, stop, restart, and enable it to launch automatically at boot.

Download the Gitea Systemd service template:

wget https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service -P /etc/systemd/system/

This downloads a pre-made service file configured to run Gitea with common settings.

Reload Systemd to detect the new service:

systemctl daemon-reload

Enable the Gitea service so it starts on boot:

systemctl enable --now gitea

Check the service status to confirm it’s running:

systemctl status gitea

If everything is set up properly, you’ll see Gitea listed as active (running).

Configure Firewall

If your server has a firewall enabled (for example, firewalld on AlmaLinux), you need to allow Gitea’s port so that it can be accessed from your network or the internet.

firewall-cmd --permanent --zone=public --add-port=3000/tcp
firewall-cmd --reload
Access Gitea Web UI

To access Gitea, open your browser and go to:

http://<your-server-ip>:3000

Replace <your-server-ip> with your actual IP address.

Once you access Gitea at http://<your-ip>:3000, you’ll see the initial setup screen where you configure Gitea.

  • Database Settings

    Database Type: SQLite3

    Path: /var/lib/gitea/data/gitea.db

image

As we've installed SQLite as a database, so we will use it. If you've installed any other database such as PostgreSQL, MySQL, etc., you can select it accordingly.

  • General Settings

    Site Title: Your Project Name

    Repository Root Path: /home/git/gitea-repositories

    Git LFS Root Path: /var/lib/gitea/data/lfs

    Run As Username: git

    SSH Server Domain: Your server’s IP or domain

    SSH Port: 22 (or your custom SSH port)

    HTTP Port: 3000

    Base URL: http://<your-ip>:3000

    Log Path: /var/lib/gitea/log

Click Install to initialize Gitea.

image

image

Post-Installation Steps

Create an Admin User

Go to http://<your-ip>:3000/user/sign_up and register the first user. This account becomes the administrator.

image

image

Start Creating Repositories!

You’re now ready to use Gitea to manage your Git repositories, issues, and more.

image

Conclusion

By following this guide, you've successfully installed and configured Gitea on a AlmaLinux 10 server using SQLite as the backend. Gitea provides a lightweight, fast, and easy-to-use Git hosting platform suitable for personal use or small teams.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS