Categories
Self-Hosted

How to Install Lidarr on Ubuntu 20.04

Installing Lidarr on Ubuntu 20.04 is easy, and takes just 3 steps. I You’ll also learn how to install Mono in this guide, a C # run time that Lidar is programmed in, and set up the Lidarr key and repo on Ubuntu 20.04 before installation. We are also introducing a lidarr systemd service to allow Lidarr automatically start on boot and restart after reboot.

Lidarr & Ubuntu 20.04

Lidarr is a web application that tracks and installs music as it releases a new album. You can also find previous ones by looking for them manually. With Lidarr enabled, you don’t have to search your favorite artists for new albums manually but let Lidarr automate it for you.

The downloaded files are also transferred to external hard drives via torrent clients such as Transmission or Deluge. For instance, you don’t need to switch from your CDs to a computer or a hard disk, Lidarr is good for legal purposes. You don’t even need to own a CD / DVD player with Lidarr, or purchase an additional CD / DVD reader.

Ubuntu 20.04, as the newest version of the most common Linux distribution — Ubuntu, is launched recently on April 2020 and has standard support until Apr 2025. It will hit the end of life before April 2030, for 10 years. Similar to Ubuntu 18.04 (and even both 14.04 and 16.04), this version includes a fresh Yaru theme and supports night mode, which is perfect for your internal clock!

It has GNOME 3.6 which has the performance improved. Most notably, Ubuntu 20.04 comes with NVIDIA Linux driver itself, and you don’t need to take extra steps to install it in the “Software & Updates” program in the “Additional Drivers” tab.

You might just have installed Ubuntu 20.04 and want Lidarr installed to simplify your life, at least for listening to music. This tutorial was run on Ubuntu 20.04 but if you set up Lidarr on your Raspberry Pi 4, it can also apply to Debian or Raspbian 10.

Before installing Lidarr on Ubuntu

To run Lidarr, you’ll need a Debian-based Linux distro installed, preferably Ubuntu 20.04. Linux  Mint, POP! OS or Raspberry Pi OS ought to work, too.

Because we will install systemd service, you will need to have root access.

Step 1 — Install Mono, the runtime Lidarr is written in

Mono is an implementation of the open-source C#.Net framework, initially aimed at Linux. Before we install Lidarr as Lidarr is written in C #, we need the Mono runtime, so we must install it.

We’ll install mono-devel from mono’s own official Ubuntu 20.04 repository, which is also recommended by the official installation guide for Lidarr. Nevertheless, if you want the mono system package, you can install mono-devel directly 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 GNU privacy 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.

Output of "sudo apt install gnupg ca-certificates"
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.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

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.

Adding mono's key: Output of sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
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
Add mono's Ubuntu 20.04 repository

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’

