Support #732
Updated by Daniel Curtis over 9 years ago
{{>toc}}
This is a guide on how to install the Deluge bittorrent client on a server and controlled by the web interface on FreeBSD -9- 10. 9.
h2. Prepare the Environment
* Make sure the system is up to date:
<pre>
pkg update && pkg upgrade
</pre>
h2. Install Deluge
* Install deluge:
<pre>
pkg install deluge py27-flexget
</pre>
* Create the deluge user:
<pre>
pw useradd -n deluge -m -c "Deluge" -s /sbin/nologin -w no
</pre>
* Create the directory to store the deluge config files:
<pre>
mkdir -p /home/deluge/.config/deluge
chown -R deluge:deluge /home/deluge/
</pre>
* Start and enable the deluge daemon at boot:
<pre>
echo 'deluged_enable="YES"' >> /etc/rc.conf
echo 'deluged_user="deluge"' >> /etc/rc.conf
service deluged start
</pre>
* Start and enable the deluge web interface at boot:
<pre>
echo 'deluge_web_enable="YES"' >> /etc/rc.conf
echo 'deluge_web_user="deluge"' >> /etc/rc.conf
service deluge_web start
</pre>
* *NOTE*: Enable remote connections to allow editing preferences from the web interface. Do this by editing the deluge core config:
<pre>
vi /home/deluge/.config/deluge/core.conf
</pre>
#* And change the @allow_remote@ parameter to *true*:
<pre>
"allow_remote": true
</pre>
* Open a web browser and go to http://deluge.example.com:8112
#* *NOTE*: The default password is *deluge*.
h2. Install Nginx
* Install Nginx
<pre>
pkg install nginx
</pre>
* Start and enable nginx at boot:
<pre>
echo 'nginx_enable="YES"' >> /etc/rc.conf
service nginx start
</pre>
* Create a configuration directory to make managing individual server blocks easier
<pre>
mkdir /usr/local/etc/nginx/conf.d
</pre>
* Edit the main nginx config file:
<pre>
vi /usr/local/etc/nginx/nginx.conf
</pre>
#* And strip down the config file and add the include statement at the end to make it easier to handle various server blocks:
<pre>
worker_processes 1;
error_log /var/log/nginx-error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
# Load config files from the /etc/nginx/conf.d directory
include /usr/local/etc/nginx/conf.d/*.conf;
}
</pre>
* Add a *deluge site server block*:
<pre>
vi /usr/local/etc/nginx/conf.d/deluge.example.com.conf
</pre>
#* Add the following:
<pre>
server {
listen 80 default_server;
server_name deluge.example.com;
access_log /var/log/deluge.example.com.log;
location / {
proxy_pass http://localhost:8112/;
}
}
</pre>
h2. Torrenting Protection
h3. Encryption
* From the web interface, go to +Preferences -> Encryption+
*# Make sure +Inbound+ is *Enabled*
*# Make sure +Outbound+ is *Enabled*
*# click the +Level+ menu and choose *Full Stream*
*# Make sure to enable *[X] Encrypt entire stream*
*# Click *Apply* and *OK*
h3. Blocklist
* From the web interface, go to +Preferences -> Plugins+ and enable the *Blocklist* plugin, then click *OK*.
* Add a blocklist URL, http://list.iblocklist.com/?list=ydxerpxkpcfqjaybcssw&fileformat=p2p&archiveformat=gz (this one is URL (I got mine from iblocklist)
* Check for new list every *1 day*
* Import blocklist on startup *is checked* and set the update frequency to 1 day.
* Click *Apply* and *OK*.
h3. The Onion Router
* Install TOR:
<pre>
pkg install tor
</pre>
* Tor users are strongly advised to prevent traffic analysis that exploits sequential IP IDs by setting:
<pre>
sysctl net.inet.ip.random_id=1
</pre>
* Edit the TOR config file:
<pre>
vi /usr/local/etc/tor/torrc
</pre>
#* And add/modify the following lines:
<pre>
RunAsDaemon1
</pre>
* Start and enable TOR at boot:
<pre>
echo 'tor_enable="YES"' >> /etc/rc.conf
service tor start
</pre>
* From the web interface, go to +Preferences -> Proxy+:
* Configure +Web Seed+ type to *Socksv5*:
*# Set +host+ to *localhost*
*# Set +port+ to *9050*
* Configure +Tracker+ type to *Socksv5*:
*# Set +host+ to *localhost*
*# Set +port+ to *9050*
* Configure +DHT+ type to *Socksv5*:
*# Set +host+ to *localhost*
*# Set +port+ to *9050*
h2. Resources
* http://jadawin-freebsd.thajsko.in.th/2013/01/deluge-on-freebsd-server.html
* https://forums.freenas.org/index.php?threads/install-deluge-in-a-jail.28778/
* https://www.iblocklist.com/lists