Skip to main content

rTorrent Server Setup on FreeNAS

Last Updated: September 12, 2019

Jail Setup

Enable SSH:

sysrc sshd_enable="YES"

service sshd start

Change Root Password or use SSH Keys

Install prerequisites

pkg install htop vim nginx rtorrent git-lite

pkg install php73 php73-mbstring php73-json php73-xmlrpc

Mount file systems

iocage fstab -a rtorrent /mnt/FileStore/<folderName> /mnt/data nullfs rw 0 0

Add rtorrent user

Add user in FreeNAS GUI

add-user

Add user in Jail. Make sure the UID matches

pw useradd -n rtorrent -u 974 -d /home/rtorrent -s /bin/tcsh

pw groupadd -n GROUPNAME -g GID

Match GID in FreeNAS

pw groupmod GROUPNAME -m rtorrent

Add to the group that has write access to the filesystem listed above.

rTorrent config

At the time of writing the port was at version 0.9.8.

https://github.com/rakshasa/rtorrent/wiki/CONFIG-Template

Make it bind to port 5000.

vim .rtorrent.rc

directory.default.set = "/mnt/files"
network.scgi.open_port = "127.0.0.1:5000"

PHP Config

Configure unix socket and run as www user.

listen = /var/run/php7.3-fpm.sock
listen.owner = www
listen.group = www
listen.mode = 0660

sysrc php_fpm_enable="YES"

service php-fpm restart

Nginx config

sysrc nginx_enable="YES"

location /RPC2 {
scgi_pass 127.0.0.1:5000;
include scgi_params;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php7.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
root /usr/local/www/ruTorrent;
index index.html index.htm;
}

service nginx restart

ruTorrent

Clone git repository and set permissions. At the time of writing the ruTorrent version that worked with rTorrent 0.9.8 was v3.10-beta.

cd /usr/local/www
git clone https://github.com/Novik/ruTorrent.git
cd ruTorrent
git checkout v3.10-beta
chown www:www share/

Navigate to http://\<hostname>/