Skip to content

Instantly share code, notes, and snippets.

@adamz01h
Last active February 14, 2024 10:30
Show Gist options
  • Select an option

  • Save adamz01h/0ff149e4bcc142a13caf6f7c91e84979 to your computer and use it in GitHub Desktop.

Select an option

Save adamz01h/0ff149e4bcc142a13caf6f7c91e84979 to your computer and use it in GitHub Desktop.
kenmoini_deluge_install.sh
## Switch to root
sudo -i
## Disable IPv6
echo "net.ipv6.conf.all.disable_ipv6=1" > /etc/sysctl.d/99-disable-ipv6.conf
echo "net.ipv6.conf.default.disable_ipv6=1" >> /etc/sysctl.d/99-disable-ipv6.conf
echo "net.ipv6.conf.lo.disable_ipv6=1" >> /etc/sysctl.d/99-disable-ipv6.conf
sysctl -p /etc/sysctl.d/99-disable-ipv6.conf
sed -i 's/IPV6=yes/IPV6=no/g' /etc/default/ufw
ufw disable
## Create a group and user for Deluge - UID/GID matched to typical Plex user values
groupadd --system -g 997 deluge
adduser --system -u 997 --gecos "Deluge Service" --disabled-password --group --home /var/lib/deluge deluge
## Add repos
add-apt-repository ppa:deluge-team/stable
## Update system software
apt update
apt upgrade -y
## Install needed packages
apt install -y nfs-common openvpn deluged deluge-web deluge-console
## Mount NFS Stores
NFS_HOST="deep-thought.kemo.labs"
NFS_SHARE="/Media"
MOUNT_PATH="/mnt/Media"
mkdir -p $MOUNT_PATH
cp /etc/fstab /etc/fstab.bak-$(date +%s)
echo "${NFS_HOST}:${NFS_SHARE} ${MOUNT_PATH} nfs rw,relatime 0 0" >> /etc/fstab
mount -a
## Create logging directories
mkdir -p /var/log/deluge
chown -R deluge:deluge /var/log/deluge
chmod -R 750 /var/log/deluge
## Disable original init.d based deluged service
systemctl stop deluged
systemctl disable deluged
## Create a deluged Service
cat << EOF > /etc/systemd/system/deluged.service
[Unit]
Description=Deluge Bittorrent Client Daemon
Documentation=man:deluged
After=network-online.target
[Service]
Type=simple
UMask=007
User=deluge
Group=deluge
ExecStart=/usr/bin/deluged -d -l /var/log/deluge/daemon.log -L warning --logrotate
Restart=on-failure
TimeoutStopSec=300
[Install]
WantedBy=multi-user.target
EOF
## Create a Deluge Web UI Service
cat << EOF > /etc/systemd/system/deluge-web.service
[Unit]
Description=Deluge Bittorrent Client Web Interface
After=network-online.target
[Service]
Type=simple
User=deluge
Group=deluge
UMask=027
ExecStart=/usr/bin/deluge-web -d -l /var/log/deluge/web.log -L warning --logrotate
Restart=on-failure
TimeoutStopSec=300
[Install]
WantedBy=multi-user.target
EOF
## Reload SystemD
systemctl daemon-reload
## Enable the Deluge Daemon
systemctl enable --now deluged
## Enable the Deluge Web UI
systemctl enable --now deluge-web
## Reboot
systemctl reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment