Für das „normale“ Git benötigt man eigentlich gar nichts. Über SSH und die Kommandozeilenwerkzeuge kann man so ziemlich alles machen. Hier geht es allerdings um eine schöne Web-Oberfläche.
Einige Anmerkungen:
Merker! Unvollständig!
apt-get install git mariadb-server adduser --system --shell /bin/bash --gecos 'Gitea Server' \ --group --disabled-password --home /srv/gitea \ gitea mysql CREATE DATABASE gitea; GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost' IDENTIFIED BY '********'; cd wget https://github.com/go-gitea/gitea/releases/download/v1.20.5/gitea-1.20.5-linux-amd64.xz apt-get install xz-utils xz --decompress gitea-1.20.5-linux-amd64.xz mv gitea-1.20.5-linux-amd64 /usr/local/bin/gitea chmod +x /usr/local/bin/gitea
Test und Vorkonfiguration
gitea --version mkdir -p /etc/gitea /var/lib/gitea/{custom,data,indexers,public,log} chown gitea:gitea /var/lib/gitea/{data,indexers,log} chmod 750 /var/lib/gitea/{data,indexers,log} chown root:gitea /etc/gitea chmod 770 /etc/gitea
Erster Start: Starten von Gitea, anschließend die Webseite über Port 3000 aufrufen.
su gitea GITEA_CUSTOM=/var/lib/gitea/custom /usr/local/bin/gitea --work-path=/var/lib/gitea web -c /etc/gitea/app.ini
+++ untenstehende Angabe in das Web-Formular eingeben +++
CTRL-C exit
Einstellungen zur Erstkonfiguration
/var/lib/gitea/data/repositories
/var/lib/gitea/data/lfs
/var/lib/gitea/log
Optionale Einstellungen
Konfigurationsdatei dem Benutzer zuweisen
chown gitea /etc/gitea/app.ini
Konfigurationsdatei
APP_NAME = Example Gitea RUN_USER = gitea RUN_MODE = prod [server] DOMAIN = gitea.example.com ROOT_URL = http://gitea.example.com/
Apache-Konfiguration für einen virtuellen Host erstellen. Dabei zuerst nur den Part für den Port 80 aktivieren. Dann ein Let's Encrypt-Zertifikat erstellen und anschließend den Port 443 einschalten.
<VirtualHost *:80> ServerName gitea.example.com ServerAdmin webmaster@example.com DocumentRoot /var/www/html Alias "/.well-known/acme-challenge" "/var/www/lets_encrypt/challenges" RedirectMatch Permanent ^(?!/\.well-known/).* https://gitea.example.com CustomLog ${APACHE_LOG_DIR}/gitea_access.log combined ErrorLog ${APACHE_LOG_DIR}/gitea_error.log LogLevel warn </VirtualHost> <VirtualHost *:443> ServerName gitea.example.com ServerAdmin webmaster@example.com DocumentRoot /var/www/html ProxyPreserveHost On ProxyRequests off AllowEncodedSlashes NoDecode ProxyPass / http://localhost:3000/ nocanon CustomLog ${APACHE_LOG_DIR}/gitea_access.log combined ErrorLog ${APACHE_LOG_DIR}/gitea_error.log SSLEngine on SSLProtocol all -SSLv2 -SSLv3 SSLHonorCipherOrder on SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS" SSLCertificateFile /etc/ssl/certs/gitea.crt SSLCertificateKeyFile /etc/ssl/private/gitea.key </VirtualHost>
Benötigte Module
a2enmod proxy proxy_http service apache2 restart
Site aktivieren
a2ensite gitea service apache2 reload
TODO
Achtung: Das folgende Script ist noch nicht vollständig entwickelt!
#! /bin/sh ### BEGIN INIT INFO # Provides: gitea # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Gitea server # Description: Start the Gitea server ### END INIT INFO NAME=gitea PIDFILE=/run/$NAME.pid DAEMON=/usr/local/bin/$NAME DAEMON_ARGS="web -q -c /etc/gitea/app.ini -w /var/lib/gitea -C /var/lib/gitea/custom" # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. . /lib/lsb/init-functions do_start() { start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ || return 1 start-stop-daemon --chuid gitea:gitea --start -m --pidfile $PIDFILE --background --exec $DAEMON -- $DAEMON_ARGS \ || return 2 } do_stop() { start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 rm -f $PIDFILE return "$RETVAL" } case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" do_start case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; stop) [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" do_stop case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" do_stop case "$?" in 0|1) do_start case "$?" in 0) log_end_msg 0 ;; 1) log_end_msg 1 ;; # Old process is still running *) log_end_msg 1 ;; # Failed to start esac ;; *) # Failed to stop log_end_msg 1 ;; esac ;; *) echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 exit 3 ;; esac exit 0
Insbesondere die Startseite kann leicht angepaßt werden.
Verzeichnis: /var/lib/gitea/custom/templates
{{template "base/head" .}} <div class="page-content home"> <div class="ui stackable middle very relaxed page grid"> <div class="sixteen wide center aligned centered column"> <div> <img class="logo" width="220" height="220" src="{{AssetUrlPrefix}}/img/logo.svg"/> </div> <div class="hero"> <h1 class="ui icon header title"> {{AppName}} </h1> <h2>Beispiel: Software-Repository</h2> </div> </div> </div> </div> {{template "base/footer" .}}
Prinzipiell erfolgt das Update wie folgt
wget https://dl.gitea.io/gitea/1.17.4/gitea-1.17.4-linux-amd64.xz xz --decompress gitea-1.17.4-linux-amd64.xz /etc/init.d/gitea stop mv gitea-1.17.4-linux-amd64 /usr/local/bin/gitea chmod +x /usr/local/bin/gitea /etc/init.d/gitea start
Alter Download über Github:
wget https://github.com/go-gitea/gitea/releases/download/v1.16.9/gitea-1.16.9-linux-amd64.xz