My home NAS is now running Solaris 11 for the 'express' purpose (sorry) of being able to use ZFS, and all the light, joy and happiness it brings to the world of storage. I'm using three 1TB SATA disks in a RAIDZ configuration, and using ZFS's built-in filesystem compression, CIFS and NFS sharing capabilities. Since I use a PS3 as my media center front-end I need a DLNA/UPnP media server and having used Mediatomb previously on Linux, that's what I'll walk through installing from source here today.
Before starting, make sure you have GNU C compiler (gcc) and make installed. This is easily achieved using the new package management tools in Solaris 11. Try man pkg to get started.
For Mediatomb to correctly identify certain files' MIME types (like image/jpeg, for example) you need to build the GPL'd version of the file utility for a library called libmagic.
Before starting, make sure you have GNU C compiler (gcc) and make installed. This is easily achieved using the new package management tools in Solaris 11. Try man pkg to get started.
For Mediatomb to correctly identify certain files' MIME types (like image/jpeg, for example) you need to build the GPL'd version of the file utility for a library called libmagic.
tar zxvf file-5.04.tar.gzCheck for libmagic library and headers:
cd file-5.04
./configure --prefix=/usr/local
make
make install
ls /usr/local/includeNext, download the source for Mediatomb and extract it.
ls /usr/local/lib
tar zxvf mediatomb-0.12.1.tar.gzThe source code contains some apparently outdated prelink logic which breaks the build on newer versions of the OS, so we need to comment it out. You can either edit src/main.cc by hand or just use the following patch - save it to main.cc.patch0.
cd mediatomb-0.12.1
*** src/main.cc.orig 2010-12-20 13:13:11.080796210 +1000And apply the patch:
--- src/main.cc 2010-12-20 13:13:30.478542756 +1000
***************
*** 141,146 ****
--- 141,147 ----
Ref<Array<StringBase> > addFile(new Array<StringBase>());
+ /*
#ifdef SOLARIS
String ld_preload;
char *preload = getenv("LD_PRELOAD");
***************
*** 155,160 ****
--- 156,162 ----
exit(EXIT_FAILURE);
}
#endif
+ */
#ifdef HAVE_GETOPT_LONG
while (1)
patch src/main.cc < main.cc.patch0Now configure, build and install:
./configure --enable-libmagic --with-magic-h=/usr/local/include --with-magic-libs=/usr/local/libAt this stage, you could add your config files and fire up the daemon, however I'm going to create service manifests so we can manage startup and shutdown of Mediatomb via the Solaris Service Management Framework (SMF). Save this file as /lib/svc/method/svc-mediatomb.
make
make install
#!/bin/shCreate /etc/mediatomb.conf, setting appropriate values for variables above. Something like the following would suffice:
. /etc/mediatomb.conf
LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/mediatomb -d \
-u $MT_USER \
-g $MT_GROUP \
-P $MT_PIDFILE \
-l $MT_LOGFILE \
-m $MT_HOME \
-f $MT_CFGDIR \
-p $MT_PORT \
-e $MT_INTERFACE \
$MT_OPTIONS
MT_INTERFACE="rge0"Now for the service manifest - create this file as /var/svc/manifest/application/mediatomb.xml.
MT_OPTIONS=""
MT_PORT="50500"
MT_USER="media"
MT_GROUP="media"
MT_PIDFILE="/var/run/mediatomb.pid"
MT_LOGFILE="/var/log/mediatomb"
MT_HOME="/etc"
MT_CFGDIR="mediatomb"
<?xml version="1.0"?>Then validate, import and run the service:
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="mediatomb">
<service name="application/mediatomb" type="service" version="1">
<create_default_instance enabled="false"/>
<single_instance/>
<dependency name="network" grouping="require_all" restart_on="error" type="service">
<service_fmri value="svc:/milestone/network:default"/>
</dependency>
<dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
<service_fmri value="svc:/system/filesystem/local"/>
</dependency>
<exec_method type="method" name="start" exec="/lib/svc/method/svc-mediatomb" timeout_seconds="60">
</exec_method>
<exec_method type="method" name="stop" exec=":kill" timeout_seconds="5">
</exec_method>
<property_group name="startd" type="framework">
<propval name="ignore_error" type="astring" value="core,signal"/>
</property_group>
<stability value="Evolving"/>
<template>
<common_name>
<loctext xml:lang="C">
UPnP Media Server
</loctext>
</common_name>
<documentation>
<manpage title="mediatomb" section="1" manpath="/opt/local/share/man"/>
<doc_link name="mediatomb.cc" uri="http://mediatomb.cc"/>
</documentation>
</template>
</service>
</service_bundle>
svccfg validate /var/svc/manifest/application/mediatomb.xmlIf all went well you should now be able to connect to the Mediatomb web interface on port 50500.
svccfg import /var/svc/manifest/application/mediatomb.xml
svcs -a mediatomb
svcadm enable mediatomb