Documentation Videos View Site

# Installing Gitea Server on Oracle Linux 9

A Installation Guide with SQLite Database for a Private Git Server

# Introduction

Gitea is a lightweight, self-hosted Git service that provides a simple way to manage repositories, users, and organizations. This guide walks you through the installation process on Oracle Linux 9 using SQLite as the database backend.

SQLite is an excellent choice for small to medium installations because it requires zero database administration and simplifies the deployment process. For larger deployments or high-traffic environments, you may want to consider PostgreSQL or MySQL instead.

# Step 1: System Prerequisites

Before installing Gitea, ensure your system is up to date. This helps prevent compatibility issues and ensures you have the latest security patches.

# Download the Gitea package for OL9 from CMDB360

If you do not have internet access on the gitea server, a bundle has been provided to install git, gitea for an Oracle Linux 9 Arm offline server. Download this bundle from a machine with internet access and copy it to the gitea server.

This bundle includes:

  • git 2.47.3 rpms
  • gitea 1.25.3 executable
  • gitea.service file for systemd

To download it, point your browser to:

https://control.cmdb360.com/downloads/Gitea1.25.3Bundle.tar.gz

# Update System Packages

Login to your gitea server as the opc user or a user with sudo privileges, and run the following command to update all installed packages:

sudo dnf update -y

​

Note: You may skip this step if you do not have internet access or the ability to update packages

# Step 2: Install Git

Check is git is installed on your server. Git version 2.0 or greater is required

git --version

​

Git is the core version control system that Gitea uses. Install it using the DNF package manager:

sudo dnf install git -y

​

If you do not have internet access, go the the git_rpms directory in the downloaded bundle and run:

