====== Установка Gitea ======
  - Обнавляем репозитории и систему <code bash>apt update && apt upgrade -y</code>
  - Устанавливаем необходимое ПО <code bash>apt install nginx git curl wget mariadb-server -y</code>
  - Запускаем скрипт безопастности MySQL <code bash>mysql_secure_installation</code> <code bash>Enter current password for root (enter for none): Just press the Enter
Set root password? [Y/n]: Y
New password: Enter password
Re-enter new password: Repeat password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]:  Y
Reload privilege tables now? [Y/n]:  Y</code>
  - Входим в СУБД <code bash>mysql</code>
  - Создаем БД <code bash>CREATE DATABASE gitea;</code>
  - Создаем пользователя <code bash>GRANT ALL ON gitea.* TO 'giteauser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;</code>
  - Добавляем пользователя git <code bash>adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /opt/git git</code>
  - Скачиваем скрипт установки Gitea <code bash>curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest |grep browser_download_url | cut -d '"' -f 4 | grep '\linux-amd64$' | wget -i -</code>
  - Перемещаем <code bash>mv gitea-*-linux-amd64 /usr/local/bin/gitea</code>
  - Даем права на запуск <code bash>chmod +x /usr/local/bin/gitea</code>
  - Проверяем версию <code bash>gitea --version</code>
  - Создаем каталоги <code bash>mkdir -p /etc/gitea /var/lib/gitea/{custom,data,indexers,public,log}</code>
  - Меняем владельца каталогов <code bash>chown git:git /var/lib/gitea/{data,indexers,log}</code>
  - Меняем права доступа <code bash>chmod 750 /var/lib/gitea/{data,indexers,log}</code>
  - Меняем владельца каталога <code bash>chown root:git /etc/gitea</code>
  - Меняем права доступа <code bash>chmod 770 /etc/gitea</code>
  - Создаем демона для управления Gitea <code bash>nano /etc/systemd/system/gitea.service</code> <code bash>[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
After=mariadb.service

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
# If you want to bind Gitea to a port below 1024 uncomment
# the two values below
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target</code>
  - Перезапускаем системного демона <code bash>systemctl daemon-reload</code>
  - Запускаем Gitea <code bash>systemctl start gitea</code> и проверяем его <code bash>systemctl status gitea</code>
  - Настраиваем Nginx <code bash>nano /etc/nginx/conf.d/gitea.conf</code> <code bash>server {
    listen 80;
    server_name 172.17.16.16;
    access_log /var/log/nginx/gitea_access.log;
    error_log /var/log/nginx/gitea_error.log;


    location / {
        proxy_pass http://localhost:3000;
    }
}
</code>
  - Перезапускаем Nginx <code bash>service nginx reload</code>
  - Меняем владельца <code bash>chown git:git /etc/gitea/app.ini</code>
  - Редактируем <code bash>nano /etc/gitea/app.ini</code> раздел [database]
  - Открываем браузер и переходим по адресу <code bash>http://YOUR_SERVER_IP/install</code>