Roger Wilco
Explorer
- Joined
- Jul 17, 2014
- Messages
- 65
Edit by Cyberjock: This guide has been superceded by https://forums.freenas.org/index.ph...build-and-install-lms-7-9-from-scratch.27161/. This thread is locked. Please use the new guide.
Hi,
I've been reading silently for some time now, and felt like this information might be helpful to someone...
I've set up FreeNAS-9.2.1.6-RELEASE-x64 (ddd1e39) on a HP Proliant Microserver Gen8 and have as evidently many others been struggling with Squeezebox LMS.
I have absolutely no experience with FreeNAS but used to have quite enough experience with FreeBSD during the 2.x - 4.x releases.
So please feel free to comment on all the DON'Ts I did which I am not aware of :)
Anyway, as the howtos for LMS didn't work for me (djoole did a nice job for 7.8 though) I decided to get that thing running from scratch on.
This is a complete step by step howto for compiling and setting up LMS 7.8 / 7.9.0 on a 64-bit Freenas 9.2.1.6. The line numbers are for 7.9.0, so use your editor's search function to find the code blocks for 7.8...
I've used a clean FreeBSD installation inside a VM and a clean FreeNAS installation on the Microserver.
The LMS seems to run nicely, so far I have no open points regarding LMS.
Once again, some of the steps are probably for 64-bit systems only!
Prerequisites
Install a FreeBSD 64-bit inside a virtual machine.
I've used FreeBSD-9.2-RELEASE-amd64-disc1.iso
The alternative to a VM would be to build it under FreeNAS directly which should be quite straightforward too, or if you decide to build it in a jail you'll have to disable the tests (RUN_TESTS=0) in buildme.sh at least for IO::Interface (there is a hardcoded 127.0.01 check in them).
Anyway this is only about building LMS in a VM, so you might have to change some things if you do not use a VM...
Setup networking, create a user
As root in the VM:
This should not be necessary, but I did it for God's sake...
FYI, git installs perl5-5.16.3_11 as a dependency.
Check the version, because for 5.16 and above there are additional steps necessary (see below).
As user in the VM:
At line 49 replace...
... with (i.e. the path is not /usr/bin but /usr/local/bin):
At line 1110 replace...
... with (i.e. the architecture-string is wrong (might be in my case only - try without this change first)):
At line 306 replace...
with (i.e. skip the non-working tests for Font::FreeType 0.03):
(Create a tarball as a backup, so I can rm -rf and start over without thinking...)
(Copy (pipe output into tee) the build's output on stdout to a log file)
FYI, the build takes in a VM with a Macbook Pro Late 2011 as host about 10 minutes.
On success check the build.sh.log (or don't care).
I've had issues where some packages installed themselves not in the build directory under CPAN
but under a "global" directory in the user's directory (e.g. grep for the username).
For Perl >= 5.16 Class-XSAccessor-1.18 is used, otherwise it is Class-XSAccessor-1.05.
In the noCPAN-tarball there is only Class-XSAccessor-1.05, which leads to
"NOTE: Class::XSAccessor 1.05+ not found, install it for better performance" on launch of LMS.
This is because we compile the 1.18 binary module but we only have the 1.05 perl module
in the CPAN directory.
START This is for Perl >= 5.16 only
cd ~/some_dir/slimserver-vendor/CPAN/build/5.16/lib/perl5/amd64-freebsd-thread-multi/Class
tar cf ~/some_dir/xsaccessor118.tar *
END This is for Perl >= 5.16 only
Copy all three (or two for Perl < 5.16) files to your FreeNAS-box
Create a jail throught the FreeNAS GUI
Type: standard
Autostart: checked
VIMAGE: not checked
(NAT: not checked)
Vanilla: checked
As root on your FreeNAS:
FYI, UIDs / GIDs info:
I follow this scheme:
1000 < [UG]ID < 10000 are reserved for the host
10000 < [UG]ID < 20000 are reserved for jail with JID=1
20000 < [UG]ID < 30000 are reserved for jail with JID=2
and so on. This way I can immediatelly see who a process/file/... belongs to both
in a jail (name) and the host (UID).
Leave the jail
START This is for Perl >= 5.16 only
END This is for Perl >= 5.16 only
START This is for Perl >= 5.16 only
Rename the 1.05 version (which is not needed for Perl >= 5.16), and use the 1.18 version instead.
END This is for Perl >= 5.16 only
Delete all three tarballs.
Perl is not installed in the jail (but check it - should be the same version as the one in the VM)
The scanner complains about missing libintl.so.9
Leave the jail
The startup script uses command line parameters to set the
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.
In order to start LMS upon start of the jail:
That's it. Here at least, it does work...
[/b]Startup script called lms for /usr/local/etc/rc.d[/b]
Hi,
I've been reading silently for some time now, and felt like this information might be helpful to someone...
I've set up FreeNAS-9.2.1.6-RELEASE-x64 (ddd1e39) on a HP Proliant Microserver Gen8 and have as evidently many others been struggling with Squeezebox LMS.
I have absolutely no experience with FreeNAS but used to have quite enough experience with FreeBSD during the 2.x - 4.x releases.
So please feel free to comment on all the DON'Ts I did which I am not aware of :)
Anyway, as the howtos for LMS didn't work for me (djoole did a nice job for 7.8 though) I decided to get that thing running from scratch on.
This is a complete step by step howto for compiling and setting up LMS 7.8 / 7.9.0 on a 64-bit Freenas 9.2.1.6. The line numbers are for 7.9.0, so use your editor's search function to find the code blocks for 7.8...
I've used a clean FreeBSD installation inside a VM and a clean FreeNAS installation on the Microserver.
The LMS seems to run nicely, so far I have no open points regarding LMS.
Once again, some of the steps are probably for 64-bit systems only!
Prerequisites
Install a FreeBSD 64-bit inside a virtual machine.
I've used FreeBSD-9.2-RELEASE-amd64-disc1.iso
The alternative to a VM would be to build it under FreeNAS directly which should be quite straightforward too, or if you decide to build it in a jail you'll have to disable the tests (RUN_TESTS=0) in buildme.sh at least for IO::Interface (there is a hardcoded 127.0.01 check in them).
Anyway this is only about building LMS in a VM, so you might have to change some things if you do not use a VM...
Setup networking, create a user
As root in the VM:
Code:
vi /etc/rc.conf sshd_enable="YES" service sshd start rm /usr/local/etc/pkg.conf mkdir -p /usr/local/etc/pkg/repos cd /usr/local/etc/pkg/repos touch FreeBSD.conf vi FreeBSD.conf FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", mirror_type: "srv", enabled: yes } pkg update pkg install bash-4.3.18_2
This should not be necessary, but I did it for God's sake...
Code:
vi /etc/fstab fdesc /dev/fd fdescfs rw 0 0 mount -t fdescfs fdesc /dev/fd
FYI, git installs perl5-5.16.3_11 as a dependency.
Check the version, because for 5.16 and above there are additional steps necessary (see below).
Code:
pkg install git-2.0.0 pkg install gmake-3.82_1 pkg install rsync-3.1.1_2 pkg install nasm-2.11.05,1 pkg install wget-1.15
As user in the VM:
Code:
mkdir ~/some_dir cd ~/some_dir git clone https://github.com/Logitech/slimserver-vendor -b public/7.9 cd ~/some_dir/slimserver-vendor/CPAN vi buildme.sh
At line 49 replace...
Code:
if [ ! -x /usr/bin/rsync ]; then echo "This script requires /usr/bin/rsync, please install it." exit fi
... with (i.e. the path is not /usr/bin but /usr/local/bin):
Code:
if [ ! -x /usr/local/bin/rsync ]; then echo "This script requires /usr/local/bin/rsync, please install it." exit fi vi buildme.sh
At line 1110 replace...
Code:
# FreeBSD amd64 needs arch option if [ $ARCH = "amd64-freebsd" ]; then FFOPTS="$FFOPTS --arch=x64" fi
... with (i.e. the architecture-string is wrong (might be in my case only - try without this change first)):
Code:
# FreeBSD amd64 needs arch option if [ $ARCH = "amd64-freebsd-thread-multi" ]; then FFOPTS="$FFOPTS --arch=x64" fi vi buildme.sh
At line 306 replace...
Code:
if [ $RUN_TESTS -eq 1 ]; then make test else make fi
with (i.e. skip the non-working tests for Font::FreeType 0.03):
Code:
if [ $RUN_TESTS -eq 1 ]; then if [ $1 = "Font-FreeType-0.03" ]; then echo "Skipping tests for Font-FreeType-0.03" else make test fi else make fi
(Create a tarball as a backup, so I can rm -rf and start over without thinking...)
Code:
cd ~/some_dir tar cf slimserver-vendor.tar slimserver-vendor/ cd ~/some_dir/slimserver-vendor/CPAN
(Copy (pipe output into tee) the build's output on stdout to a log file)
FYI, the build takes in a VM with a Macbook Pro Late 2011 as host about 10 minutes.
Code:
./buildme.sh | tee ~/some_dir/buildme.sh.log
On success check the build.sh.log (or don't care).
I've had issues where some packages installed themselves not in the build directory under CPAN
but under a "global" directory in the user's directory (e.g. grep for the username).
Code:
cd ~/some_dir/slimserver-vendor/CPAN/build tar cf ~/some_dir/arch.tar arch/
For Perl >= 5.16 Class-XSAccessor-1.18 is used, otherwise it is Class-XSAccessor-1.05.
In the noCPAN-tarball there is only Class-XSAccessor-1.05, which leads to
"NOTE: Class::XSAccessor 1.05+ not found, install it for better performance" on launch of LMS.
This is because we compile the 1.18 binary module but we only have the 1.05 perl module
in the CPAN directory.
START This is for Perl >= 5.16 only
cd ~/some_dir/slimserver-vendor/CPAN/build/5.16/lib/perl5/amd64-freebsd-thread-multi/Class
tar cf ~/some_dir/xsaccessor118.tar *
END This is for Perl >= 5.16 only
Code:
cd ~/some_dir wget http://downloads.slimdevices.com/nightly/7.9/sc/363b797/logitechmediaserver-7.9.0-1406205019-noCPAN.tgz
Copy all three (or two for Perl < 5.16) files to your FreeNAS-box
Code:
scp arch.tar xsaccessor118.tar logitechmediaserver-7.9.0-1406205019-noCPAN.tgz someuser@1.2.3.4:/some_dir_on_freenas
Create a jail throught the FreeNAS GUI
Type: standard
Autostart: checked
VIMAGE: not checked
(NAT: not checked)
Vanilla: checked
As root on your FreeNAS:
Code:
jexec the_jails_name /bin/csh cd /usr/local/ mkdir lms
FYI, UIDs / GIDs info:
I follow this scheme:
1000 < [UG]ID < 10000 are reserved for the host
10000 < [UG]ID < 20000 are reserved for jail with JID=1
20000 < [UG]ID < 30000 are reserved for jail with JID=2
and so on. This way I can immediatelly see who a process/file/... belongs to both
in a jail (name) and the host (UID).
Code:
pw groupadd -n lms -g 20001 pw useradd -n lms -u 20001 -g lms -s /usr/sbin/nologin -c "Logitech Media Server" -d /nonexistent
Leave the jail
Code:
cp /some_dir_on_freenas/logitechmediaserver-7.9.0-1406205019-noCPAN.tgz /path_to_your_jails/lms/usr/local/lms/ cp /some_dir_on_freenas/arch.tar /path_to_your_jails/lms/usr/local/lms/
START This is for Perl >= 5.16 only
Code:
cp /some_dir_on_freenas/xsaccessor118.tar /path_to_your_jails/lms/usr/local/lms/
END This is for Perl >= 5.16 only
Code:
jexec the_jails_name /bin/csh cd /usr/local/lms tar xzf logitechmediaserver-7.9.0-1406205019-noCPAN.tgz tar xf arch.tar -C /usr/local/lms/logitechmediaserver-7.9.0-1406205019-noCPAN/CPAN/
START This is for Perl >= 5.16 only
Rename the 1.05 version (which is not needed for Perl >= 5.16), and use the 1.18 version instead.
Code:
mv /usr/local/lms/logitechmediaserver-7.9.0-1406205019-noCPAN/CPAN/Class/XSAccessor /usr/local/lms/logitechmediaserver-7.9.0-1406205019-noCPAN/CPAN/Class/_XSAccessor mv /usr/local/lms/logitechmediaserver-7.9.0-1406205019-noCPAN/CPAN/Class/XSAccessor.pm /usr/local/lms/logitechmediaserver-7.9.0-1406205019-noCPAN/CPAN/Class/_XSAccessor.pm tar xf xsaccessor118.tar -C /usr/local/lms/logitechmediaserver-7.9.0-1406205019-noCPAN/CPAN/Class/
END This is for Perl >= 5.16 only
Delete all three tarballs.
Code:
rm xsaccessor118.tar arch.tar logitechmediaserver-7.9.0-1406205019-noCPAN.tgz mv logitechmediaserver-7.9.0-1406205019-noCPAN/* . rmdir logitechmediaserver-7.9.0-1406205019-noCPAN chown -R lms:lms /usr/local/lms
Perl is not installed in the jail (but check it - should be the same version as the one in the VM)
Code:
pkg upgrade pkg install perl5-5.16.3_11
The scanner complains about missing libintl.so.9
Code:
pkg install gettext-0.18.3.1_1
Leave the jail
Code:
exit
The startup script uses command line parameters to set the
- prefs
- cache
- (playlists)
- log
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.
Code:
cp /where_ever_the_rcd_script_lies/lms /path_to_your_jails/lms/usr/local/etc/rc.d chmod 755 /path_to_your_jails/lms/usr/local/etc/rc.d/lms
In order to start LMS upon start of the jail:
Code:
echo 'lms_enable="YES"' >> /etc/rc.conf
That's it. Here at least, it does work...
[/b]Startup script called lms for /usr/local/etc/rc.d[/b]
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"
Last edited by a moderator: