Update 'pages/02.deluge/default.md'

This commit is contained in:
Amritanshu Agrawal 2017-03-13 08:04:17 +00:00
parent c797a0a653
commit 2d974ff5da
1 changed files with 47 additions and 27 deletions

View File

@ -1,33 +1,43 @@
# Deluge # Deluge (Table of Contents)
### Install * [Install Deluge Daemon and Web UI](#install)
* [Verify Installion](#verify)
* [User Management](#user)
* [Autostart deluged with systemd](#auto)
* [Autostart Web UI with systemd](#webui)
* [Enable Logging](#logging)
* [Enable Log Rotation](#rotation)
* [Finally](#finally)
### Install Deluge Daemon and Web UI <a id="install"></a>
```sh ```sh
$ sudo add-apt-repository ppa:deluge-team/ppa $ sudo add-apt-repository ppa:deluge-team/ppa
$ sudo apt update $ sudo apt update
$ sudo apt install deluge deluged deluge-web deluge-webui $ sudo apt install deluge deluged deluge-web deluge-webui
``` ```
### Verify Deluge Installion ### Verify Deluge Installion <a id="verify"></a>
Ensure Deluge daemon `deluged` and Web UI `deluge-web` are installed. 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`).
Use `which deluged` or `which deluge-web` to check installation path. If
they are not installed in the usual `/usr/bin` modify the service ### User Management <a id="user"></a>
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. For security it is best to run a service with a specific user and group.
You can create one using the following command: You can create one using the following command:
Add to the `deluge` Add to the `deluge`
group any users you wish to be able to easily manage or access files group any users you wish to be able to easily manage or access files
downloaded through Deluge, for example: downloaded through Deluge, for example:
```sh ```sh
sudo adduser --system --gecos "Deluge Service" --disabled-password --group --home /var/lib/deluge deluge sudo adduser --system --gecos "Deluge Service" --disabled-password --group --home /var/lib/deluge deluge
sudo adduser tanshu deluge sudo adduser tanshu deluge
``` ```
### Autostart with systemd ### Autostart deluged with systemd <a id="auto"></a>
Create the file `/etc/systemd/system/deluged.service` containing the Create the file `/etc/systemd/system/deluged.service` containing the following:
following:
```sh ```sh
sudo nano /etc/systemd/system/deluged.service sudo nano /etc/systemd/system/deluged.service
``` ```
``` ```
[Unit] [Unit]
Description=Deluge Bittorrent Client Daemon Description=Deluge Bittorrent Client Daemon
@ -41,26 +51,29 @@ Group=deluge
UMask=007 UMask=007
ExecStart=/usr/bin/deluged -d -l /var/log/deluge/daemon.log -L warning ExecStart=/usr/bin/deluged -d -l /var/log/deluge/daemon.log -L warning
Restart=on-failure Restart=on-failure
# Configures the time to wait before service is stopped forcefully. # Configures the time to wait before service is stopped forcefully.
TimeoutStopSec=300 TimeoutStopSec=300
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
``` ```
Enable the
service with: Enable the service with:
```sh ```sh
systemctl enable /etc/systemd/system/deluged.service systemctl enable /etc/systemd/system/deluged.service
systemctl start deluged systemctl start deluged
systemctl status deluged systemctl status deluged
``` ```
## Deluge Web UI (deluge-web) Service
### Autostart with systemd ### Autostart Web UI with systemd <a id="webui"></a>
Create the file `/etc/systemd/system/deluge-web.service` containing the Create the file `/etc/systemd/system/deluge-web.service` containing the following:
following:
```sh ```sh
sudo nano /etc/systemd/system/deluge-web.service sudo nano /etc/systemd/system/deluge-web.service
``` ```
``` ```
[Unit] [Unit]
Description=Deluge Bittorrent Client Web Interface Description=Deluge Bittorrent Client Web Interface
@ -78,26 +91,32 @@ Restart=on-failure
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
``` ```
Enable the service with: Enable the service with:
``` ```
systemctl enable /etc/systemd/system/deluge-web.service systemctl enable /etc/systemd/system/deluge-web.service
systemctl start deluge-web systemctl start deluge-web
systemctl status deluge-web systemctl status deluge-web
``` ```
## Logging
Create a log directory for Deluge and give the service user (e.g. ### Logging <a id="logging"></a>
`deluge`), full access:
Create a log directory for Deluge and give the service user (e.g. `deluge`), full access:
```sh ```sh
$ sudo mkdir -p /var/log/deluge $ sudo mkdir -p /var/log/deluge
$ sudo chown -R deluge:deluge/var/log/deluge $ sudo chown -R deluge:deluge/var/log/deluge
$ sudo chmod -R 750 /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 - 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.
umask specified in the services sets the permission of new log files. - See Deluge Logging for all available log-levels.
See Deluge Logging for all available log-levels.
### Log Rotation ### Log Rotation <a id="rotation"></a>
To enable log rotation create `/etc/logrotate.d/deluge` with the following code: To enable log rotation create `/etc/logrotate.d/deluge` with the following code:
``` ```
/var/log/deluge/*.log { /var/log/deluge/*.log {
rotate 4 rotate 4
@ -113,5 +132,6 @@ To enable log rotation create `/etc/logrotate.d/deluge` with the following code:
endscript endscript
} }
``` ```
### Open Browser
### Open Browser <a id="finally"></a>
`http://localhost:8112` `http://localhost:8112`