More > JRiver Media Center 22 for Linux

Setup Guide: Installing Media Center on FreeNAS server

(1/4) > >>

stevemac:
For the last year or so I have been looking at storage solutions for our home needs.   It needed to hold our media collection, backups from various PCs & ideally run JRiver’s MediaCenter serving multiple clients simultaneously.  I ended up choosing FreeNAS.
 
This covers the steps I took to get MediaCenter running (on a debian VM) once I had an operational FreeNAS server.  It is not about getting FreeNAS working nor about configuring shares

Caveats

* I believe you need some experience with *NIX operating systems.   Going in I had experience with vi, basic tasks like moving and copying files and modifying access and groups, reviewing the sys log etc, but I am far from being a UNIX admin.  My skills were not good enough to get everything working, but thanks to the internet and some helpful people here I managed to get through.  There are probably better / more efficient methods available than what I used
* You need to do some research on FreeNAS & get a least a basic understanding of the recommended hardware and the storage pool(s) setup (pools, vdevs etc)
* Virtual machines on FreeNAS 9.10 do not have direct access to the host’s storage.  You will need to create shares (NFS or CIFS / SMB etc)
* FreeNAS is poised to release version 10.  I believe that it will bring improved virtualisation and docker capabilities (as well as an improved GUI).  I do not know what the upgrade process will be.
* RAID is not a backup solution.  You still need to back up the data you cannot do without (or be bothered re-ripping)
* Use complex passwords (perhaps use LastPass or similar to generate / store passwords)
* I haven’t tested these instructions end to end yet (will do so & edit accordingly)
My FreeNAS server setup
VersionFreeNAS-9.10.2-U1 (86c7ef5)CPUIntel(R) Xeon(R) CPU E5620 @ 2.40GHzMotherboardIntel S5500HCVRAM24482MB (6 x 4GB ECC Registered)HBAHP/LSI 8 Port 6Gb/s External SAS HBA Controller SAS9200-8e-HPBoot Drive1 x Samsung SSDStorage Pool 1 (Media / backups)4 x 6TB WD Red NAS drives in 2 vdevs.  Each vdev consists of 2 drives mirroredStorage Pool 2 (Surveillance)1 x 1TB HDD
Aside from the Hard Drives all components were sourced on the secondhand market.  The hardware has been running without issue for several months
You can install the OS onto USB sticks.  I originally had this, but the USB sticks failed so have moved to an SSD
Backup your FreeNAS configuration regularly

I run multiple VMs, one of which is for mediacenter.  I ensure the UID & GIDs for common users are the same across the VMs

The jriver benchmark score for the Virtual machine is JRMark (version 22.0.71): 2049

Resources
I could not have got this working without help from other forum members, the FreeNAS forum and articles on the internet.  Some references

FreeNAS
 Forum - https://forums.freenas.org/index.php#freenas-forum.1
 Hardware - will it FreeNAS - https://forums.freenas.org/index.php?forums/will-it-freenas-freenas-build-discussion.70/

iohyve
 configuration and virtual machine installation - https://www.youtube.com/watch?v=rCDh9K16Q5Q

MediaCenter
 Config for Debian (Awesome Donkey) - https://yabb.jriver.com/interact/index.php/topic,105985.0.html
 x11vnc and jriver Services (mwilliams) - https://yabb.jriver.com/interact/index.php/topic,108981.0.html
 headless config (bob) - https://yabb.jriver.com/interact/index.php/topic,109419.0.html

Installation Summary

1. Configure iohyve on FreeNAS, build the virtual machine

* iohyve - install
* iohyve - fetch the OS image
* iohyve - Define the Virtual Machine (disk space)
* iohyve - set the VM’s CPU, RAM, OS type and loader
* iohyve - Build / configure the VM
* iohyve – set the VM to start automatically
2. Fix the UID / GIDs on the VM (optional?)
3. Install some packages on the VM
4. Configure lightdm, xorg and x11vnc for headless operation (thanks mwilliams, bob)
5. Create service to start x11vnc on boot, restart if fails (thanks mwilliams)
6. Mount required NAS shares
7. Install JRiver MediaCenter (thanks Awesome Donkey)
8. Configure MediaCenter as per your preferences (import files, views, DLNA servers etc)
9. Configure services for autostart & restart of mediacenter (thanks mwilliams, bob)
10. Secure x11vnc (using ssh) - optional
11. Accessing mediacenter from the WAN (Internet) - optional


