# Gitea on Ubuntu 24.04 Server [![OS](https://img.shields.io/badge/ubuntu-24.04-E95420)](#) [![Shell](https://img.shields.io/badge/shell-bash-121011)](#) [![WebServer](https://img.shields.io/badge/server-nginx-009639)](#) [![MariaDB](https://img.shields.io/badge/db-mariadb-003545)](#) [![MySQL](https://img.shields.io/badge/db-mysql-4479A1)](#) [![Server](https://img.shields.io/badge/server-gitea-609926)](#) [![License](https://img.shields.io/badge/License-MIT-green)](./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 -p [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 ` | Gitea DB user password | | `-m ` | MariaDB admin/root password *(socket OFF)* | | `-a ` | DB admin username (default `root`) | | `-h` | Help | --- ## After Installation Visit: ``` http:// ``` 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/.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:// ``` 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](https://wiki.x-files.dk) --- ### License Licensed under the [MIT License](./LICENSE). ---