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.gz cd file-5.04 ./configure --prefix=/usr/local make make installCheck for libmagic library and headers:
ls /usr/local/include ls /usr/local/libNext, download the source for Mediatomb and extract it.
tar zxvf mediatomb-0.12.1.tar.gz cd mediatomb-0.12.1The 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.
*** src/main.cc.orig 2010-12-20 13:13:11.080796210 +1000
--- 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)
And apply the patch: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/lib make make installAt 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.
#!/bin/sh . /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_OPTIONSCreate /etc/mediatomb.conf, setting appropriate values for variables above. Something like the following would suffice:
MT_INTERFACE="rge0" 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"Now for the service manifest - create this file as /var/svc/manifest/application/mediatomb.xml.
<?xml version="1.0"?> <!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>Then validate, import and run the service:
svccfg validate /var/svc/manifest/application/mediatomb.xml svccfg import /var/svc/manifest/application/mediatomb.xml svcs -a mediatomb svcadm enable mediatombIf all went well you should now be able to connect to the Mediatomb web interface on port 50500.