stevemac:
If you haven't used iohyve before I recommend you look at the youtube video and take some notes https://www.youtube.com/watch?v=rCDh9K16Q5Q

Prerequisites

* Decide which storage pool iohyve and the VMs will reside in
* Enable terminal access on FreeNAS root account (you can disable it later if desired)
* Need the network interface identifier in FreeNAS
* Might need an app to access the terminal service.  I use pUTTY
Need to add some images of the freenas UI (for pool name and network interface details)

Access the FreeNAS server via a terminal session using the root account

Inital Setup of iohyve on Freenas
This can be skipped if iohyve is already configured
The command to configure the hypervisor is iohyve setup pool = {storage pool name} kmod = 1 net = {Network Interface}
In my case the pool is name “MacJones_pool1” and the network interface is “lagg0” the command is
[/list]
--- Code: ---iohyve setup pool = MacJones_pool1 kmod = 1 net = lagg0

--- End code ---

Set some FreeNAS tunables
This will ensure the iohyve setup is enabled on a restart of the FreeNAS server.  It can be skipped if iohyve has already been configured / tunables are already present
The entry related to net=lagg0 should be changed to refer to the network interface specified in the iohyve installation
VariableValueTypeiohyve_enableYESrc.confiohyve_flagskmod =1 net=lagg0rc.conf
Need to add some images of the freenas UI (Tunables section)

Fetch the operating system that will be used on the virtual machine
iohyve must have the OS image available before it can be used to build a VM.  In this case I used the debian 8 OS as that is the default / recommended distro for mediacenter

You can fetch it from a local respository or from the internet.  In my case I already had it available on the FreeNAS server
The command is iohyve fetch {location}

--- Code: ---iohyve fetch /mnt/MacJones_pool1/ISOImages/debian-8.6.0-amd64-netinst.iso

--- End code ---

Pulling it directly from the debian site should be as simple as getting the url for the most recent debian 8 version & then executing the iohyve fetch command.  As an example

--- Code: ---iohyve fetch http://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-8.7.1-amd64-netinst.iso

--- End code ---

**Note the current version is more recent than the one I had locally

Define the Virtual Machine
This sets the VM name and the disk allocation
The command is iohyve create {name} {disk allocation}
In my case I named the VM "deb64vm003" and wanted 32GB of disk.  The command was

--- Code: ---iohyve create deb64vm003 32G

--- End code ---

Set the VM's attributes
This set the VMs attributes (CPU, RAM, OS type, Loader).  It done via the iohyve set command and can be issued individually or as a group.  In my case I allocated 2 CPU, 4GB RAM, set the OS to be debian, set the boot loader to grub_bhyve & set the description to JRiver MediaCenter

The command syntax is iohyve set {vm name} {one or more attribute / value pairs}

In my case

--- Code: ---iohyve set deb64vm003 ram=4096 cpu=2 os=debian loader=grub-bhyve description= jRiver_Media_Center

--- End code ---

Build / Configure the VM
Next we have to get iohyve to install the OS onto the VM.  This is done using the iohyve install command.  The syntax is iohyve install {VM name} {image name}

In my case the vm = deb64vm003 and the image = debian-8.6.0-amd64-netinst.iso


--- Code: ---iohyve install deb64vm003 debian-8.6.0-amd64-netinst.iso

--- End code ---

To complete the OS installation you need to start another terminal session (as root) with the FreeNAS server and open the iohyve console for the VM.  The command for the console is iohyve console {VM name}


--- Code: ---iohyve console deb64vm003

--- End code ---

Complete the debian 8 installation (it will take some time - especially if slow internet connection).  Of note

* I make the hostname the same as the VM name
* Choose a good mirror.  In Australia I use the iiNet mirror
* As part of the install choose xfce and ssh
* I get the install to create an account named ‘jriver’
Once the installation has completed OK......