sudo dnf install -y --disablerepo=* ./*.rpm

​

Check is git is installed on your server. Git version 2.0 or greater is required

git --version

​

# Step 3: Create a Dedicated Gitea User

For security reasons, Gitea should run under its own dedicated system user account rather than root. This limits the potential damage if the service is compromised.

Create the gitea group and user with the following command:

sudo groupadd --system git
sudo useradd --system --shell /bin/bash --comment 'Git Version Control' --create-home --home-dir /home/git git

​

This command creates a system user named git with a home directory at /home/git.

# Step 4: Download and Install Gitea

Gitea is distributed as a single binary file, making installation straightforward. You’ll download the latest version and place it in the appropriate system directory.

# Download the Binary

First, check the latest version at https://github.com/go-gitea/gitea/releases, then download it:

GITEA_VERSION="1.25.3" # Replace with latest version
wget https://dl.gitea.com/gitea/${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-arm64

​

Note: If you can not download the gitea, version 1.25.3 for Oracle Linux 9 arm servers is included in the bundle

# Copy the Executable to a Common Directory and Name

GITEA_VERSION="1.25.3" # Replace with latest version if not using bundle
sudo cp gitea-${GITEA_VERSION}-linux-arm64 /usr/local/bin/gitea

​

Note: Make sure /usr/local/bin is in your PATH or copy the gitea executable to somewhere in your PATH. If you copy it to a directory other than /usr/local/bin the gitea.service file must be editted, changing the ExecStart line to location of the executable

# Make the Binary Executable

sudo chmod +x /usr/local/bin/gitea

​

# Verify Installation

Confirm that Gitea is installed correctly:

gitea --version

​

It should come back with something like

gitea version 1.25.3 built with GNU Make 4.3, go1.25.5 : bindata, sqlite, sqlite_unlock_notify

​

# Step 5: Create Required Directories

Gitea needs several directories for storing data, custom files, and logs. Create these directories with the appropriate permissions:

sudo mkdir -p /var/lib/gitea/{custom,data,log}
sudo chown -R git:git /var/lib/gitea/
sudo chmod -R 750 /var/lib/gitea/

​

Create the configuration directory:

sudo mkdir /etc/gitea
sudo chown root:git /etc/gitea
sudo chmod 770 /etc/gitea

​

Note: The configuration directory is initially writable so Gitea can create the initial configuration during web setup. It may be secured after installation.

# Step 6: Create Systemd Service

To run Gitea as a system service that starts automatically on boot, create a systemd service file or copy the one provdied in the bundle:

sudo vi /etc/systemd/system/gitea.service

​

Add the following content to the file:

[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target

[Service] 
RestartSec=2s 
Type=simple 
User=git 
Group=git 
WorkingDirectory=/var/lib/gitea/ 
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini 
Restart=always 
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea 

[Install] 
WantedBy=multi-user.target

​

# Step 7: Configure Firewall

Oracle Linux uses firewalld by default. You need to open port 3000 (Gitea’s default port) to allow web access:

sudo firewall-cmd --permanent --add-port=3000/tcp sudo firewall-cmd --reload

​

Note: If you plan to use a reverse proxy with HTTPS (recommended for production), you’ll also need to open port 443.

# Step 8: Start and Enable Gitea Service

Now start the Gitea service and enable it to start automatically on system boot:

sudo systemctl daemon-reload 
sudo systemctl start gitea 
sudo systemctl enable gitea

​

Verify that the service is running:

sudo systemctl status gitea

​

# Step 9: Complete Web Installation

Gitea is now running! Open your web browser and navigate to:

http://your-server-ip:3000

You’ll see the initial configuration page. Configure the following settings:

# Database Settings

• Database Type: Select SQLite3

• Path: Leave as default /var/lib/gitea/data/gitea.db

# General Settings

• Site Title: Choose a name for your Gitea instance

• Repository Root Path: Leave as default /var/lib/gitea/data/gitea-repositories

• Git LFS Root Path: Leave as default /var/lib/gitea/data/lfs

• Server Domain: Your server’s IP address or domain name

# Administrator Account

Create your administrator account by filling in:

• Username

• Password

• Email address

Click Install Gitea to complete the setup.

# Secure the Configuration File

After completing the web setup, secure the configuration directory to prevent unauthorized modifications:

sudo chmod 750 /etc/gitea sudo chmod 640 /etc/gitea/app.ini

​

# Step 10: Setup Users

From the Menu under Admin user Icon in the top right corner, select Site Administration

Then from the Left Menu, select User Accounts and click the Create User Account button. Select the Visibility Level and fill in the fields for the new user and click Create User Account. This user may now log into the Gitea server and create repos and

# Step 11: Create Repository

Login to the Gitea Server. Create an Organization if one has not been created by your Admin. Click the Organization button and then the ‘+’ button on the Organizations tab. If your Organization already exists, skip to creating the Repository

# Create your Organization

Add a Name and choose the appropriate Visibility level, then Click the Create Organization button.

#

Under the Organization create a repository by clicking on the ‘+’ next to the Repositories tab. Give a Name and select the Make repository private box. Also select the Initialize repository box and click the Create Repository button

# Add Deploy Key for the Ansible Satellite

From the Repository, click on Settings and then choose Deploy Keys from the Left Menu. Click the Add Deploy Key button. Fill out the Title and copy in the Public Key from the Ansible Satellite that will access this repository. This key is found on the Overview page of the Satellite in the CMDB360 Base Station. Click the Add Deploy Key when done. A Deploy Key is required for each Ansible Satellite that will access this repository.

Note: When configuring your CMDB360 Ansible Satellite, the format of the repository will be as follows:

git@<git-server>:<git-org>/<git-repo>.git

​

where:

• is the name or IP address of your Gitea server

• is the name of the Organization in your Gitea server

• is the name of the Repository in your Gitea server

# Step 12: Setup User SSH Key and Working with the Repository

Login to the Gitea Server with your user account. Click on your profile icon in the top right corner. Select Settings. From the Left Menu select ‘SSH / GPG Keys’. Click the Add Key button in the Manage SSH Keys box. Add a name and paste your public key into the box. Then select Add Key. You can now authenticate to the Gitea Server using your private key.

On your Windows machine, make sure the private key is called id_rsa ans is in the C:\Users\.ssh directory

Add your user and email information to the Windows git config by running the following commands from a command prompt where the user name and email are those associated with your account on the Gitea server.

git config --global user.email "bob@example.com"
git config --global user.name "bob"

​

You should now be able to clone the repository to your machine to work on it. The following command will create a directory named after the Repository under the current directory. Replace the Organization and Repository names and the Git Server as appropriate.

git clone git@<git-server-name-or-ip>:MyOrg/MyRepo.git

​

Now you may add or edit files and then commit and push changes back to the Gitea server for other users to access them.

For more information on using git, refer to:

https://git-scm.com/learn

# Step 13: Optional - Set Up HTTPS

# Obtain SSL Certificate

Create a certificate file to use:

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=CommonNameOrHostname"

​

Copy the certificate files to /var/lib/gitea/custom/

sudo cp *.pem /var/lib/gitea/custom/ 
sudo chmod +r /var/lib/gitea/custom/key.pem

​

Edit /etc/gitea/app.ini. Edit or add the lines below to the server section. Replace the as appropriate

[server]
PROTOCOL  = https
ROOT_URL  = https://<Your-server-name-or-IP>:3000/
HTTP_PORT = 3000
CERT_FILE = /var/lib/gitea/custom/cert.pem
KEY_FILE  = /var/lib/gitea/custom/key.pem

​

Restart gitea

sudo systemctl restart gitea

​

# SQLite Database Location and Management

The SQLite database file is stored at:

/var/lib/gitea/data/gitea.db

This file is automatically created during the web installation process and contains all your repositories, users, settings, and other data.

Repositoty data is stored in the following directory

/var/lib/gitea/data/gitea-repositories

# Backing Up Your Data

Regular backups are a good idea of both the database file and the repository directory

# Troubleshooting

If you encounter issues with your Gitea installation, here are some common troubleshooting steps:

# Check Service Status

View the current status of the Gitea service:

sudo systemctl status gitea

​

You should see something like below, with the Active status

[root@gitea-test2 gitea]# sudo systemctl status gitea
● gitea.service - Gitea (Git with a cup of tea)
     Loaded: loaded (/etc/systemd/system/gitea.service; enabled; preset: disabled)
     Active: active (running) since Tue 2026-01-06 17:40:24 GMT; 3 weeks 2 days ago
   Main PID: 45295 (gitea)
      Tasks: 11 (limit: 35604)
     Memory: 120.9M
        CPU: 25min 18.549s
     CGroup: /system.slice/gitea.service
             └─45295 /usr/bin/gitea web --config /etc/gitea/app.ini

​

# View Logs

Check the Gitea logs for error messages:

sudo journalctl -u gitea -f

​

The -f flag follows the log in real-time. Press Ctrl+C to exit.

# Common Issues

• Port 3000 already in use: Check if another service is using port 3000 with:

sudo netstat -tulpn | grep 3000

​

• Permission denied errors: Verify that all directories are owned by the git user and have correct permissions

• Cannot access web interface: Ensure firewall rules are configured correctly and the service is running

# Conclusion

Congratulations! You’ve successfully installed a private Gitea server on Oracle Linux 9 with SQLite as the database backend. Your self-hosted Git service is now ready to manage your code repositories securely.

SQLite provides a simple, zero-configuration database solution that’s perfect for small to medium teams. As your needs grow, you can always migrate to PostgreSQL or MySQL for better performance and scalability.

For more information and advanced configuration options, visit the official Gitea documentation at https://docs.gitea.io.