It’s easy to install Sonarr on Ubuntu 20.04 and only takes 4 steps. In this tutorial you will also learn how to install Mono, a C# run time that Sonarr is programmed, and set up Sonarr key and repo on Ubuntu 20.04 before the installation. In order to make Sonarr to automatically start on boot and restart after reboot, we also add a sonarr systemd service.
Contents
Sonarr & Ubuntu 20.04
Sonarr is a web application that monitors and downloads TV shows as a new episode release. You can also download previous by manually searching for them. With Sonarr installed, you don’t have manually search for new episodes but have Sonarr automate that for you. It is often used with Kodi to watch the downloaded TV shows and Radarr to automate movies downloads.
The downloaded files are often through torrent clients such as Transmission or Deluge to external hard drives. Sonarr is perfect for legal purposes, for example, you don’t have to transfer from your DVD or Blu-ray disks to a computer or a hard drive. With Sonarr, you don’t even have to own a DVD/Blueray player or buy an external DVD/Blueray reader.
As the latest version of the most popular Linux distribution Ubuntu, Ubuntu 20.04 is released recently on April 2020 and has standard support until Apr 2025. It will reach the end of life for 10 years until April 2030. This release brings a new Yaru theme compared to Ubuntu 18.04 (and also both 14.04 and 16.04) and supports night mode, good for your internal clock. It has GNOME 3.6 which has improved performance. Most importantly, Ubuntu 20.04 comes with NVIDIA Linux driver itself, so you don’t have to take extra steps to install it through the “additional drivers” tab in the “Software & Updates” program.
You might have just installed Ubuntu 20.04 and want to install Sonarr to automate your life, at least for watching TV shows. This tutorial has been run on Ubuntu 20.04 but can also apply to Debian or Raspbian 10 if you are setting up Sonarr on your Raspberry Pi.
Before installing Sonarr on Ubuntu
You will need to have a Debian-based Linux distro installed, preferably Ubuntu 20.04 in order to install Sonarr. Linux mint or Raspberry Pi OS should also work.
Because we will add new Ubuntu APT repository and install some packages system wide, you will need to have root access.
Step 1 — Install Mono, the framework Sonarr is written in
Mono is an open-source C# .Net framework implementation, originally targeted to Linux. We are going to install it before we install Sonarr as Sonarr is written in C# and need the Mono runtime.
In the following, we will install mono-devel from mono’s own official Ubuntu 20.04 repository, which is also recommended by the official Sonarr installation guide. However, if you prefer your system packaged mono, you can directly install mono-devel by running sudo apt install mono-devel.
Install needed packages
To install mono’s official package, we will first install software gnupg and ca-certificates. gnupg is called GNUprivacy guard, which is developed at GNU organization and used to make network communication and data storage secure by encrypting data with digital signatures. ca-certificates provides certificate authorities that issue the digital signatures (certificate authorities), so one can check if the data is authentically transferred through the HTTPS protocol.
sudo apt install gnupg ca-certificates
If you see similar output as follows, it indicates that the two software is installed. On my machine, the two packages are already installed on my Ubuntu 20.04 machine, but it is safer to run them anyways to avoid problems in later steps if we do not have them installed.
Reading package listsโฆ Done
Building dependency tree
Reading state informationโฆ Done
ca-certificates is already the newest version (20190110ubuntu1).
gnupg is already the newest version (2.2.19-3ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 46 not upgraded.
Add Mono’s official key
With the needed tools installed, we will now use apt-key to add the public key 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF owned by Xamarin, which is the company developing Mono. We use the adv parameter here to pass advanced parameters to apt-key such as key server and the key string. With this Mono key installed, mono related packages that were signed by this key will be authenticated and considered trusted.
The output will be like the following. You can see the key owner is Xamarin Public Jenkins (auto-signing) and the associated email (releng@xamarin.com). Jenkins is an automation server for building, testing, and deploying software.
Executing: /tmp/apt-key-gpghome.t1ACjSQp0Q/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
gpg: key A6A19B38D3D831EF: public key "Xamarin Public Jenkins (auto-signing) releng@xamarin.com" imported
gpg: Total number processed: 1
gpg: imported: 1
Add mono’s Ubuntu 20.04 repository
Now we will add Mono project’s official Ubuntu 20.04 repository (APT data source) to the mono-official-stable.list file in the directory /etc/apt/sources.list.d/. If you see the output deb https://download.mono-project.com/repo/ubuntu stable-focal main, the repo is successfully added.
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
Now we run sudo apt update to get all the information about the packages from Mono’s repo. Technically, we resynchronize the package index files. You will see the output in the following screenshot. Note that you will receive a warning about the repo not supporting i386 architecture, safely ignore it as the chases are you are running on a 64-bit machine.
Skipping acquire of configured file ‘main/binary-i386/Packages’ as repository ‘https://download.mono-project.com/repo/ubuntu stable-focal InRelease’ doesn’t support architecture ‘i386’
Now we will finally install the Mono package, more accurately the mono-devel package. As its name suggests, this package contains development tools and pulls in the development stack for Mono. You will see similar output from the following screenshot. Press enter or type Y and press enter to continue. After mono installation, it will take 382 MB disk space. The installation will be slow as it will compile on your machine.
sudo apt install mono-devel
Very good. Now you have mono installed on your Ubuntu 20.04 machine, the most important dependency of Sonarr installation, and Radarr if you know it.
To verify it, let’s check the version of Mono. You will see similar output like the following screenshot. In my case, Mono JIT compiler version 6.8.0.123 is installed. JIT means just-in-time, which says it will compile on fly.
Before we add the official Sonarr Ubuntu repo, we will install the key in order to make sure we will download and install the authentic Sonarr package. The process is remarkably like adding the mono key.
While, if are new to Sonarr, you will see a strange name NzbDrone in the output (following screenshot). Don’t worry, it is just the old name of Sonarr. Just like XBMC to Kodi.
Step 3 — Add official Sonarr repo to Ubuntu 20.04
Next, before we finally install Sonarr, we will add sonarr’s repo, which contains the sonarr package that you will install on our Ubuntu 20.04 computer. After you run the following command, you will see this output: deb http://apt.sonarr.tv/ master main.
echo "deb http://apt.sonarr.tv/ master main" | sudo tee /etc/apt/sources.list.d/sonarr.list
Now we can run sudo apt update to get the package index files from the Sonarr apt repo. You will see output like the following screenshot. Note the last line (Get:10) is refreshing the index files.
sudo apt update
Step 4 — Install sonarr
Finally, we can now run apt install to install Sonarr. Did you hear the sound of Sonarr?
Note there the package is still having its old name nzbdrone. Along with nzbdrone, it will install additional dependencies: libmediainfo0v5, libmms0, libtinyxml2-6a, libzen0v5, mediainfo.
sudo apt install nzbdrone
Press enter to continue installing Sonarr.
Sonarr will be installed in /opt/NzbDrone directory.
Start Sonarr
To test whether Sonarr is installed on your Ubuntu 20.04 machine, let’s start it using mono. Notice in the following we do not use --debug which is included in the official installation guide, this way we won’t see the excessive messages for debugging purposes.
mono /opt/NzbDrone/NzbDrone.exe
You will see the following output. The important info is that Sonarr is running on port 8989, which means we can open Sonarr by http://localhost:8989/. Now right-click this URL to open it and you will Sonarr’s web interface as follows.
Until the last step, if you restart your computer or experience a power outage, you will have to start Sonarr again to use it. Here we will use a software called systemd to auto-start Sonarr for you after Ubuntu is rebooted. What we will use next is called systemd service.
Create Sonarr systemd service
Create a service file called sonarr.service in the /etc/systemd/system/ directory. Here I use the vim editor. If you are new to Ubuntu, you can also use the nano editor.
sudo vim /etc/systemd/system/sonarr.service
[Unit]
Description=Sonarr Daemon
After=network.target
[Service]
# Change and/or create the required user and group.
User=vh
Group=vh
# The UMask parameter controls the permissions of folders and files created.
#UMask=002
# The -data=/path argument can be used to force the config/db folder
ExecStart=/usr/bin/mono --debug /opt/NzbDrone/NzbDrone.exe -nobrowser
Type=simple
TimeoutStopSec=20
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
Add the content above first. This is a sample systemd service file. You will need to change User and Group in the Service block. This is the user used to run Sonarr on Ubuntu. Change it to your current user. The group can be the same as your username. If you are an experienced Linux user, you can create a user called sonarr but it is not necessary for the personal use of Sonarr.
You can also specify -data for a customized config directory, the default Sonarr configuration files will be located in ~/.config/NzbDrone.
For other values, the After=network.target means we only start Sonarr after all the network management stack is up, which is reasonable because we will bind a network port.
We have KillMode=process to only kill one single process because we are only running one process (Sonarr).
Restart=on-failure is specified because we only want to restart Sonarr when it failed.
Enable/start sonarr systemd service
Now we will enable the sonarr service using systemctrl, which is, as the name suggests, used to control systemd services. Indeed, you don’t have to enable it right now, it will be automatically enabled after you reboot Ubuntu.
sudo systemctl enable --now sonarr.service
You will see the output as follows. Under the hood, it created a soft symbolic link (just a reference, like shortcut on Windows) to the multi-user target folder. All we need to know there is that the multi-user target starts after all the network services. Sonarr service is under this category because it is essentially a network application.
To verify the sonarr is successfull started, run sudo systemctl status sonarr.service. You will see the output similar to the screenshot below. As you can see, Sonarr has process PID 3668 and takes 108.1 MB memory. It is listening to http://*:8989/ (yes, you can open http://localhost:8989/ or replace localhost with your IP address) and stored 2 database in /home/vh/.config/NzbDrone/ which is really ~/.config/NzbDrone/ in the home directory.
โ sonarr.service - Sonarr Daemon
Loaded: loaded (/etc/systemd/system/sonarr.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2020-05-15 11:52:55 EDT; 11s ago
Main PID: 3668 (mono)
Tasks: 13 (limit: 2247)
Memory: 108.1M
CGroup: /system.slice/sonarr.service
โโ3668 /usr/bin/mono --debug /opt/NzbDrone/NzbDrone.exe -nobrowser
May 15 11:52:55 varhowto-com systemd[1]: Started Sonarr Daemon.
May 15 11:52:55 varhowto-com mono[3668]: [Info] Bootstrap: Starting Sonarr - /opt/NzbDrone/NzbDrone.exe - Version 2.0.0.5344
May 15 11:52:56 varhowto-com mono[3668]: [Info] Router: Application mode: Interactive
May 15 11:52:56 varhowto-com mono[3668]: [Info] MigrationLogger: *** Migrating data source=/home/vh/.config/NzbDrone/nzbdrone.db;ca>
May 15 11:52:56 varhowto-com mono[3668]: [Info] MigrationLogger: *** Migrating data source=/home/vh/.config/NzbDrone/logs.db;cache >
May 15 11:52:56 varhowto-com mono[3668]: [Info] OwinHostController: Listening on the following URLs:
May 15 11:52:56 varhowto-com mono[3668]: [Info] OwinHostController: http://*:8989/
May 15 11:52:56 varhowto-com mono[3668]: [Info] NancyBootstrapper: Starting Web Server
Stop/restart sonarr systemd service
A systemd service allows us yo autostart a service like Sonarr, you can also use the following commands to stop or restart Sonarr any time, particularly if there is a problem.
To stop the sonarr systemd service, run sudo systemctl stop sonarr.service. To restart sonarr, run sudo systemctl restart sonarr.service.
After you installed Sonarr, sometime you may want to uninstall it. So, to remove Sonarr, we will go through 3 steps so the sonarr system service is uninstalled and the Sonarr files are deleted.
First we disable the Sonarr service:
sudo systemctl disable sonarr.service
Then we remove theย sonarr.serviceย file we added:
sudo remove /etc/systemd/system/sonarr.service
Finally, we remove the Radarr folder we downloaded.
sudo rm -rf /opt/NzbDrone/
Conclusion
Congratulations, you have learned how to install Sonarr and make it auto-start using by adding the Sonarr systemd service on your Ubuntu 20.04 computer! Now you can setup Sonarr, add an indexer and download some TV shows you have probably bought from BestBuy, Walmart, or Target. If you want to monitor Sonarr with missing episodes or what are queued, you can run the Heimdall. Here is how you can install Heimdall on Ubuntu 20.04. If you prefer Docker, you can also install Heimdall on Ubuntu 20.04 with Docker.
14 replies on “How to install Sonarr on Ubuntu 20.04 easily”
I didn’t get a /opt/NzbDrone/NzbDrone.exe I did how ever get a /usr/lib/sonarr/bin/Sonarr.exe but doesn’t run well on a ODROID.
0
If you encounter the following error:
W: GPG error: http://apt.sonarr.tv master InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY EBFF6B99D9B78493
Cause:
Behind a firewall you should use the port 80 instead of the default port 11371.
Hi- I’m trying this on my Rasp. Pi running Ubuntu 20.4. When I try to install nzbdrone, I get the error: Unable to locate package nzbdrone. I also saw a warning higher up that some packages were not being installed due to my arm64. Any help would be appreciated.
0
Hi, I must have done something incompletely or wrong, since my Radarr with load but not autostart. I can start it with the systemctl command, but it doesn’t autostart.
I suspect my username is not correct, but any help is appreciated
0
It looked like you miss some # in the file. Try to copy what’s in this post and just change the user and group.
[Unit]
Description=Sonarr Daemon
After=network.target
[Service]
# Change and/or create the required user and group.
User=ralph
Group=ralph
# The UMask parameter controls the permissions of folders and files created.
#UMask=002
# The -data=/path argument can be used to force the config/db folder
ExecStart=/usr/bin/mono --debug /opt/NzbDrone/NzbDrone.exe -nobrowser
Type=simple
TimeoutStopSec=20
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
+1
G’day. Great Guide! No errors etc – all commands work well.
Just one thing – assuming a complete novice is following along – all goes perfect (copy, paste, correct output) until the “Create sonarr systemd service”. I am reasonably OK with this stuff, but even this tripped me up a little. I blindly copied the “sudo vim /etc/systemd/system/sonarr.service”, and being that VIM is not as userfriendly as nano, I lost the plot – so maybe just a couple instructions on which keyboard short cuts to use for VIM (as i’m not familiar, I couldn’t even get out of the VIM file creator, so had to terminate the session, log back in and correct to nano.) re: paste, write, save, close.
And one other was after running “sudo systemctl enable –now sonarr.service” – just a line to say ‘press ‘q’ to get out of the running process dialogue.
Cheers, again for all your time and effort on this.
0
You might want to specify that this is for the v2 of Sonarr and not the current and updating version 3.
+2
Thanks for pointing this out, Steven. v3 is still in beta, according to the Sonarr website: https://sonarr.tv/#downloads-v3-windows. I will try to update this to v3 once it becomes the current version.
+1
I get an error that says my it can’t update because my user doesn’t have rights for /opt/
How does one fix that?
+1
That’s because /opt is owned by the root user when you run sudo apt install nzbdrone to install Sonarr. You can disable auto update in your Sonnar application, Ubuntu’s system manager will handle updates.
+1
So glad that I found this. Works without any issues! Thanks heaps!
+1
Thanks for leaving a comment! Glad it helped.
0
Awesome!! Thanks for this guide. Worked perfectly!!!
+3
I’m glad it helps! Thanks for leaving a reply as well!
14 replies on “How to install Sonarr on Ubuntu 20.04 easily”
I didn’t get a /opt/NzbDrone/NzbDrone.exe I did how ever get a /usr/lib/sonarr/bin/Sonarr.exe but doesn’t run well on a ODROID.
If you encounter the following error:
W: GPG error: http://apt.sonarr.tv master InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY EBFF6B99D9B78493
Cause:
Behind a firewall you should use the port 80 instead of the default port 11371.
Solution:
sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys 0xA236C58F409091A18ACA53CBEBFF6B99D9B78493
Hi- I’m trying this on my Rasp. Pi running Ubuntu 20.4. When I try to install nzbdrone, I get the error: Unable to locate package nzbdrone. I also saw a warning higher up that some packages were not being installed due to my arm64. Any help would be appreciated.
Hi, I must have done something incompletely or wrong, since my Radarr with load but not autostart. I can start it with the systemctl command, but it doesn’t autostart.
Status of Radarr after reboot–
ralph@ralph-ubuntu:~$ sudo systemctl status sonarr.service
โ sonarr.service – Sonarr Daemon
Loaded: loaded (/etc/systemd/system/sonarr.service; disabled; vendor preset: enabl>
Active: inactive (dead)
here is my radarr.service:
[Unit]
Description=Sonarr Daemon
After=network.target
[Service]
Change and/or create the required user and group.
User=ralph
Group=ralph
The UMask parameter controls the permissions of folders and files created.
#UMask=002
The -data=/path argument can be used to force the config/db folder
ExecStart=/usr/bin/mono –debug /opt/NzbDrone/NzbDrone.exe -nobrowser
Type=simple
TimeoutStopSec=20
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
I suspect my username is not correct, but any help is appreciated
It looked like you miss some
#
in the file. Try to copy what’s in this post and just change the user and group.G’day. Great Guide! No errors etc – all commands work well.
Just one thing – assuming a complete novice is following along – all goes perfect (copy, paste, correct output) until the “Create sonarr systemd service”. I am reasonably OK with this stuff, but even this tripped me up a little. I blindly copied the “sudo vim /etc/systemd/system/sonarr.service”, and being that VIM is not as userfriendly as nano, I lost the plot – so maybe just a couple instructions on which keyboard short cuts to use for VIM (as i’m not familiar, I couldn’t even get out of the VIM file creator, so had to terminate the session, log back in and correct to nano.) re: paste, write, save, close.
And one other was after running “sudo systemctl enable –now sonarr.service” – just a line to say ‘press ‘q’ to get out of the running process dialogue.
Cheers, again for all your time and effort on this.
You might want to specify that this is for the v2 of Sonarr and not the current and updating version 3.
Thanks for pointing this out, Steven. v3 is still in beta, according to the Sonarr website: https://sonarr.tv/#downloads-v3-windows. I will try to update this to v3 once it becomes the current version.
I get an error that says my it can’t update because my user doesn’t have rights for /opt/
How does one fix that?
That’s because
/opt
is owned by the root user when you runsudo apt install nzbdrone
to install Sonarr. You can disable auto update in your Sonnar application, Ubuntu’s system manager will handle updates.So glad that I found this. Works without any issues! Thanks heaps!
Thanks for leaving a comment! Glad it helped.
Awesome!! Thanks for this guide. Worked perfectly!!!
I’m glad it helps! Thanks for leaving a reply as well!