Set the VM so that it automatically starts 
The command is iohyve set {VM name} boot=1

--- Code: ---iohyve set deb64vm003 boot=1

--- End code ---

Start the VM
The iohyve command is iohyve start {VM Name}


--- Code: ---iohyve start deb64vm003

--- End code ---


At this stage the VM should be OK.  There is no graphical console (yet).  Access is via a terminal session

* Test that you can access the Vm via a terminal session
* Restart FreeNAS to ensure iohyve and the VM start on reboot
Useful iohyve commands
iohyve list: lists all defined VMs & current status

--- Code: ---[root@freenas] ~# iohyve list
Guest       VMM?  Running  rcboot?  Description
deb64vm003  YES   YES      YES      jRiver_Media_Center
deb64vm004  YES   YES      NO       Wed Jan 25 08:37:29 AEDT 2017
[root@freenas] ~#

--- End code ---

iohyve getall {vm name} - lists all the attributes set for that vm

--- Code: ---[root@freenas] ~# iohyve getall deb64vm003
Getting deb64vm003 iohyve properties...
20160122       20160122
bargs          -A_-H_-P
boot           1
con            nmdm0
cpu            2
description    jRiver_Media_Center
install        no
loader         grub-bhyve
name           deb64vm003
os             debian
persist        1
ram            4096
size           32G
tap            tap0
template       NO
vnc            NO
vnc_h          600
vnc_ip         127.0.0.1
vnc_tablet     NO
vnc_w          800
vnc_wait       NO
[root@freenas] ~#

--- End code ---

iohyve start {vm name} - starts the specified VM if not already running
iohyve stop {vm name} - stops the specified VM
iohyve console {vm name} - starts a terminal session with the VM's console

stevemac:
I like to keep the UIDs and GID the same across my VMs.  It may not be required, but suspect it will make access the host’s storage easier (once FreeNAS has this functionality)

The following instructions were taken from https://muffinresearch.co.uk/linux-changing-uids-and-gids-for-user/

You will need the user name, current UID and GID and the values you want them to be

Logon to the VM via a terminal session.  You need to be root
usermod -u <NEWUID> <LOGIN>
groupmod -g <NEWGID> <GROUP>
find / -user <OLDUID> -exec chown -h <NEWUID> {} \;
find / -group <OLDGID> -exec chgrp -h <NEWGID> {} \;
usermod -g <NEWGID> <LOGIN>

stevemac:
We need to install additional packages to get a graphical console working.  sudo is installed to make life easier

Install the following on the VM: sudo, x11vnc, xserver-xorg-video-dummy. 

Logon to the VM via a terminal session.  I prefer to use the jriver account created during the OS installation and elevate my privileges via su

As an example

--- Code: ---root@deb64vm003:/home/jriver# apt-get install sudo xserver-xorg-video-dummy x11vnc

--- End code ---

Once completed add the user account specified in the VM build (in my case jriver) to the groups sudo and adm (note adm appears to be required to get x11vnc to start on boot). 

As an example

--- Code: ---usermod -a -G adm,sudo jriver

--- End code ---

stevemac:
The following steps are used to create a graphical console.  MediaCenter requires one (even in mediaserver mode)

I had major issues getting the graphical console to work.  Most stem from my lack of knowledge on how the x-server works.   Thanks to mwilliams for taking the time to help me out.  Great assistance with troubleshooting and configuration settings

iohyve doesn’t present a graphical console for its VMs.  This is why I installed xserver-xorg-video-dummy.