sudo apt update
sudo apt update after adding mono's Ubuntu repo
Hit:1 https://download.docker.com/linux/ubuntu bionic InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 http://packages.ros.org/ros/ubuntu focal InRelease
Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Get:6 https://download.mono-project.com/repo/ubuntu stable-focal InRelease [4,416 B]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates InRelease [107 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Get:9 https://download.mono-project.com/repo/ubuntu stable-focal/main amd64 Packages [46.6 kB]
Get:10 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages [23.4 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [94.0 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [54.1 kB]
Get:13 http://security.ubuntu.com/ubuntu focal-security/main Translation-en [21.1 kB]
Get:14 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [16.6 kB]
Get:15 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [208 B]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [48.5 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-updates/main Translation-en [35.0 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [90.5 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal-updates/main DEP-11 48x48 Icons [21.4 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-updates/main DEP-11 64x64 Icons [30.5 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [2,240 B]
Get:22 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [30.5 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal-updates/universe i386 Packages [21.7 kB]
Get:24 http://archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [14.9 kB]
Get:25 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [21.5 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [1,264 B]
Get:27 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [532 B]
Fetched 891 kB in 1s (756 kB/s)
Reading package lists… Done
Building dependency tree
Reading state information… Done
55 packages can be upgraded. Run 'apt list --upgradable' to see them.
N: 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'

Install mono-devel package

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
installing mono-devel after "sudo apt install mono-devel"

Very good. Now you have mono installed on your Ubuntu 20.04 machine, the most important dependency of Lidarr 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.

mono --version
image 49

Reference

Step 2 — Install latest Lidarr release

Like Sonarr, there’s no official Ubuntu repository for Lidarr to install on your Ubuntu 20.04 machine. Instead we are going to grab the latest release from the official GitHub repo of Lidarr. GitHub is incredibly popular code hosting site in the event you don’t know and Lidarr developers store their code there: https:/github.com/lidarr/Lidarr.

Download latest Lidarr release from GitHub

There has been a major update of Lidarr, use wget https://github.com/lidarr/Lidarr/releases/download/v0.7.2.1878/Lidarr.master.0.7.2.1878.linux.tar.gz instead of the following instructions.

First, we will run curl to download the latest release archive in .tar.gz format, which is similar to the common zip format.

curl -L -O $( curl -s https://api.github.com/repos/Lidarr/Lidarr/releases | grep linux.tar.gz | grep browser_download_url | head -1 | cut -d \" -f 4 )
download latest Lidarr release from GitHub.png

vh@varhowto-com:~$ curl -L -O $( curl -s https://api.github.com/repos/Lidarr/Lidarr/releases | grep linux.tar.gz | grep browser_download_url | head -1 | cut -d \" -f 4 )
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:-- 0 0 0 0 0 0 0 0 --:--:-- --:--100 648 100 648 0 0 2551 0 --:--:-- --:--:-- --:--:-- 2541
80 12.5M 80 10.1M 0 0 8307k 0 0:00:01 0:00100 12.5M 100 12.5M 0 0 9041k 0 0:00:01 0:00:01 --:--:-- 14.0M

You will see the output like the above: here the downloaded archive is 14.0 MB. To verify, we run ls Lidarr*. As you can see, we downloaded the Linux develop version 0.7.1.1381: Lidarr.master.0.7.1.1381.linux.tar.gz. Your version might be different from mine. Even though the archive is not Ubuntu or Ubuntu 20.04 specific, but we are fine because Ubuntu belongs to the Linux family.

ls Lidarr*
ls Lidarr showing

Uncompress Lidarr on Ubuntu 20.04

Once Lidarr’s latest release is downloaded, we’ll now uncompress it to your home directory.

Run the following with tar command to uncompress it. As you can see, the passed parameter looks similar: here we are really uncompressing Lidarr.master.0.7.1.1381.linux.tar.gz.

tar -xvzf Lidarr.*.linux.tar.gz

Then you will see a lengthy list of files all under the Lidarr directory:

the files of Lidarr installation

Different from the official Lidarr installation guide

The official Lidarr installation guide suggests us to move the Lidarr directory to the /opt directory by running the following command. The /opt directory is used for third-party packages that are not in Ubuntu’s packaging system, so it is supposed to be perfectly reasonable to set up the Lidarr files there.

However, the /opt directory is owned by the root user and, if you only set up for personal use, you don’t have to follow all the rules to avoid the undesired permission issues. It is your house anyway. Theoretically, you should set up a user called lidarr to run Lidarr so it is not allowed to write any of your personal files but it doesn’t have be like this.

mv Lidarr /opt
not installing Lidarr to the opt directory
Here we choose not to install Lidarr to /opt to avoid permission and self-update issues.

Start Lidarr

To check whether Lidarr is installed on your Ubuntu 20.04 machine, let’s start Lidarr using mono. Notice in the following we do not use --debug, this way we won’t see the excessive messages for debugging purposes.

mono ~/Lidarr/Lidarr.exe

You will see the following output.

vh@varhowto-com:~$ mono ~/Lidarr/Lidarr.exe
[Info] Bootstrap: Starting Lidarr - /home/vh/Lidarr/Lidarr.exe - Version 0.7.1.1381
[Info] Router: Application mode: Interactive
[Info] MigrationLogger: *** Migrating data source=/home/vh/.config/Lidarr/lidarr.db;cache size=-10000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3 ***
[Info] MigrationLogger: *** VersionMigration migrating ***
[Info] MigrationLogger: *** VersionUniqueMigration migrating ***
[Info] MigrationLogger: *** VersionDescriptionMigration migrating ***
[Info] MigrationLogger: *** 1: InitialSetup migrating ***
[Info] InitialSetup: Starting migration to 1
[Info] MigrationLogger: *** 2: add_reason_to_pending_releases migrating ***
[Info] add_reason_to_pending_releases: Starting migration to 2
[Info] MigrationLogger: *** 3: add_medium_support migrating ***
[Info] add_medium_support: Starting migration to 3
[Info] MigrationLogger: *** 4: add_various_qualites_in_profile migrating ***
[Info] add_various_qualites_in_profile: Starting migration to 4
[Info] MigrationLogger: *** 5: metadata_profiles migrating ***
[Info] metadata_profiles: Starting migration to 5
[Info] MigrationLogger: *** 6: separate_automatic_and_interactive_search migrating ***
[Info] separate_automatic_and_interactive_search: Starting migration to 6
[Info] MigrationLogger: *** 7: change_album_path_to_relative migrating ***
[Info] change_album_path_to_relative: Starting migration to 7
[Info] MigrationLogger: *** 8: change_quality_size_mb_to_kb migrating ***
[Info] change_quality_size_mb_to_kb: Starting migration to 8
[Info] MigrationLogger: *** 9: album_releases migrating ***
[Info] album_releases: Starting migration to 9
[Info] MigrationLogger: *** 10: album_releases_fix migrating ***
[Info] album_releases_fix: Starting migration to 10
[Info] MigrationLogger: *** 11: import_lists migrating ***
[Info] import_lists: Starting migration to 11
[Info] MigrationLogger: *** 12: add_release_status migrating ***
[Info] add_release_status: Starting migration to 12
[Info] MigrationLogger: *** 13: album_download_notification migrating ***
[Info] album_download_notification: Starting migration to 13
[Info] MigrationLogger: *** 14: fix_language_metadata_profiles migrating ***
[Info] fix_language_metadata_profiles: Starting migration to 14
[Info] MigrationLogger: *** 15: remove_fanzub migrating ***
[Info] remove_fanzub: Starting migration to 15
[Info] MigrationLogger: *** 16: update_artist_history_indexes migrating ***
[Info] update_artist_history_indexes: Starting migration to 16
[Info] MigrationLogger: *** 17: remove_nma migrating ***
[Info] remove_nma: Starting migration to 17
[Info] MigrationLogger: *** 18: album_disambiguation migrating ***
[Info] album_disambiguation: Starting migration to 18
[Info] MigrationLogger: *** 19: add_ape_quality_in_profiles migrating ***
[Info] add_ape_quality_in_profiles: Starting migration to 19
[Info] MigrationLogger: *** 20: remove_pushalot migrating ***
[Info] remove_pushalot: Starting migration to 20
[Info] MigrationLogger: *** 21: add_custom_filters migrating ***
[Info] add_custom_filters: Starting migration to 21
[Info] MigrationLogger: *** 22: import_list_tags migrating ***
[Info] import_list_tags: Starting migration to 22
[Info] MigrationLogger: *** 23: add_release_groups_etc migrating ***
[Info] add_release_groups_etc: Starting migration to 23
[Info] MigrationLogger: *** 24: NewMediaInfoFormat migrating ***
[Info] NewMediaInfoFormat: Starting migration to 24
[Info] MigrationLogger: *** 25: rename_restrictions_to_release_profiles migrating ***
[Info] rename_restrictions_to_release_profiles: Starting migration to 25
[Info] MigrationLogger: *** 26: rename_quality_profiles_add_upgrade_allowed migrating ***
[Info] rename_quality_profiles_add_upgrade_allowed: Starting migration to 26
[Info] MigrationLogger: *** 27: add_import_exclusions migrating ***
[Info] add_import_exclusions: Starting migration to 27
[Info] MigrationLogger: *** 28: clean_artist_metadata_table migrating ***
[Info] clean_artist_metadata_table: Starting migration to 28
[Info] MigrationLogger: *** 29: health_issue_notification migrating ***
[Info] health_issue_notification: Starting migration to 29
[Info] MigrationLogger: *** 30: add_mediafilerepository_mtime migrating ***
[Info] add_mediafilerepository_mtime: Starting migration to 30
[Info] MigrationLogger: *** 31: add_artistmetadataid_constraint migrating ***
[Info] add_artistmetadataid_constraint: Starting migration to 31
[Info] MigrationLogger: *** 32: old_ids_and_artist_alias migrating ***
[Info] old_ids_and_artist_alias: Starting migration to 32
[Info] MigrationLogger: *** 33: download_propers_config migrating ***
[Info] download_propers_config: Starting migration to 33
[Info] MigrationLogger: *** 34: remove_language_profiles migrating ***
[Info] remove_language_profiles: Starting migration to 34
[Info] MigrationLogger: *** 35: multi_disc_naming_format migrating ***
[Info] multi_disc_naming_format: Starting migration to 35
[Info] MigrationLogger: *** Migrating data source=/home/vh/.config/Lidarr/logs.db;cache size=-10000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3 ***
[Info] MigrationLogger: *** VersionMigration migrating ***
[Info] MigrationLogger: *** VersionUniqueMigration migrating ***
[Info] MigrationLogger: *** VersionDescriptionMigration migrating ***
[Info] MigrationLogger: *** 1: InitialSetup migrating ***
[Info] InitialSetup: Starting migration to 1
[Info] MigrationLogger: *** 2: add_reason_to_pending_releases migrating ***
[Info] add_reason_to_pending_releases: Starting migration to 2
[Info] MigrationLogger: *** 3: add_medium_support migrating ***
[Info] add_medium_support: Starting migration to 3
[Info] MigrationLogger: *** 4: add_various_qualites_in_profile migrating ***
[Info] add_various_qualites_in_profile: Starting migration to 4
[Info] MigrationLogger: *** 5: metadata_profiles migrating ***
[Info] metadata_profiles: Starting migration to 5
[Info] MigrationLogger: *** 6: separate_automatic_and_interactive_search migrating ***
[Info] separate_automatic_and_interactive_search: Starting migration to 6
[Info] MigrationLogger: *** 7: change_album_path_to_relative migrating ***
[Info] change_album_path_to_relative: Starting migration to 7
[Info] MigrationLogger: *** 8: change_quality_size_mb_to_kb migrating ***
[Info] change_quality_size_mb_to_kb: Starting migration to 8
[Info] MigrationLogger: *** 9: album_releases migrating ***
[Info] album_releases: Starting migration to 9
[Info] MigrationLogger: *** 10: album_releases_fix migrating ***
[Info] album_releases_fix: Starting migration to 10
[Info] MigrationLogger: *** 11: import_lists migrating ***
[Info] import_lists: Starting migration to 11
[Info] MigrationLogger: *** 12: add_release_status migrating ***
[Info] add_release_status: Starting migration to 12
[Info] MigrationLogger: *** 13: album_download_notification migrating ***
[Info] album_download_notification: Starting migration to 13
[Info] MigrationLogger: *** 14: fix_language_metadata_profiles migrating ***
[Info] fix_language_metadata_profiles: Starting migration to 14
[Info] MigrationLogger: *** 15: remove_fanzub migrating ***
[Info] remove_fanzub: Starting migration to 15
[Info] MigrationLogger: *** 16: update_artist_history_indexes migrating ***
[Info] update_artist_history_indexes: Starting migration to 16
[Info] MigrationLogger: *** 17: remove_nma migrating ***
[Info] remove_nma: Starting migration to 17
[Info] MigrationLogger: *** 18: album_disambiguation migrating ***
[Info] album_disambiguation: Starting migration to 18
[Info] MigrationLogger: *** 19: add_ape_quality_in_profiles migrating ***
[Info] add_ape_quality_in_profiles: Starting migration to 19
[Info] MigrationLogger: *** 20: remove_pushalot migrating ***
[Info] remove_pushalot: Starting migration to 20
[Info] MigrationLogger: *** 21: add_custom_filters migrating ***
[Info] add_custom_filters: Starting migration to 21
[Info] MigrationLogger: *** 22: import_list_tags migrating ***
[Info] import_list_tags: Starting migration to 22
[Info] MigrationLogger: *** 23: add_release_groups_etc migrating ***
[Info] add_release_groups_etc: Starting migration to 23
[Info] MigrationLogger: *** 24: NewMediaInfoFormat migrating ***
[Info] NewMediaInfoFormat: Starting migration to 24
[Info] MigrationLogger: *** 25: rename_restrictions_to_release_profiles migrating ***
[Info] rename_restrictions_to_release_profiles: Starting migration to 25
[Info] MigrationLogger: *** 26: rename_quality_profiles_add_upgrade_allowed migrating ***
[Info] rename_quality_profiles_add_upgrade_allowed: Starting migration to 26
[Info] MigrationLogger: *** 27: add_import_exclusions migrating ***
[Info] add_import_exclusions: Starting migration to 27
[Info] MigrationLogger: *** 28: clean_artist_metadata_table migrating ***
[Info] clean_artist_metadata_table: Starting migration to 28
[Info] MigrationLogger: *** 29: health_issue_notification migrating ***
[Info] health_issue_notification: Starting migration to 29
[Info] MigrationLogger: *** 30: add_mediafilerepository_mtime migrating ***
[Info] add_mediafilerepository_mtime: Starting migration to 30
[Info] MigrationLogger: *** 31: add_artistmetadataid_constraint migrating ***
[Info] add_artistmetadataid_constraint: Starting migration to 31
[Info] MigrationLogger: *** 32: old_ids_and_artist_alias migrating ***
[Info] old_ids_and_artist_alias: Starting migration to 32
[Info] MigrationLogger: *** 33: download_propers_config migrating ***
[Info] download_propers_config: Starting migration to 33
[Info] MigrationLogger: *** 34: remove_language_profiles migrating ***
[Info] remove_language_profiles: Starting migration to 34
[Info] MigrationLogger: *** 35: multi_disc_naming_format migrating ***
[Info] multi_disc_naming_format: Starting migration to 35
[Info] OwinHostController: Listening on the following URLs:
[Info] OwinHostController: http://*:8686/
[Info] LidarrBootstrapper: Starting Web Server
[Info] QualityProfileService: Setting up default quality profiles
[Info] MetadataProfileService: Setting up default metadata profile
[Warn] MonoDebugCheck: Mono is not running with --debug switch
running lidarr on Ubuntu 20.04

The most important info is that Lidarr is running on port 8686, which is very similar to Sonarr running at port 8989, which means we can open Lidarr by http://localhost:8686/. Now right-click this URL to open it and you will see Lidarr’s web interface.

Lidarr web interface

Reference

Auto-start Lidarr with systemd service

Until the last step, if you restart your computer or experience a power outage, you will have to start Lidarr again to use it. Here we will use a software called systemd to auto-start Lidarr for you on boot. What we will use next is called systemd service.

Create Lidarr systemd service

Create a service file called lidarr.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/lidarr.service
[Unit]
Description=Lidarr Daemon
After=syslog.target network.target

[Service]
# Change and/or create the required user and group.
User=vh
Group=vh

Type=simple

# Change the path to Lidarr or mono here if it is in a different location for you.
ExecStart=/usr/bin/mono --debug /home/vh/Lidarr/Lidarr.exe -nobrowser
TimeoutStopSec=20
KillMode=process
Restart=on-failure

# These lines optionally isolate (sandbox) Lidarr from the rest of the system.
# Make sure to add any paths it might use to the list below (space-separated).
#ReadWritePaths=/opt/Lidarr /path/to/music/folder
#ProtectSystem=strict
#PrivateDevices=true
#ProtectHome=true

[Install]
WantedBy=multi-user.target

Add the content above first. This is a sample systemd service file. You will need to change User, Group, and ExecStart in the Service block. This is the user used to run Lidarr on Ubuntu. Search vh and 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 lidarr but it is not necessary for the personal use of Lidarr.

You can also specify -data for a customized config directory, the default Lidarr configuration files will be located in ~/.config/Lidarr.

For other values, the syslog.target means Lidarr will only be started when syslog is ready.

The network.target means we only start Lidarr 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 (Lidarr).

Restart=on-failure is specified because we only want to restart Lidarr when it failed.

Enable/start Lidarr systemd service

Now we will enable the Lidarr 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 lidarr.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. Lidarr service is under this category because it is essentially a network application.

enable lidarr systemd service on Ubuntu 20.04

To verify the Lidarr is successfully started, run sudo systemctl status lidarr.service. You will see the output similar to the screenshot. As you can see, Lidarr has process PID 5347 and takes 101.0 MB, similar to Sonarr’s 108.1 MB memory. It is listening to http://*:8686/ (yes, you can open http://localhost:8686/ or replace localhost with your IP address) and stored 2 database in /home/vh/.config/Lidarr/ which is really ~/.config/Lidarr/ in your home directory.

check status of Lidarr systemd service
● lidarr.service - Lidarr Daemon
Loaded: loaded (/etc/systemd/system/lidarr.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2020-08-02 23:20:12 EDT; 1min 0s ago
Main PID: 5347 (mono)
Tasks: 14 (limit: 2247)
Memory: 101.0M
CGroup: /system.slice/lidarr.service
└─5347 /usr/bin/mono --debug /home/vh/Lidarr/Lidarr.exe -nobrowser
Aug 02 23:20:12 varhowto-com systemd[1]: Started Lidarr Daemon.
Aug 02 23:20:12 varhowto-com mono[5347]: [Info] Bootstrap: Starting Lidarr - /home/vh/Lidarr/Lidarr.exe - Version 0.7.1.1381
Aug 02 23:20:13 varhowto-com mono[5347]: [Info] Router: Application mode: Interactive
Aug 02 23:20:13 varhowto-com mono[5347]: [Info] MigrationLogger: *** Migrating data source=/home/vh/.config/Lidarr/lidarr.db;cache size=-10000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3 ***
Aug 02 23:20:13 varhowto-com mono[5347]: [Info] MigrationLogger: *** Migrating data source=/home/vh/.config/Lidarr/logs.db;cache size=-10000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3 ***
Aug 02 23:20:13 varhowto-com mono[5347]: [Info] OwinHostController: Listening on the following URLs:
Aug 02 23:20:13 varhowto-com mono[5347]: [Info] OwinHostController: http://*:8686/
Aug 02 23:20:13 varhowto-com mono[5347]: [Info] LidarrBootstrapper: Starting Web Server
Aug 02 23:20:14 varhowto-com mono[5347]: [Warn] MonoDebugCheck: Mono is not running with --debug switch

Stop/restart Lidarr systemd service

systemd service allows us to autostart a service like Lidarr, you can also use the following commands to stop or restart Lidarr any time, particularly if there is a problem.

To stop the lidarr systemd service, run sudo systemctl stop lidarr.service. To restart Lidarr, run sudo systemctl restart lidarr.service.

Reference

How to uninstall Lidarr

To remove Lidarr, first we disable the Lidarr service:

sudo systemctl disable lidarr.service

Then we remove the lidarr.service file we added:

sudo remove /etc/systemd/system/lidarr.service

Finally, we remove the Lidarr folder we downloaded.

rm -rf ~Lidarr/

Conclusion

Congratulations, you have learned how to install Lidarr and make it auto-start by adding the Lidarr systemd service on your Ubuntu 20.04 computer! Now you can setup Lidarr, add an indexer and download some albums you have probably bought from BestBuy, Walmart, or Target. If you want to monitor Lidarr with missing albums 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.

3 Steps to Install Lidarr on Ubuntu 20.04

Time Needed : 4 minutes

  1. Install Mono for Lidarr on Ubuntu

    Run
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF and
    echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list and
    sudo apt update && sudo apt install mono-devel

    To verify mono is installed, run mono --versionimage 49

  2. Install latest Lidarr release on Ubuntu 20.04

    To download, run curl -L -O $( curl -s https://api.github.com/repos/Lidarr/Lidarr/releases | grep linux.tar.gz | grep browser_download_url | head -1 | cut -d \" -f 4 ).

    To uncompress, run tar -xvzf Lidarr.*.linux.tar.gz.the files of Lidarr installation

  3. Start Lidarr

    Run mono ~/Lidarr/Lidarr.exe to start Lidarr. Then open http://localhost:8686/, you will see its web interface. To enable autostart with systemd service, please see the detail above.Lidarr web interface

Tools
  • Terminal
  • SSH
  • apt
Materials
  • Ubuntu 20.04

+1

By VarHowto Editor

Welcome to VarHowto!

Leave a Reply

Your email address will not be published. Required fields are marked *