2025-11-29 13:51:12 +01:00
2025-11-23 12:25:55 +00:00
2025-11-23 12:33:59 +00:00
2025-10-23 15:44:28 +02:00
2025-11-29 13:51:12 +01: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)

Optional Installers (if you need them — saves you some googling)

Multi-instance hosting:
Install multiple Gitea instances on Ubuntu


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/ robots.txt
/var/lib/gitea/custom/public/ sitemap.xml
/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

Important (but optional): robots.txt and sitemap.xml are supported automatically by the Nginx configuration being created, however the installer does not generate these files. Create them manually in the directory listed above.


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 116 KiB
Languages
Shell 100%