Sonarr

This article will show you how to install Sonarr. Sonarr is a smart PVR for newsgroup and BitTorrent users.

You'll need to execute some commands via SSH to use this software. There is a separate guide on how to connect to your slot via SSH. Commands are kept as simple as possible and in most cases will simply need to be copied and pasted into the terminal window (then executed by pressing the Enter key).

Table of contents

Installation

Install or update Sonarr by logging in via SSH, then copying and pasting the following:

wget -qO ~/sonarr.tar.gz 'https://services.sonarr.tv/v1/download/main/latest?version=3&os=linux'
rm -rf ~/Sonarr
tar xf ~/sonarr.tar.gz
rm ~/sonarr.tar.gz
mkdir -p ~/.config/Sonarr
mkdir ~/tmp
# Start v3 to create DB
pkill -f -9 Sonarr/Sonarr
TMPDIR=~/tmp nohup -- mono --debug Sonarr/Sonarr.exe -nobrowser 2>&1 >/dev/null &
sleep 10

# Install v4
pkill -f -9 Sonarr/Sonarr
rm -rf ~/Sonarr
wget -qO ~/sonarr.tar.gz 'https://services.sonarr.tv/v1/download/main/latest?version=4&os=linux&arch=x64'
tar xf ~/sonarr.tar.gz
rm ~/sonarr.tar.gz

Configuring before starting Sonarr

You then need to tweak the config slightly for the first time use. You can skip this step if you are updating an existing install. You can do this by copying and pasting the following into SSH:

sed -i 's|<Port>8989</Port>|<Port>'$(shuf -i 10001-32001 -n 1)'</Port>|g' ~/.config/Sonarr/config.xml
sed -i 's|<UrlBase></UrlBase>|<UrlBase>/'"$(whoami)"'/sonarr</UrlBase>|g' ~/.config/Sonarr/config.xml
echo "http://$(hostname -f):$(sed -rn 's|(.*)<Port>(.*)</Port>|\2|p' ~/.config/Sonarr/config.xml)/$(whoami)/sonarr/"

After Sonarr has been started you must set a password.

Starting, stopping and restarting

This section covers the Sonarr process - starting it, stopping it and restarting it. It also covers checking if the process is running, in case that becomes necessary.

You can start Sonarr and print its URL with the following:

screen -dmS sonarr /bin/bash -c 'export TMPDIR=~/tmp; Sonarr/Sonarr -nobrowser' && echo "http://$(hostname -f):$(sed -rn 's|(.*)<Port>(.*)</Port>|\2|p' ~/.config/Sonarr/config.xml)/$(whoami)/sonarr/"

If you need to check that it's running, you can run the command below. If the process is running a list of relevant process ID numbers will be listed. If nothing is listed, the process is not running.

pgrep -f Sonarr

The Sonarr process can by stopped by executing:

pkill -f Sonarr

If Sonarr is unresponsive then it can be "forced" to stop by executing:

pkill -f -9 Sonarr

If Sonarr needs to be restarted, copy and paste these commands:

pkill -f Sonarr
screen -dmS sonarr /bin/bash -c 'export TMPDIR=~/tmp; Sonarr/Sonarr -nobrowser'
echo "http://$(hostname -f):$(sed -rn 's|(.*)<Port>(.*)</Port>|\2|p' ~/.config/Sonarr/config.xml)/$(whoami)/sonarr/"

Automatically restarting Sonarr if it is not running

Cron jobs can be used to check if Sonarr is running and start it up if it is not. There is a separate page on configuring cron jobs.

Configuring

This section covers setting a password in Sonarr and connecting the Sonarr to different clients.

Setting a password in Sonarr

Within the Sonarr UI, click the Settings icon (the three gears at the top) and then click the General tab. Under Security, click the dropdown menu next to Authentication and select Forms (Login page). Two fields will appear and you'll be able to set a username and password for the web UI. Whilst it's not mandatory you do this, it is a sensible thing to do. You'll need to restart the program for the changes to take effect.

Configuring clients with Sonarr

In Sonarr's user interface click the Settings icon (the three gears at the top) and then click Download Client. Next, click the + button. You can choose the torrent client you want to configure from the menu.

rTorrent

First of all you need to create the rTorrent RPC and this is done by switching from apache to nginx.

Name
Your chosen name for the settings - you can pick what you like
Enable
Yes
Host
server.feralhosting.com
Port
443
Url Path
/username/rtorrent/rpc
Use SSL
Yes
Username
rutorrent (the word 'rutorrent', not your ruTorrent username)
Password
Your ruTorrent access password

In the above settings, server is replaced by the name of your server (e.g. zeus) and username is your username on the server.

Deluge

First make sure Advanced Settings have been set to Shown, in order for the necessary options to appear.

Name
Your chosen name for the settings - you can pick what you like
Enable
Yes
Host
server.feralhosting.com
Port
443
Url Base
/username/deluge
Password
Your Deluge web UI password
Use SSL
Yes

In the above settings, server is replaced by the name of your server (e.g. zeus) and username is your username on the server.

Transmission

First make sure Advanced Settings have been set to Shown, in order for the necessary options to appear.

Name
Your chosen name for the settings - you can pick what you like
Enable
Yes
Host
server.feralhosting.com
Port
443
Url Base
/username/transmission/
Username
Your Transmission username
Password
Your Transmission password
Use SSL
Yes

In the above settings, server is replaced by the name of your server (e.g. zeus) and username is your username on the server.

Uninstallation

pkill -9 -f Sonarr; rm -rf ~/.config/Sonarr/ ~/Sonarr