Ubuntu Gitea Install
An automated method that doesn't require much typing can be found [ here ]
There are quite a few ways to do this and this is one way.
Requirements
Gitea requires a database MariaDB as well as a webserver Nginx to be installed. Once this is done you can proceed.
Download the gitea executable you can check for the newest version here Gitea
cd ~ wget https://dl.gitea.io/gitea/1.21.3/gitea-1.21.3-linux-amd64 -O /usr/local/bin/gitea chmod +x /usr/local/bin/gitea
Create a database for gitea to use.
mysql connect mysql create database gitea; GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'127.0.0.1' IDENTIFIED BY 'GiteaSecretPassword'; FLUSH PRIVILEGES;
Next create the Nginx configuration. I've provided 2 examples please adjust as necessary:
Nginx configuration running on port 80 [ view ]
Nginx configuration running on port 443 [ view ]
Note: The configuration files above requires the following directory /etc/nginx/nginxsnippets to be present. You can download it from [ here ] or you can just clone the directory like this.
git clone https://git.x-files.dk/ubuntu-server-files/nginxsnippets.git /etc/nginx/nginxsnippets
Restart Nginx and Phpfpm
systemctl restart nginx && systemctl restart php8.1-fpm
Create Gitea user
adduser --system --group --disabled-password --shell /bin/bash --home /home/git --gecos 'Git Version Control' git
Create gitea folders
mkdir -p /var/lib/gitea/{custom,data,indexers,public,log} chown git:git /var/lib/gitea/{data,indexers,log} chmod 750 /var/lib/gitea/{data,indexers,log} mkdir /etc/gitea chown root:git /etc/gitea chmod 770 /etc/gitea
Create the Gitea systemd script you can copy it from [ here ] it should be named gitea.service and be placed here: /etc/systemd/system/
Start Gitea
systemctl daemon-reload systemctl enable gitea systemctl start gitea
Launch your browser and go to http(s)://giteasomething.xyz and modify the settings shown [ here ]
log back into the new git server and run the following commands as root
cp -Rp /etc/gitea/app.ini /etc/gitea/app.ini.orig sed -i '/gitea-repositories/a MAX_FILES = 500' /etc/gitea/app.ini sed -i '/gitea-repositories/a FILE_MAX_SIZE = 200' /etc/gitea/app.ini sed -i '/\[log\]/a LEVEL = warn' /etc/gitea/app.ini sed -i '/\[log\]/a MODE = file' /etc/gitea/app.ini
Add the following at the bottom of /etc/gitea/app.ini as shown [ here ]
All done the only thing left is to restart Gitea
systemctl restart gitea.