Setting up a Gitea server

From bibbleWiki
Revision as of 03:32, 10 April 2025 by Iwiseman (talk | contribs) (Created page with "=Set up a MYSQL Database= Make sure you are listening on 0.0.0.0 and not localhost. <syntaxhighlight "bash"> CREATE DATABASE gitea_db; CREATE USER 'gitea_admin'@'you network IP' IDENTIFIED BY 'not saying'; GRANT ALL PRIVILEGES ON gitea_db.* TO 'gitea_admin'@'you network IP' WITH GRANT OPTION; </syntaxhighlight> =Gitea Setup= <syntaxhighlight "bash"> # Get Software wget -O gitea https://dl.gitea.com/gitea/1.23.7/gitea-1.23.7-linux-amd64 # Add Git User sudo adduser --sy...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Set up a MYSQL Database

Make sure you are listening on 0.0.0.0 and not localhost.

CREATE DATABASE gitea_db;
CREATE USER 'gitea_admin'@'you network IP' IDENTIFIED BY 'not saying';
GRANT ALL PRIVILEGES ON gitea_db.* TO 'gitea_admin'@'you network IP' WITH GRANT OPTION;

Gitea Setup

# Get Software
 wget -O gitea https://dl.gitea.com/gitea/1.23.7/gitea-1.23.7-linux-amd64

# Add Git User
sudo adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git

# Link to RAID
sudo ln -s  /var/lib/gitea /mnt/RAID/gitea

#Make Directory structure
sudo mkdir -p /var/lib/gitea/{custom,data,log}
sudo chown -R git:git /var/lib/gitea/
sudo chmod -R 750 /var/lib/gitea/

sudo mkdir /etc/gitea
sudo chown  root:git /etc/gitea
sudo chmod  770 /etc/gitea

Nginx Setup

Need to add a reverse proxy

server{
   server_name git.example.local;

   listen       443 ssl;

   access_log /var/log/nginx/git.example.local.log;
   error_log  /var/log/nginx/git.example.local.log error;

   disable_symlinks off;

   ssl_certificate     /etc/ssl/certs/server.crt;
   ssl_certificate_key /etc/ssl/private/server.key;

   client_max_body_size 20m;

   location ~ / {
        client_max_body_size 512M;
        proxy_pass http://localhost:1701;
        proxy_set_header Connection $http_connection;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

 }