Support #732
Install a Headless Deluge Bittorrent Server on FreeBSD
Description
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 11.
Prepare the Environment¶
- Make sure the system is up to date:
pkg update && pkg upgrade
Install Deluge¶
- Install deluge:
pkg install deluge-cli
- Create the deluge user:
pw useradd -n deluge -m -c "Deluge" -s /sbin/nologin -w no
- Create the directory to store the deluge config files:
mkdir -p /home/deluge/.config/deluge chown -R deluge:deluge /home/deluge/
- Start and enable the deluge daemon at boot:
echo 'deluged_enable="YES"' >> /etc/rc.conf echo 'deluged_user="deluge"' >> /etc/rc.conf service deluged start
- Start and enable the deluge web interface at boot:
echo 'deluge_web_enable="YES"' >> /etc/rc.conf echo 'deluge_web_user="deluge"' >> /etc/rc.conf service deluge_web start
- Open a web browser and go to http://deluge.example.com:8112
- NOTE: The default password is deluge.
Install Nginx¶
- Install Nginx
pkg install nginx
- Start and enable nginx at boot:
echo 'nginx_enable="YES"' >> /etc/rc.conf service nginx start
- Create a configuration directory to make managing individual server blocks easier
mkdir /usr/local/etc/nginx/conf.d
- Edit the main nginx config file:
vi /usr/local/etc/nginx/nginx.conf
- And strip down the config file and add the include statement at the end to make it easier to handle various server blocks:
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; }
- And strip down the config file and add the include statement at the end to make it easier to handle various server blocks:
- Add a deluge site server block:
vi /usr/local/etc/nginx/conf.d/deluge.example.com.conf
- Add the following:
server { listen 80 default_server; server_name deluge.example.com; access_log /var/log/deluge.example.com.log; location / { proxy_pass http://localhost:8112/; } }
- Add the following:
Torrenting Protection¶
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
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 from iblocklist)
- Check for new list every 1 day
- Import blocklist on startup is checked
- Click Apply and OK.
The Onion Router¶
- Install TOR:
pkg install tor
- Tor users are strongly advised to prevent traffic analysis that exploits sequential IP IDs by setting:
sysctl net.inet.ip.random_id=1
- Edit the TOR config file:
vi /usr/local/etc/tor/torrc
- And add/modify the following lines:
RunAsDaemon 1
- And add/modify the following lines:
- Start and enable TOR at boot:
echo 'tor_enable="YES"' >> /etc/rc.conf service tor start
- 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