Bob has since created a thread for the xorg.conf file (https://yabb.jriver.com/interact/index.php/topic,109419.0.html).  I’d recommend you use his method

the xorg.conf file I currently use is listed below.  I'll be changing mine to match Bob's


--- Code: ---jriver@deb64vm003:~$ cat /etc/X11/xorg.conf
# This xorg configuration file is meant to be used
# to start a dummy X11 server.
# For details, please see:
# https://www.xpra.org/xorg.conf
# obtained from http://cosmolinux.no-ip.org/raconetlinux2/dummy_radeon_nvidia.html

# Here we setup a Virtual Display of 1600x900 pixels

Section "Device"
    Identifier "Configured Video Device"
    Driver "dummy"
    #VideoRam 4096000
    VideoRam 256000
    #VideoRam 16384
EndSection

Section "Monitor"
    Identifier "Configured Monitor"
    HorizSync 5.0 - 1000.0
    VertRefresh 5.0 - 200.0
    #Modeline "1600x900" 33.92 1600 1632 1760 1792 900 921 924 946
    #1368x768 @ 60.00 Hz (GTF) hsync: 47.70 kHz; pclk: 85.86 MHz
    Modeline "1368x768_60.00" 85.86 1368 1440 1584 1800 768 769 772 795 -HSync +Vsync
    #1920x1080 @ 60.00 Hz (GTF) hsync: 67.08 kHz; pclk: 172.80 MHz
    #Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync


EndSection

Section "Screen"
    Identifier "Default Screen"
    Monitor "Configured Monitor"
    Device "Configured Video Device"
    DefaultDepth 24
    SubSection "Display"
        Viewport 0 0
        Depth 24
        Virtual 1600 900
    EndSubSection
EndSection

jriver@deb64vm003:~$

--- End code ---

x11vnc setup
As the jriver user execute x11vnc -storepasswd.  This will prompt you to set and confirm a password for VNC and notify the path the password will be saved in.  The path is important as it it referenced in the x11vnc.service file later on.  The default path and file is /home/jriver/.vnc/passwd

Initial setup is not securing the VNC session over SSH.  I chose to do it this way & once everything is working OK to change the x11vnc config to secure it

lightdm config
mwilliams advised to uncomment the following settings and set the user id for the autologin-user (in my case the user id that was specified in the OS installation)
pam-autologin-service=lightdm-autologin
autologin-user=jriver
autologin-user-timeout=0

My lightdm config is

--- Code: ---jriver@deb64vm003:~$ cat /etc/lightdm/lightdm.conf
#
# General configuration
#
# start-default-seat = True to always start one seat if none are defined in the configuration
# greeter-user = User to run greeter as
# minimum-display-number = Minimum display number to use for X servers
# minimum-vt = First VT to run displays on
# lock-memory = True to prevent memory from being paged to disk
# user-authority-in-system-dir = True if session authority should be in the system location
# guest-account-script = Script to be run to setup guest account
# logind-load-seats = True to automatically set up multi-seat configuration from logind
# logind-check-graphical = True to on start seats that are marked as graphical by logind
# log-directory = Directory to log information to
# run-directory = Directory to put running state in
# cache-directory = Directory to cache to
# sessions-directory = Directory to find sessions
# remote-sessions-directory = Directory to find remote sessions
# greeters-directory = Directory to find greeters
#
[LightDM]
#start-default-seat=true
#greeter-user=lightdm
#minimum-display-number=0
#minimum-vt=7
#lock-memory=true
#user-authority-in-system-dir=false
#guest-account-script=guest-account
#logind-load-seats=false
#logind-check-graphical=false
#log-directory=/var/log/lightdm
#run-directory=/var/run/lightdm
#cache-directory=/var/cache/lightdm
#sessions-directory=/usr/share/lightdm/sessions:/usr/share/xsessions
#remote-sessions-directory=/usr/share/lightdm/remote-sessions
#greeters-directory=/usr/share/lightdm/greeters:/usr/share/xgreeters

#
# Seat defaults
#
# type = Seat type (xlocal, xremote)
# xdg-seat = Seat name to set pam_systemd XDG_SEAT variable and name to pass to X server
# pam-service = PAM service to use for login
# pam-autologin-service = PAM service to use for autologin
# pam-greeter-service = PAM service to use for greeters
# xserver-command = X server command to run (can also contain arguments e.g. X -special-option)
# xserver-layout = Layout to pass to X server
# xserver-config = Config file to pass to X server
# xserver-allow-tcp = True if TCP/IP connections are allowed to this X server
# xserver-share = True if the X server is shared for both greeter and session
# xserver-hostname = Hostname of X server (only for type=xremote)
# xserver-display-number = Display number of X server (only for type=xremote)
# xdmcp-manager = XDMCP manager to connect to (implies xserver-allow-tcp=true)
# xdmcp-port = XDMCP UDP/IP port to communicate on
# xdmcp-key = Authentication key to use for XDM-AUTHENTICATION-1 (stored in keys.conf)
# unity-compositor-command = Unity compositor command to run (can also contain arguments e.g. unity-system-compositor -special-option)
# unity-compositor-timeout = Number of seconds to wait for compositor to start
# greeter-session = Session to load for greeter
# greeter-hide-users = True to hide the user list
# greeter-allow-guest = True if the greeter should show a guest login option
# greeter-show-manual-login = True if the greeter should offer a manual login option
# greeter-show-remote-login = True if the greeter should offer a remote login option
# user-session = Session to load for users
# allow-user-switching = True if allowed to switch users
# allow-guest = True if guest login is allowed
# guest-session = Session to load for guests (overrides user-session)
# session-wrapper = Wrapper script to run session with
# greeter-wrapper = Wrapper script to run greeter with
# guest-wrapper = Wrapper script to run guest sessions with
# display-setup-script = Script to run when starting a greeter session (runs as root)
# display-stopped-script = Script to run after stopping the display server (runs as root)
# greeter-setup-script = Script to run when starting a greeter (runs as root)
# session-setup-script = Script to run when starting a user session (runs as root)
# session-cleanup-script = Script to run when quitting a user session (runs as root)
# autologin-guest = True to log in as guest by default
# autologin-user = User to log in with by default (overrides autologin-guest)
# autologin-user-timeout = Number of seconds to wait before loading default user
# autologin-session = Session to load for automatic login (overrides user-session)
# autologin-in-background = True if autologin session should not be immediately activated
# exit-on-failure = True if the daemon should exit if this seat fails
#
[SeatDefaults]
#type=xlocal
#xdg-seat=seat0
#pam-service=lightdm
pam-autologin-service=lightdm-autologin
#pam-greeter-service=lightdm-greeter
#xserver-command=X
#xserver-layout=
#xserver-config=
#xserver-allow-tcp=false
#xserver-share=true
#xserver-hostname=
#xserver-display-number=
#xdmcp-manager=
#xdmcp-port=177
#xdmcp-key=
#unity-compositor-command=unity-system-compositor
#unity-compositor-timeout=60
#greeter-session=example-gtk-gnome
#greeter-hide-users=false
#greeter-allow-guest=true
#greeter-show-manual-login=false
#greeter-show-remote-login=true
#user-session=default
#allow-user-switching=true
#allow-guest=true
#guest-session=
#session-wrapper=lightdm-session
#greeter-wrapper=
#guest-wrapper=
#display-setup-script=
#display-stopped-script=
#greeter-setup-script=
#session-setup-script=
#session-cleanup-script=
#autologin-guest=false
autologin-user=jriver
autologin-user-timeout=0
#autologin-in-background=false
#autologin-session=UNIMPLEMENTED
#exit-on-failure=false

#
# Seat configuration
#
# Each seat must start with "Seat:".
# Uses settings from [SeatDefaults], any of these can be overriden by setting them in this section.
#
#[Seat:0]

#
# XDMCP Server configuration
#
# enabled = True if XDMCP connections should be allowed
# port = UDP/IP port to listen for connections on
# key = Authentication key to use for XDM-AUTHENTICATION-1 or blank to not use authentication (stored in keys.conf)
#
# The authentication key is a 56 bit DES key specified in hex as 0xnnnnnnnnnnnnnn.  Alternatively
# it can be a word and the first 7 characters are used as the key.
#
[XDMCPServer]
#enabled=false
#port=177
#key=

#
# VNC Server configuration
#
# enabled = True if VNC connections should be allowed
# command = Command to run Xvnc server with
# port = TCP/IP port to listen for connections on
# width = Width of display to use
# height = Height of display to use
# depth = Color depth of display to use
#
[VNCServer]
#enabled=false
#command=Xvnc
#port=5900
#width=1024
#height=768
#depth=8
jriver@deb64vm003:~$

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version