2025-11-23 12:25:55 +00:00
2025-11-23 12:33:59 +00:00
2025-10-23 15:44:28 +02:00

Gitea on Ubuntu 24.04 Server

OS Shell WebServer MariaDB MySQL Server License

Production-ready automated installation of Gitea on Ubuntu 24.04.
Database, Nginx host config, systemd service & post-install hardening included.

This is not a demo environment.
This script deploys a real Gitea server — safely, repeatedly, and without hand-editing configs.


Requirements

✔ Nginx installed
✔ MariaDB/MySQL running (socket or password supported)

Related installers:
https://git.x-files.dk/webserver/nginx-ubuntu
https://git.x-files.dk/database/mariadb-ubuntu

Multi-instance hosting:
https://git.x-files.dk/webapps/gitea-ubuntu-multi


1. Clone

git clone https://git.x-files.dk/webapps/gitea-ubuntu.git
cd gitea-ubuntu

2. Install

sudo ./giteainstall -n <domain> -p <gitea db password> [options]

Examples:

sudo ./giteainstall -n git.example.com -p giteadbpass
sudo ./giteainstall -n git.example.com -p giteadbpass -m rootpwd
sudo ./giteainstall -n git.example.com -p giteadbpass -a admin -m adminpwd

Options:

Flag Meaning
-p <password> Gitea DB user password
-m <password> MariaDB admin/root password (socket OFF)
-a <username> DB admin username (default root)
-h Help

After Installation

Visit:

http://<domain>

Then finalize setup and run:

sudo /tmp/gitea-postinstall

This applies safe defaults, log tuning, upload limit changes, disables SSH by default.

Re-enable SSH in:

/etc/gitea/app.ini

File Locations

Path Purpose
/var/lib/gitea/custom/public/assets/img/ Custom images
/var/lib/gitea/custom/templates/home.tmpl Home override
/etc/gitea/app.ini Main config file
/etc/nginx/conf.d/<domain>.conf Vhost generated

HTTPS

Enable TLS:

https://git.x-files.dk/webserver/nginx-snippets/src/branch/main/hostfiles/gitea.443.conf

Then set:

ROOT_URL = https://<domain>

Restart:

systemctl restart gitea nginx

Version Detection

Pulls latest from:

https://dl.gitea.com/gitea/version.json

Fallback uses file:

fallback
1.25.2

Troubleshooting

Issue Cause Fix
Nginx restart fails Config error nginx -t
DB denied No socket auth Add -m
UI blank Gitea service down systemctl status gitea

Safe to re-run — DB creation checks exist first.


More Information

More guides and documentation can be found on wiki.x-files.dk


License

Licensed under the MIT License.


Description
No description provided
Readme MIT 100 KiB
Languages
Shell 100%