Roger Wilco
Explorer
- Joined
- Jul 17, 2014
- Messages
- 65
Hi,
This is about building and installing the LMS 7.9. inside a jail.
It supersedes the procedure described in
https://forums.freenas.org/index.ph...8-7-9-for-freenas-9-2-1-6-from-scratch.22359/
Prerequisites:
- A running 9.3 installation
- Willingness to do things on the CLI
I've used two jails here:
- A temporary jail for building, called build_jail in this howto
- The "real" jail where LMS is to be run, called install_jail in this howto
The referred versions of various packages have been current on 26th January 2015. They will change in the future.
- Create the install_jail (VIMAGE checked)
- Create the build_jail (VIMAGE checked)
- Make sure both jails are running
Inside build_jail:
Ignore the fdescfs message bash complains about.
From http://downloads.slimdevices.com/nightly/index.php?ver=7.9 download "Logitech Media Server: Unix Tarball (for Perl 5.8-5.18, i386, x86_64, i386 FreeBSD, ARM EABI, PowerPC)" (the build number may be different now):
Get the build sources:
The buildme.sh script does not require modifications anymore, so build the whole thing:
The build output is logged in /tmp/somedir/buildme.sh.log so it might be a good idea to check it for errors or warnings...
Copy the build into the downloaded LMS package:
As of 26.01.2015 the used perl package is 5.18 (This might change to 5.20 one day). In case the build succeeded under a different perl version, do not copy it under the 5.18 branch, but under the branch of the version you were using...
Remove the other build targets for the used perl perl version (5.18 here):
Remove the unused perl branches:
Tar the modified LMS package:
Exit build_jail
Copy the tarball into the install_jail:
Inside install_jail:
Create a user and group under which the LMS-process will be running. I use lms with id 30001. If you change the user or group name do not forget to change it in the startup script (see below), too.
Create the installation directory:
Extract the tarball from the jails /tmp directory into the installation directory and copy the files around:
Change owner and group to lms:
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
From here on the howto has been modified. You can still use the steps below, but I would suggest using this post.
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Create the startup file /usr/local/etc/rc.d/lms with the following content:
FYI: The startup script uses command line parameters to set the
* prefs
* cache
* (playlists)
* log
directories below /var, i.e. it creates the directories and sets the permissions, so that
the lms process (running as user lms) can use them. Unfortunatelly there is no parameter for
the playlists directory, but one can set it up during the initial setup in the web interface.
Finally set the owner and permissions of the startup script, and make the lms service start during jail startup:
This is about building and installing the LMS 7.9. inside a jail.
It supersedes the procedure described in
https://forums.freenas.org/index.ph...8-7-9-for-freenas-9-2-1-6-from-scratch.22359/
Prerequisites:
- A running 9.3 installation
- Willingness to do things on the CLI
I've used two jails here:
- A temporary jail for building, called build_jail in this howto
- The "real" jail where LMS is to be run, called install_jail in this howto
The referred versions of various packages have been current on 26th January 2015. They will change in the future.
- Create the install_jail (VIMAGE checked)
- Create the build_jail (VIMAGE checked)
- Make sure both jails are running
Inside build_jail:
Code:
pkg update pkg upgrade pkg install bash-4.3.33 pkg install gmake-4.1_1 pkg install rsync-3.1.1_3 pkg install nasm-2.11.06,1 pkg install wget-1.16 pkg install libgd-2.1.0_5,1
Ignore the fdescfs message bash complains about.
Code:
mkdir /tmp/somedir cd /tmp/somedir
From http://downloads.slimdevices.com/nightly/index.php?ver=7.9 download "Logitech Media Server: Unix Tarball (for Perl 5.8-5.18, i386, x86_64, i386 FreeBSD, ARM EABI, PowerPC)" (the build number may be different now):
Code:
wget http://downloads.slimdevices.com/nightly/7.9/sc/17d0715/logitechmediaserver-7.9.0-1421917265.tgz tar xf logitechmediaserver-7.9.0-1421917265.tgz
Get the build sources:
Code:
git clone https://github.com/Logitech/slimserver-vendor -b public/7.9
The buildme.sh script does not require modifications anymore, so build the whole thing:
Code:
cd /tmp/somedir/slimserver-vendor/CPAN ./buildme.sh | tee /tmp/somedir/buildme.sh.log
The build output is logged in /tmp/somedir/buildme.sh.log so it might be a good idea to check it for errors or warnings...
Copy the build into the downloaded LMS package:
Code:
cd /tmp/somedir/logitechmediaserver-7.9.0-1421917265/CPAN/arch/5.18 cp -Rp /tmp/somedir/slimserver-vendor/CPAN/build/arch/5.18/amd64-freebsd-thread-multi .
As of 26.01.2015 the used perl package is 5.18 (This might change to 5.20 one day). In case the build succeeded under a different perl version, do not copy it under the 5.18 branch, but under the branch of the version you were using...
Remove the other build targets for the used perl perl version (5.18 here):
Code:
cd /tmp/somedir/logitechmediaserver-7.9.0-1421917265/CPAN/arch/5.18 rm -rf i386-linux-thread-multi rm -rf i386-linux-thread-multi-64int rm -rf x86_64-linux-thread-multi
Remove the unused perl branches:
Code:
cd /tmp/somedir/logitechmediaserver-7.9.0-1421917265/CPAN/arch rm -rf 5.8 rm -rf 5.10 rm -rf 5.12 rm -rf 5.14 rm -rf 5.16 rm -rf 5.20
Tar the modified LMS package:
Code:
cd /tmp/somedir tar cf logitechmediaserver-7.9.0-1421917265_with_fbsd.tar logitechmediaserver-7.9.0-1421917265
Exit build_jail
Copy the tarball into the install_jail:
Code:
cp /path/to/build_jail/tmp/somedir/logitechmediaserver-7.9.0-1421917265_with_fbsd.tar /path/to/install_jail/tmp
Inside install_jail:
Code:
pkg update pkg upgrade
Create a user and group under which the LMS-process will be running. I use lms with id 30001. If you change the user or group name do not forget to change it in the startup script (see below), too.
Code:
pw groupadd -n lms -g 30001 pw useradd -n lms -u 30001 -g lms -s /usr/sbin/nologin -c "Logitech Media Server" -d /nonexistent
Create the installation directory:
Code:
mkdir /usr/local/lms
Extract the tarball from the jails /tmp directory into the installation directory and copy the files around:
Code:
tar xf /tmp/logitechmediaserver-7.9.0-1421917265_with_fbsd.tar -C /usr/local/lms mv /usr/local/lms/logitechmediaserver-7.9.0-1421917265/* /usr/local/lms rmdir /usr/local/lms/logitechmediaserver-7.9.0-1421917265
Change owner and group to lms:
Code:
chown -R lms:lms /usr/local/lms
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
From here on the howto has been modified. You can still use the steps below, but I would suggest using this post.
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Create the startup file /usr/local/etc/rc.d/lms with the following content:
Code:
#!/bin/sh # # This script is a slightly modified version with hardcoded values of: # $FreeBSD: branches/RELENG_9_2_0/audio/squeezeboxserver/files/squeezeboxserver.in 302141 2012-08-05 23:19:36Z dougb $ # # PROVIDE: lms # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable lms: # #lms_enable="YES" # . /etc/rc.subr name=lms start_precmd="lms_start_precmd" stop_postcmd="lms_stop_postcmd" rcvar=lms_enable command=/usr/local/lms/slimserver.pl command_interpreter=/usr/bin/perl pidfile=/var/run/${name}/${name}.pid logdir=/var/log/${name} statedir=/var/db/${name} cachedir=${statedir}/cache prefsdir=${statedir}/prefs playlistdir=${statedir}/playlists charset=UTF-8 u=lms g=lms command_args="--daemon --pidfile=${pidfile} --logdir=${logdir} --cachedir=${cachedir} --prefsdir=${prefsdir} --charset=${charset}" lms_user=${u} lms_group=${g} lms_start_precmd() { # This is stuff is here and not in pkg-install because # /var/run may be destroyed at any time and we've had issues # with permissions on the various directories under /var getting # screwed up in the past. mkdir -p /var/run/${name} chown -RH ${u}:${g} /var/run/${name} mkdir -p ${logdir} chown -RH ${u}:${g} ${logdir} mkdir -p ${statedir} mkdir -p ${cachedir} mkdir -p ${prefsdir} mkdir -p ${playlistdir} chown -RH ${u}:${g} ${statedir} export LC_CTYPE=en_US.UTF-8 } lms_stop_postcmd() { pids=`pgrep -u $u` if [ -n "${pids}" ]; then sleep 1 kill $pids > /dev/null 2>&1 fi pids=`pgrep -u $u` if [ -n "${pids}" ]; then wait_for_pids $pids fi } load_rc_config ${name} lms_enable=${lms_enable:-"NO"} lms_flags=${lms_flags:-""} run_rc_command "$1"
FYI: The startup script uses command line parameters to set the
* prefs
* cache
* (playlists)
* log
directories below /var, i.e. it creates the directories and sets the permissions, so that
the lms process (running as user lms) can use them. Unfortunatelly there is no parameter for
the playlists directory, but one can set it up during the initial setup in the web interface.
Finally set the owner and permissions of the startup script, and make the lms service start during jail startup:
Code:
chown root:wheel /usr/local/etc/rc.d/lms chmod 555 /usr/local/etc/rc.d/lms echo 'lms_enable="YES"' >> /etc/rc.conf
Last edited: