#!/bin/sh # # Check if user is root # if [ $(id -u) != "0" ]; then echo "Error: You must be root to run this script, please use the root user to install the software." exit 1 fi if [ ! -f /etc/debian_version ]; then echo "Unsupported Linux Distribution. Prepared for Debian" exit 1 fi ################################################################################ # # Hostname: git.dmz.lan # # IP: 192.168.50.17/24 # # URL: http://192.168.50.17:3000 # # OS: Debain 12 # # Container ID: 115 # # Node: PVE01 # ################################################################################ # # root pass: master_user@vm-net#01 # ################################################################################ # # systemctl [start | stop | reload | restart | status] gitea.service # # ################################################################################ # apt install -y git sqlite3 #Get the correct download link for the latest version #wget https://dl.gitea.com/gitea/1.20.4/gitea-1.20.4-linux-amd64 wget https://dl.gitea.com/gitea/1.21.0/gitea-1.21.0-linux-amd64 #Move the binary to bin mv gitea* /usr/local/bin/gitea #Make executable chmod +x /usr/local/bin/gitea #Ensure it works # /usr/local/bin/gitea --version #Create the user/group for gitea to operate as adduser --system --group --disabled-password --home /etc/gitea gitea #Config directory was created by adduser #Create directory structure (mountpoint should be /var/lib/gitea) mkdir -p /var/lib/gitea/custom mkdir -p /var/lib/gitea/data mkdir -p /var/lib/gitea/indexers mkdir -p /var/lib/gitea/log mkdir -p /var/lib/gitea/public chown -R gitea:gitea /var/lib/gitea/ chmod -R 750 /var/lib/gitea/ cat > /etc/systemd/system/gitea.service <<"EOF" [Unit] Description=Gitea (Git with a cup of tea) After=syslog.target After=network.target [Service] # Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that # LimitNOFILE=524288:524288 RestartSec=2s Type=notify User=gitea Group=gitea #The mount point we added to the container WorkingDirectory=/var/lib/gitea #Create directory in /run RuntimeDirectory=gitea ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini Restart=always Environment=USER=gitea HOME=/var/lib/gitea/data GITEA_WORK_DIR=/var/lib/gitea WatchdogSec=30s #Capabilities to bind to low-numbered ports CapabilityBoundingSet=CAP_NET_BIND_SERVICE AmbientCapabilities=CAP_NET_BIND_SERVICE [Install] WantedBy=multi-user.target EOF systemctl daemon-reload && systemctl enable --now gitea && systemctl start gitea apt autoremove && apt autoclean && apt clean