From 81ea53a15245ce2214dc4dc228b24c8a61191d98 Mon Sep 17 00:00:00 2001 From: Nyako Date: Wed, 10 Jun 2026 11:29:12 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20seedbox-install.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seedbox-install.sh | 172 ++++++++++++++++++++++++++++----------------- 1 file changed, 106 insertions(+), 66 deletions(-) diff --git a/seedbox-install.sh b/seedbox-install.sh index 6828106..9261947 100644 --- a/seedbox-install.sh +++ b/seedbox-install.sh @@ -1,90 +1,130 @@ -echo "deb [trusted=yes] https://flood-apt-repo.pages.dev/ devel main" | sudo tee /etc/apt/sources.list.d/flood.list +#!/bin/bash +set -e + +echo "Иницилизация..." +FB_DB="/var/lib/filebrowser/filebrowser.db" + +echo "Установка зависимостей..." +apt-get update +apt-get install -y rtorrent tmux curl build-essential ufw sudo + +echo "Создание пользователя torrent..." +id "torrent" &>/dev/null || adduser --disabled-password --gecos "" torrent + +echo "Настройка rTorrent..." +sudo -u torrent mkdir -p /home/torrent/rtorrent/{downloads,session,watch} + +cat << 'EOF' > /home/torrent/.rtorrent.rc +directory.default.set = /home/torrent/rtorrent/downloads +session.path.set = /home/torrent/rtorrent/session +network.port_range.set = 50000-50000 +network.port_random.set = no +network.scgi.open_local = /home/torrent/rtorrent/rpc.socket +execute.nothrow = chmod,770,/home/torrent/rtorrent/rpc.socket +protocol.encryption.set = allow_incoming,try_outgoing,enable_retry +dht.mode.set = auto +dht.port.set = 6881 +protocol.pex.set = yes +trackers.use_udp.set = yes +EOF +chown torrent:torrent /home/torrent/.rtorrent.rc + +echo "Установка Node.js и Flood..." +curl -fsSL https://deb.nodesource.com/setup_20.x | bash - +apt-get install -y nodejs +npm install -g flood + +FLOOD_BIN=$(which flood) + +echo "Установка File Browser..." curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash -sudo apt update -sudo apt install -y flood -sudo apt install -y rtorrent +mkdir -p /var/lib/filebrowser +filebrowser config init \ + --database "$FB_DB" +filebrowser users add admin admin \ + --perm.admin \ + --database "$FB_DB" 2>/dev/null || true +filebrowser users update admin \ + --password admin \ + --database "$FB_DB" -SERVICE_USER="download" -FLOOD_PORT="8098" -EXPLORER_PORT="8099" -SERVER_HOST="0.0.0.0" - -sudo useradd --create-home --shell /bin/false "$SERVICE_USER" -sudo mkdir -p /home/$SERVICE_USER/downloads -sudo mkdir -p /home/$SERVICE_USER/watch -sudo mkdir -p /home/$SERVICE_USER/.config/filebrowser -sudo chown -R $SERVICE_USER:$SERVICE_USER /home/$SERVICE_USER - - -sudo tee /etc/systemd/system/flood@.service > /dev/null < /etc/systemd/system/rtorrent.service [Unit] -Description=Flood service for %I +Description=rTorrent After=network.target [Service] -User=%I -Group=%I -Type=simple -KillMode=process -ExecStart=/usr/bin/env flood --host=${SERVER_HOST} --port=${FLOOD_PORT} +Type=forking +User=torrent +Group=torrent +ExecStart=/usr/bin/tmux new-session -s rtorrent -n rtorrent -d rtorrent +ExecStop=/usr/bin/tmux send-keys -t rtorrent C-q +WorkingDirectory=/home/torrent Restart=always -RestartSec=3 - -[Install] -WantedBy=multi-user.target -EOF -sudo tee /etc/systemd/system/rtorrent@.service > /dev/null < /dev/null < /etc/systemd/system/flood.service [Unit] -Description=FileBrowser service for %I -After=network.target +Description=Flood +After=rtorrent.service [Service] -User=%I -Group=%I Type=simple -KillMode=process -ExecStart=/usr/local/bin/filebrowser -r /home/%I -p ${EXPLORER_PORT} -a ${SERVER_HOST} -d /home/%I/.config/filebrowser/filebrowser.db +User=torrent +Group=torrent +ExecStart=${FLOOD_BIN} --port 8099 --host 0.0.0.0 +WorkingDirectory=/home/torrent Restart=always -RestartSec=3 +RestartSec=5 [Install] WantedBy=multi-user.target EOF -sudo -u $SERVICE_USER filebrowser \ - -r /home/$SERVICE_USER \ - -d /home/$SERVICE_USER/.config/filebrowser/filebrowser.db \ - users add admin admin \ - --perm.admin +cat << EOF > /etc/systemd/system/filebrowser.service +[Unit] +Description=File Browser +After=network.target -sudo systemctl daemon-reload -sudo systemctl enable rtorrent@$SERVICE_USER -sudo systemctl enable flood@$SERVICE_USER -sudo systemctl enable filebrowser@$SERVICE_USER -sudo systemctl restart rtorrent@$SERVICE_USER -sudo systemctl restart flood@$SERVICE_USER -sudo systemctl restart filebrowser@$SERVICE_USER +[Service] +Type=simple +User=root +Group=root +ExecStart=/usr/local/bin/filebrowser \ + -r /home/torrent \ + --address 0.0.0.0 \ + --port 8070 +Restart=always +RestartSec=5 -echo "Flood run in:" -echo "http://:${FLOOD_PORT}" -echo "Explorer run in:" -echo "http://:${EXPLORER_PORT}" -echo "Login: admin | Password: admin" \ No newline at end of file +[Install] +WantedBy=multi-user.target +EOF + +echo "Запуск сервисов..." +systemctl daemon-reload +systemctl enable --now rtorrent +systemctl enable --now flood +systemctl enable --now filebrowser + +echo "Настройка UFW..." +ufw allow 8099/tcp +ufw allow 8070/tcp +ufw allow 50000/tcp +ufw allow 6881/udp + +SERVER_IP=$(curl -s ifconfig.me || curl -s icanhazip.com || echo "IP_СЕРВЕРА") + +echo "" +echo "Установка завершена." +echo "URL Flood: http://${SERVER_IP}:8099" +echo "URL File Browser: http://${SERVER_IP}:8099" +echo "При настройке Flood выберите:" +echo "Client: rTorrent" +echo "Connection Type: Socket" +echo "Socket path: /home/torrent/rtorrent/rpc.socket"