1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-21 15:22:27 +00:00
0 Installation (FreeBSD FreeNAS)
Qstick edited this page 2019-09-08 14:38:57 -04:00

contribution by samslice841635

I installed Lidarr in a FreeNAS jail. My installation is specifically on a FreeNAS 11.1 rig. FreeNAS is built on top of FreeBSD, and although these are the steps I used to install Lidarr in a FreeNAS jail, this guide should work for any FreeBSD-based scenario. This guide assumes this installation is being performed on another machine via an SSH terminal (PuTTY) from another computer.

Prep Work

  1. Create a user for your Lidarr daemon to run as
    pw useradd lidarr -d /nonexistent
  2. Intall necessary bits. If you're installing this on a system/jail that is already running Sonarr and/or Radarr, mono and sqlite3 should already be installed.
    pkg install wget nano mono sqlite3
  3. cd into the directory you wish to drop Lidarr into. This is 100% personal preference.
    cd /usr/local/share

Download and Setup

  1. Back your desktop, launch your internet browser of choice and go to https://github.com/lidarr/Lidarr/releases
  2. Right-click on the Lidar.develop.x.x.x.xxx.linux.tar.gz file and select "Copy link location" (verbiage may vary from browser to browser)
  3. Back in your SSH window, (assuming you're still in the directory you wish to install Lidarr into) type wget and paste the link you copied from your internet browser
    wget https://github.com/lidarr/Lidarr/releases/download/vX.X.X.XXXX/Lidarr.develop.X.X.X.XXXX.linux.tar.gz
  4. Once downloaded, the g-zipped tarball needs to be extracted
    tar -xvf Lidarr.develop.0.x.x.x.xxx.linux.tar.gz
  5. Verify the tarball extracted properly into the Lidarr directory
    ls -l Lidarr/
  6. Delete the tarball
    rm Lidarr.develop.*.linux.tar.gz

Setting Up The Daemon

  1. CD into your rc.d directory (YMMV)
    cd /usr/local/etc/rc.d
  2. Now we need to create an rc.d script to run Lidarr as a daemon
    nano lidarr
  3. Go to the section at the end of this guide labeled "Daemon Script". You'll need to copy and paste my example into your new lidarr file, adjusting any paths you need to adjust.
  4. Once you've got your lidarr file created and filled out, we need to make sure the ownership and permissions are correct and verify
    chmod +x lidarr && ls -Fl lidarr
  5. Output should look like the below (note the permissions and the * at the end of the file name)
    -rwxr-xr-x 1 root wheel 756 Jan 11 19:42 lidarr*
  6. Now, add your new rc.d script to the startup
    echo 'lidarr_enable="YES"' >> /etc/rc.conf
  7. Start the service
    service lidarr start
  8. Navigate to your new Lidarr service in your browser and enjoy!
    http://ip_addr:8686

Daemon Script

Pay attention to lines 23, 27, and 30 (look for the comment lines immediately above). These lines have directories and executable locations that may need to be adjusted based on your own system's setup. This is the file that works on my individual installation. YMMV

#!/bin/sh
#
# Author: Jarod Sams
#

# PROVIDE: lidarr
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable lidarr:
# lidarr_enable="YES"

. /etc/rc.subr

name="lidarr"
rcvar=lidarr_enable

load_rc_config $name

: ${lidarr_enable="NO"}
: ${lidarr_user:="lidarr"}
# This next directory can be changed to whatever you want
: ${lidarr__data_dir:="/usr/local/lidarr"}

pidfile="${lidarr__data_dir}/lidarr.pid"
# You may need to adjust the mono location if your mono executable is somewhere else
procname="/usr/local/bin/mono"
command="/usr/sbin/daemon"
# The directory laid out in the next line will need to be changed if your Lidarr directory is elsewhere
command_args="-f ${procname} /usr/local/share/Lidarr/Lidarr.exe --nobrowser --data=${lidarr__data_dir}"    
start_precmd=lidarr_precmd

lidarr_precmd()
{
	export XDG_CONFIG_HOME=${lidarr__data_dir}

	if [ ! -d ${lidarr__data_dir} ]; then
		install -d -o ${lidarr_user} ${lidarr__data_dir}
	fi
}

run_rc_command "$1"