Thursday, November 13, 2014

Arch/Manjaro + rTorrent + RuTorrent + autodl-irssi + Nginx

NOTE: This guide might need some editing. It was a draft and i decided to just post it.

So i was setting up rTorrent and ruTorrent on Manjaro today and i actually had quite a few issues doing this.
I didn't want to use the normally used apache as i didn't want to have two webservers installed and only wanted one. I'll detail the steps below as to what problems i faced while doing this and hopefully this will help you.

So first let's start with rTorrent. You'll just be installing rTorrent via your package manage so just do

sudo pacman -S rtorrent

It should install rtorrent without a hitch. Follow the configuration guide here and the systemd section too if you want it installed on boot.

You should have nginx installed already so i won't be going through that but you need to install RuTorrent and RuTorrent-plugins via AUR which is actually the Arch User Repository.

Download both tarball's via wget and tar xvzf them.

tar -xvzf rutorrent.tar.gz
tar -xvzf rutorrent-plugins.tar.gz

Once that is done make sure to go and check your /etc/php/php.ini file for the open_basedir value and check the nginx logs when you set the server up. This gave me a lot of 502 errors and i was wondering what the problem was. Basically that setting in php was the problem. So if you're getting a 502 error in php then that's your problem.

Things that need fixing are:
Directory Permissions

For php-fpm.service:
cd /usr/lib/systemd/system
sudo nano php-fpm.service
Change PrivateTmp=true to PrivateTmp=false

For the config.php:
You have to add /usr/bin/curl to the curl line for the rss feeds to work properly

cp -r /usr/share/webapps/rutorrent /srv/http/www/
cd /srv/http/www/rutorrent/
rm -rf conf
cp -r /etc/webapps/rutorrent/conf /srv/http/www/rutorrent/
cd /srv/http/www/rutorrent/
mkdir tmp
chmod 777 share
chmod 777 tmp
chown http:http tmp
sudo nano /srv/http/www/rutorrent/conf/config.php
$tempDirectory = '/srv/http/www/rutorrent/tmp'
 mkdir -p ~/.irssi/scripts/autorun
 ln -s /usr/share/autodl-irssi/AutodlIrssi ~/.irssi/scripts
 ln -s /usr/share/autodl-irssi/ ~/.irssi/scripts/autorun
sudo nano /etc/php/php.ini
open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/usr/bin

nginx server block:
   server {
        listen 8088;
        root /srv/http/www/rutorrent;
        location / {
            index index.php index.html;
        location ~ \.php$ {
            # Filter our arbitary code execution
            #location ~ \..*/.*\.php$ {return 404;}
            fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
            include fastcgi.conf;
        location /RPC2 {
            include scgi_params;
            scgi_pass localhost:5000;

For autodl-irssi you have to edit a few things and install a few packages first. I didn't want to use the one in AUR because it hasn't been updated in awhile. First you need to install some dependencies and fix some stuff.

pacman -S irssi perl-archive-zip perl-digest-sha1 perl-html-parser perl-json perl-json-xs perl-net-ssleay perl-xml-libxml perl-xml-libxslt ed
sudo nano /etc/php/php.ini
Remove ; at the line
wget --no-check-certificate -O autodl-setup
sh autodl-setup

 mkdir -p ~/.irssi/scripts/autorun
 cp -r /usr/share/autodl-irssi/AutodlIrssi ~/.irssi/scripts
 cp -r /usr/share/autodl-irssi/ ~/.irssi/scripts/autorun

gui-server-port = 6738
gui-server-password = weehoo

$autodlPort = 6738;
$autodlPassword = "weehoo";

Description=irssi Service

ExecStart=/usr/bin/screen -dmS irssi irssi
ExecStop=/usr/bin/screen -S irssi -X quit


1 comment:

  1. Thank you so much for this. I've been strugging to get rtorrent + nginx + rutorrent working on my test VM before migrating the settings to a colocated server.