Обновить seedbox-install.sh

This commit is contained in:
2026-06-10 11:29:12 +03:00
parent 7bef086382
commit 81ea53a152
+106 -66
View File
@@ -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 curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
sudo apt update mkdir -p /var/lib/filebrowser
sudo apt install -y flood filebrowser config init \
sudo apt install -y rtorrent --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" echo "Настройка systemd..."
FLOOD_PORT="8098" cat << 'EOF' > /etc/systemd/system/rtorrent.service
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 <<EOF
[Unit] [Unit]
Description=Flood service for %I Description=rTorrent
After=network.target After=network.target
[Service] [Service]
User=%I Type=forking
Group=%I User=torrent
Type=simple Group=torrent
KillMode=process ExecStart=/usr/bin/tmux new-session -s rtorrent -n rtorrent -d rtorrent
ExecStart=/usr/bin/env flood --host=${SERVER_HOST} --port=${FLOOD_PORT} ExecStop=/usr/bin/tmux send-keys -t rtorrent C-q
WorkingDirectory=/home/torrent
Restart=always Restart=always
RestartSec=3 RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
sudo tee /etc/systemd/system/rtorrent@.service > /dev/null <<EOF
[Unit]
Description=rTorrent service for %I
After=network.target
[Service]
User=%I
Group=%I
Type=simple
KillMode=process
ExecStart=/usr/bin/env rtorrent
Restart=always
RestartSec=3
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
sudo tee /etc/systemd/system/filebrowser@.service > /dev/null <<EOF cat << EOF > /etc/systemd/system/flood.service
[Unit] [Unit]
Description=FileBrowser service for %I Description=Flood
After=network.target After=rtorrent.service
[Service] [Service]
User=%I
Group=%I
Type=simple Type=simple
KillMode=process User=torrent
ExecStart=/usr/local/bin/filebrowser -r /home/%I -p ${EXPLORER_PORT} -a ${SERVER_HOST} -d /home/%I/.config/filebrowser/filebrowser.db Group=torrent
ExecStart=${FLOOD_BIN} --port 8099 --host 0.0.0.0
WorkingDirectory=/home/torrent
Restart=always Restart=always
RestartSec=3 RestartSec=5
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
sudo -u $SERVICE_USER filebrowser \ cat << EOF > /etc/systemd/system/filebrowser.service
-r /home/$SERVICE_USER \ [Unit]
-d /home/$SERVICE_USER/.config/filebrowser/filebrowser.db \ Description=File Browser
users add admin admin \ After=network.target
--perm.admin
sudo systemctl daemon-reload [Service]
sudo systemctl enable rtorrent@$SERVICE_USER Type=simple
sudo systemctl enable flood@$SERVICE_USER User=root
sudo systemctl enable filebrowser@$SERVICE_USER Group=root
sudo systemctl restart rtorrent@$SERVICE_USER ExecStart=/usr/local/bin/filebrowser \
sudo systemctl restart flood@$SERVICE_USER -r /home/torrent \
sudo systemctl restart filebrowser@$SERVICE_USER --address 0.0.0.0 \
--port 8070
Restart=always
RestartSec=5
echo "Flood run in:" [Install]
echo "http://<SERVER_IP>:${FLOOD_PORT}" WantedBy=multi-user.target
echo "Explorer run in:" EOF
echo "http://<SERVER_IP>:${EXPLORER_PORT}"
echo "Login: admin | Password: admin" 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"