Files
gitea-ubuntu/README.md

4.0 KiB
Raw Blame History

Gitea on Ubuntu 24.04 Server

OS Shell WebServer MariaDB MySQL Server License

Install Gitea on Ubuntu 24.04 server.

Not a demo, not a quick setup script.
This installer is built for production, hardened defaults included.

Why this installer exists

Gitea installation is often more tedious than it should be. This installer reduces friction and avoids 3am debugging.

What this installer does

✔ Fetches latest Gitea release automatically
✔ MariaDB/MySQL socket or password mode
✔ Creates + enables systemd service
✔ Generates validated Nginx host config
✔ Applies secure post-install rules

What this installer does NOT do

It wont stop you from running the script without reading the documentation like theres no tomorrow.
Skip the README, and whatever happens next is your headache, not a bug report.


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.