#!/bin/bash # # https://docs.gitea.com/ # https://docs.gitea.com/usage/actions/act-runner # https://dl.gitea.com/gitea/ # https://dl.gitea.com/act_runner/ # https://docs.gitea.com/administration/reverse-proxies # https://www.rosehosting.com/blog/how-to-install-gitea-on-ubuntu-22-04/ # https://hostnextra.com/learn/tutorials/how-to-install-gitea-on-ubuntu # https://gist.github.com/MitchRatquest/dadc9484e07a627fa73b1c7bbcf609f4 # https://gist.github.com/typebrook/08ffabbe92457acc7117a7dca8619d40 VERSION=1.22.1 apt update && apt upgrade apt install mariadb-server cat < create_db.sql CREATE DATABASE gitea; GRANT ALL PRIVILEGES ON gitea.* to 'gitea'@'localhost' IDENTIFIED BY 'Strong-Password'; FLUSH PRIVILEGES; EOF mysql -u root -p < create_db.sql adduser --system --shell /bin/bash --group --disabled-password --home /home/git git wget https://dl.gitea.com/gitea/$VERSION/gitea-$VERSION-linux-amd64 -O /usr/local/bin/gitea chmod +x /usr/local/bin/gitea mkdir -p /etc/gitea /home/git/gitea/{custom,data,indexers,public,log} chown git:git /etc/gitea /home/git/gitea/{custom,data,indexers,public,log} chmod 750 /home/git/gitea/{data,indexers,log} chmod 770 /etc/gitea cat < /etc/systemd/system/gitea.service [Unit] Description=Gitea After=syslog.target After=network.target [Service] RestartSec=3s Type=simple User=git Group=git WorkingDirectory=/home/git/gitea/ ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini Restart=always Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/home/git/gitea [Install] WantedBy=multi-user.target EOF systemctl daemon-reload && systemctl enable gitea && systemctl start gitea