grav/pages/02.deluge/docs.md

3.6 KiB

title
Deluge

Deluge (Table of Contents)

Install Deluge Daemon and Web UI

$ sudo add-apt-repository ppa:deluge-team/ppa
$ sudo apt update
$ sudo apt install deluge deluged deluge-web deluge-webui

Verify Deluge Installion

Ensure Deluge daemon deluged and Web UI deluge-web are installed. Use which deluged or which deluge-web to check installation path. If they are not installed in the usual /usr/bin modify the service file ExecStart lines to point to the correct location (e.g. /usr/local/bin/deluged).

User Management

For security it is best to run a service with a specific user and group. You can create one using the following command:

Add to the deluge group any users you wish to be able to easily manage or access files downloaded through Deluge, for example:

sudo adduser --system --gecos "Deluge Service" --disabled-password --group --home /var/lib/deluge deluge
sudo adduser tanshu deluge

Autostart deluged with systemd

Create the file /etc/systemd/system/deluged.service containing the following:

sudo nano /etc/systemd/system/deluged.service
[Unit]
Description=Deluge Bittorrent Client Daemon
After=network-online.target

[Service]
Type=simple
User=deluge 
Group=deluge

UMask=007
ExecStart=/usr/bin/deluged -d -l /var/log/deluge/daemon.log -L warning
Restart=on-failure

# Configures the time to wait before service is stopped forcefully.
TimeoutStopSec=300

[Install]
WantedBy=multi-user.target

Enable the service with:

systemctl enable /etc/systemd/system/deluged.service 
systemctl start deluged
systemctl status deluged

Autostart Web UI with systemd

Create the file /etc/systemd/system/deluge-web.service containing the following:

sudo nano /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 -l /var/log/deluge/web.log -L warning
Restart=on-failure

[Install]
WantedBy=multi-user.target

Enable the service with:

systemctl enable /etc/systemd/system/deluge-web.service
systemctl start deluge-web 
systemctl status deluge-web

Logging

Create a log directory for Deluge and give the service user (e.g. deluge), full access:

$ sudo mkdir -p /var/log/deluge
$ sudo chown -R deluge:deluge/var/log/deluge
$ sudo chmod -R 750 /var/log/deluge
  • The deluge log directory is now configured so that user deluge has full access, group deluge read only and everyone else denied access. The umask specified in the services sets the permission of new log files.
  • See Deluge Logging for all available log-levels.

Log Rotation

To enable log rotation create /etc/logrotate.d/deluge with the following code:

/var/log/deluge/*.log {
        rotate 4
        weekly
        missingok
        notifempty
        compress
        delaycompress
        sharedscripts
        postrotate
                systemctl restart deluged >/dev/null 2>&1 || true
                systemctl restart deluge-web >/dev/null 2>&1 || true
        endscript
}

Open Browser

http://localhost:8112