Need to migrate your e-mails to a new server? Free and paid versions of our online tool available.
Hero Image

Install Gitea on Gentoo Linux

Install Gitea on Gentoo Linux

Step 1 – Create git user and download binary

useradd -r -m -d /home/git -s /bin/bash git
VERSION=1.22.0
wget -O /usr/local/bin/gitea https://dl.gitea.com/gitea/${VERSION}/gitea-${VERSION}-linux-amd64
chmod +x /usr/local/bin/gitea

Step 2 – Directories

mkdir -p /var/lib/gitea/{custom,data,log} /etc/gitea
chown -R git:git /var/lib/gitea
chown root:git /etc/gitea && chmod 770 /etc/gitea

Step 3 – systemd service

[Unit]
Description=Gitea
After=network.target
[Service]
User=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
[Install]
WantedBy=multi-user.target
systemctl daemon-reload && systemctl enable --now gitea

Step 4 – Nginx reverse proxy

server {
    listen 80;
    server_name git.example.com;
    location / {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Step 5 – Setup wizard

Visit http://git.example.com and follow the Gitea installer.