// ssd vps

How to Install and Configure Gitea on a Linux VPS: Complete Guide to Your Own Git Server

September 08, 2026 · by Alex M.

How to Install and Configure Gitea on a Linux VPS: Complete Guide to Your Own Git Server

If you work with source code and want full control over your repositories, Gitea is one of the best open-source solutions available today. Easy to install, fast, and with a modern GitHub-like interface, Gitea runs excellently on a SSD VPS even with modest resources.

In this guide you'll learn how to install Gitea on an Ubuntu 22.04 server, configure it behind an Nginx reverse proxy, and secure it with an SSL certificate — all step by step.


What Is Gitea and Why Use It?

Gitea is a self-hosted Git platform written in Go. It offers:

  • Git repositories with a modern web interface
  • Issues, Pull Requests, Wiki — functionality similar to GitHub
  • Authentication with 2FA, OAuth2, LDAP
  • Webhooks for CI/CD integration
  • Low resource consumption — runs on servers with just 1 GB RAM

Unlike GitLab, which requires substantial resources, Gitea is ideal if you choose an entry-level or mid-range NVMe VPS.


Prerequisites

Before starting, make sure you have:

  • A VPS running Ubuntu 22.04 (minimum 1 vCPU, 1 GB RAM)
  • Root or sudo access
  • A configured domain (e.g., git.example.com) with DNS pointing to your VPS IP
  • Nginx (we'll install it if not present)

If you don't have a server yet, you can pick a 1C VPS from CLIQHOST, perfectly suited for this type of application.


Step 1: Update the System and Install Dependencies

Start by updating packages:

sudo apt update && sudo apt upgrade -y

Install Git and other required dependencies:

sudo apt install -y git wget curl nginx

Step 2: Create a Dedicated User for Gitea

For security, Gitea should run under a non-root user:

sudo adduser \
  --system \
  --shell /bin/bash \
  --gecos 'Gitea' \
  --group \
  --disabled-password \
  --home /home/gitea \
  gitea

Step 3: Create the Directory Structure

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

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

Step 4: Download and Install Gitea

Check the official Gitea download page for the latest stable release, then download the binary:

wget -O /tmp/gitea https://dl.gitea.com/gitea/1.22.0/gitea-1.22.0-linux-amd64

Move the binary and set permissions:

sudo mv /tmp/gitea /usr/local/bin/gitea
sudo chmod 755 /usr/local/bin/gitea

Verify the installation:

gitea --version

Step 5: Set Up the Database (SQLite or MySQL)

Gitea has native SQLite support — no additional installation needed. This is the simplest option.

sudo apt install -y mariadb-server
sudo mysql_secure_installation

Create the database and Gitea user:

sudo mysql -u root -p
CREATE DATABASE gitea CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'gitea'@'localhost' IDENTIFIED BY 'secret_password';
GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 6: Create the systemd Service

To have Gitea start automatically, create a service file:

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

File contents:

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

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

[Install]
WantedBy=multi-user.target

Enable and start the service:

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

Check status:

sudo systemctl status gitea

Gitea is now running on port 3000 (default).


Step 7: Configure Nginx as a Reverse Proxy

Create an Nginx virtual host for your domain:

sudo nano /etc/nginx/sites-available/gitea
server {
    listen 80;
    server_name git.example.com;

    location / {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Activate the configuration:

sudo ln -s /etc/nginx/sites-available/gitea /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

Step 8: Install an SSL Certificate with Let's Encrypt

Install Certbot:

sudo apt install -y certbot python3-certbot-nginx

Obtain the certificate:

sudo certbot --nginx -d git.example.com

Certbot will automatically modify the Nginx configuration for HTTPS. If you prefer a commercial certificate with extended validation, check out CLIQHOST SSL certificates for different needs.


Step 9: Initial Setup via the Web Interface

Open https://git.example.com in your browser. You'll see the Gitea installation page.

Essential settings:

Field Recommended value
Database Type SQLite3 or MySQL
Site Title Your name
Repository Root Path /var/lib/gitea/data/repositories
Git Hooks Path /var/lib/gitea/data/home
HTTP Port 3000
Application URL https://git.example.com

Create the administrator account and complete the installation.


Step 10: Advanced Configuration via app.ini

After installation, the configuration file is at /etc/gitea/app.ini. Some useful settings:

Disable public registration

[service]
DISABLE_REGISTRATION = true

Configure email (SMTP)

[mailer]
ENABLED = true
FROM = [email protected]
SMTP_ADDR = smtp.example.com
SMTP_PORT = 587
USER = [email protected]
PASSWD = smtp_password

Limit repository size

[repository]
MAX_CREATION_LIMIT = -1
DEFAULT_PUSH_CREATE_PRIVATE = true

After any changes, restart the service:

sudo systemctl restart gitea

Step 11: Securing Your Gitea Installation

Configure the firewall

sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable
sudo ufw status

Enable two-factor authentication (2FA)

From the web interface, go to Settings → Security → Two-Factor Authentication and enable TOTP.

Regular updates

Periodically check official Gitea releases and update the binary:

sudo systemctl stop gitea
sudo wget -O /usr/local/bin/gitea https://dl.gitea.com/gitea/1.22.x/gitea-1.22.x-linux-amd64
sudo chmod 755 /usr/local/bin/gitea
sudo systemctl start gitea

Step 12: Automated Gitea Backups

Gitea includes a native backup command:

sudo -u gitea gitea dump -c /etc/gitea/app.ini --tempdir /tmp

This generates a .zip file containing repositories, database, attachments and configuration. Schedule this with a cron job:

sudo crontab -e
0 2 * * * sudo -u gitea gitea dump -c /etc/gitea/app.ini --tempdir /tmp --file /backup/gitea-$(date +\%Y\%m\%d).zip

For a more robust infrastructure with managed backups, CLIQHOST server management can automate this process for you.


Gitea vs. Alternatives: When to Choose What?

Solution Min. RAM Ease of install Features
Gitea ~100 MB ⭐⭐⭐⭐⭐ Medium
GitLab CE ~4 GB ⭐⭐ Advanced
Gogs ~50 MB ⭐⭐⭐⭐⭐ Basic
Forgejo ~100 MB ⭐⭐⭐⭐⭐ Medium

Gitea offers the best balance between functionality and resource consumption — perfect for small teams and personal projects that want independence from GitHub or GitLab Cloud.


Common Issues and Solutions

Gitea won't start

sudo journalctl -u gitea -n 50 --no-pager

Check permissions on /etc/gitea/app.ini and /var/lib/gitea/.

502 Bad Gateway error in Nginx

Make sure Gitea is running on port 3000:

sudo ss -tlnp | grep 3000

Repositories won't clone via SSH

Verify that the Gitea SSH port (default 22 or 2222) is open in the firewall and that the SSH key is correctly added to the Gitea account.


Conclusion

Installing Gitea on a Linux VPS is a relatively straightforward process that gives you complete control over your source code without depending on third-party services. With the right setup — Nginx as a reverse proxy, active SSL, automated backups and 2FA — you get a robust and secure Git platform.

If you want to get started quickly, choose an SSD VPS or NVMe VPS from CLIQHOST, optimised for Linux applications. Need help with the setup? Our server management team is available to assist you. Also check out the CLIQHOST blog for more practical technical guides.

SHARE
// what clients say

What Our Clients Say

Real reviews from customers who trust CLIQHOST for performance, reliability and expert technical support.

★★★★★

"We moved our online shop from a foreign host and the difference is night and day — pages load instantly and support replies in minutes, in Romanian."

AM
Andrei M.
eCommerce owner · Chișinău
★★★★★

"Migrated 12 client sites to CLIQHOST. Free migration, zero downtime, and the cPanel setup is exactly what my team needed. Highly recommend."

EV
Elena V.
Web agency · Bălți
★★★★★

"Our NVMe VPS handles traffic spikes without a sweat. Full root, local datacenter, and billing in MDL — everything we wanted from a provider."

DC
Dmitri C.
SaaS founder · Chișinău