This howto describes how to install MediaTomb, a free/opensource UPnP Media Server on OpenSolaris/OpenIndiana.
Basic installation
root@test:~# pkg install developer/build/gnu-make system/library/math/header-math wget gcc-43 expat
Packages to install: 14
Create boot environment: No
DOWNLOAD PKGS FILES XFER (MB)
Completed 14/14 912/912 58.1/58.1
PHASE ACTIONS
Install Phase 1367/1367
PHASE ITEMS
Package State Update Phase 14/14
Image State Update Phase 2/2
root@test:~# PATH=$PATH:/usr/gcc/4.3/bin
Install SpiderMonkey
You can find the required steps to install the SpiderMonkey JS Library in this previous post: SpiderMonkey on OpenSolaris
Install libmagic
Next we have to install libmagic which is used to detect file-types. You can find the current version on this ftp server:
ftp.astron.com
root@test:~# cd /tmp
root@test:/tmp# wget ftp://ftp.astron.com/pub/file/file-5.11.tar.gz
--2012-04-12 04:42:21-- ftp://ftp.astron.com/pub/file/file-5.11.tar.gz
=> `file-5.11.tar.gz'
Resolving ftp.astron.com (ftp.astron.com)... 208.77.212.98, 38.117.134.204
Connecting to ftp.astron.com (ftp.astron.com)|208.77.212.98|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /pub/file ... done.
==> SIZE file-5.11.tar.gz ... 610019
==> PASV ... done. ==> RETR file-5.11.tar.gz ... done.
Length: 610019 (596K) (unauthoritative)
100%[================================================>] 610,019 552K/s in 1.1s
2012-04-12 04:42:26 (552 KB/s) - `file-5.11.tar.gz' saved [610019]
root@test:/tmp# tar xf file-5.11.tar.gz
root@test:/tmp# cd file-5.11
root@test:/tmp/file-5.11# ./configure --prefix=/opt/local
checking for a BSD-compatible install... ./install-sh -c
checking whether build environment is sane... yes
...
root@test:/tmp/file-5.11# gmake
gmake all-recursive
gmake[1]: Entering directory `/tmp/file-5.11'
Making all in src
gmake[2]: Entering directory `/tmp/file-5.11/src'
...
root@test:/tmp/file-5.11# gmake install
Making install in src
gmake[1]: Entering directory `/tmp/file-5.11/src'
gmake[2]: Entering directory `/tmp/file-5.11/src'
...
Install taglib
Taglib is a library for reading meta-data of audio files (e.g. ID3-Tags).
root@test:/tmp/file-5.11# cd /tmp
root@test:/tmp# wget http://developer.kde.org/~wheeler/files/src/taglib-1.5.tar.gz
--2012-04-12 04:44:46-- http://developer.kde.org/~wheeler/files/src/taglib-1.5.tar.gz
Resolving developer.kde.org (developer.kde.org)... 212.110.188.12, 2001:41c8:1:6043::12
Connecting to developer.kde.org (developer.kde.org)|212.110.188.12|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1394506 (1.3M) [application/x-gzip]
Saving to: `taglib-1.5.tar.gz'
100%[================================================>] 1,394,506 1.27M/s in 1.0s
2012-04-12 04:44:47 (1.27 MB/s) - `taglib-1.5.tar.gz' saved [1394506/1394506]
root@test:/tmp# tar xf taglib-1.5.tar.gz
root@test:/tmp# cd taglib-1.5
root@test:/tmp/taglib-1.5# ./configure --prefix=/opt/local
checking build system type... i386-pc-solaris2.11
checking host system type... i386-pc-solaris2.11
...
root@test:/tmp/taglib-1.5# gmake
gmake all-recursive
gmake[1]: Entering directory `/tmp/taglib-1.5'
Making all in taglib
gmake[2]: Entering directory `/tmp/taglib-1.5/taglib'
...
root@test:/tmp/taglib-1.5# gmake install
Making install in taglib
gmake[1]: Entering directory `/tmp/taglib-1.5/taglib'
...
Install MediaTomb
Now that we have all required dependencies running, we can install MediaTomb.
root@test:/tmp/taglib-1.5# cd /tmp
root@test:/tmp# wget http://downloads.sourceforge.net/mediatomb/mediatomb-0.12.1.tar.gz
--2012-04-12 04:47:02-- http://downloads.sourceforge.net/mediatomb/mediatomb-0.12.1.tar.gz
Resolving downloads.sourceforge.net (downloads.sourceforge.net)... 216.34.181.59
...
Length: 1240612 (1.2M) [application/x-gzip]
Saving to: `mediatomb-0.12.1.tar.gz'
100%[================================================>] 1,240,612 907K/s in 1.3s
2012-04-12 04:47:04 (907 KB/s) - `mediatomb-0.12.1.tar.gz' saved [1240612/1240612]
root@test:/tmp# tar xf mediatomb-0.12.1.tar.gz
root@test:/tmp# cd mediatomb-0.12.1
root@test:/tmp/mediatomb-0.12.1# ./configure --prefix=/opt/local \
--with-js-h=/opt/local/include \
--with-js-libs=/opt/local/lib \
--enable-libmagic \
--with-libmagic-h=/opt/local/include \
--with-libmagic-libs=/opt/local/lib \
--with-taglib-cfg=/opt/local/bin/taglib-config
checking for a BSD-compatible install... configure_aux/install-sh -c
checking whether build environment is sane... yes
...
If everything is fine, you should see the following summary:
CONFIGURATION SUMMARY ----
sqlite3 : yes
mysql : missing
libjs : yes
libmagic : yes
inotify : missing
libexif : missing
id3lib : disabled
taglib : yes
libmp4v2 : missing
ffmpeg : missing
ffmpegthumbnailer : missing
lastfmlib : missing
external transcoding : yes
curl : yes
YouTube : yes
libextractor : disabled
db-autocreate : yes
Next step is to compile MediaTomb.
root@test:/tmp/mediatomb-0.12.1# make
make all-recursive
Making all in tombupnp
...
root@test:/tmp/mediatomb-0.12.1# make install
Making install in tombupnp
Making install in build
First test
Now mediatomb is installed and ready for a first test. This will create all required files and folders for us.
root@test:/tmp/mediatomb-0.12.1# LD_LIBRARY_PATH=/opt/local/lib \
LD_PRELOAD=/usr/lib/0@0.so.1 \
/opt/local/bin/mediatomb \
--ip YOUR_IP --port YOUR_PORT \
-m /etc -f mediatomb \
--logfile=/var/log/mediatomb.log
MediaTomb UPnP Server version 0.12.1 - http://mediatomb.cc/
===============================================================================
Copyright 2005-2010 Gena Batsyan, Sergey Bostandzhyan, Leonhard Wimmer.
MediaTomb is free software, covered by the GNU General Public License version 2
You shouldn’t see any errors here. Now stop mediatomb by pressing CTRL+C.
Create User for Mediatomb
We don’t want to run MediaTomb as root and have to create a user for it (called media).
root@test:/tmp/mediatomb-0.12.1# cd ~
root@test:~# mkdir -p /export/home
root@test:~# useradd -d /export/home/media -s /usr/bin/false -m media
root@test:~# groupadd media
root@test:~# usermod -g media media
root@test:~# chown media:media /var/log/mediatomb.log
root@test:~# chown -R media:media /etc/mediatomb
MediaTomb as Solaris Service
The final step is to integrate MediaTomb into Solaris’ Service Management Facility (smf). This requires a XML config file which describes the MediaTomb-service. Furthermore we use a file for config and a start-script.
Both files can be found here:
They are based on the work of Jason Friedland (see his blog) with some adaptations.
/etc/mediatomb.conf
/lib/svc/method/svc-mediatomb
mediatomb-smf.xml
root@test:~# wget http://www.dev-eth0.de/wp-content/uploads/2012/04/mediatomb.conf -O /etc/mediatomb.conf
--2012-04-12 05:12:34-- http://www.dev-eth0.de/wp-content/uploads/2012/04/mediatomb.conf
Resolving www.dev-eth0.de (www.dev-eth0.de)... 87.238.193.118
Connecting to www.dev-eth0.de (www.dev-eth0.de)|87.238.193.118|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 199 1
Saving to: `/etc/mediatomb.conf'
100%[================================================>] 199 --.-K/s in 0s
2012-04-12 05:12:35 (11.4 MB/s) - `/etc/mediatomb.conf' saved [199/199]
root@test:~# wget http://www.dev-eth0.de/wp-content/uploads/2012/04/svc-mediatomb -O /lib/svc/method/svc-mediatomb
--2012-04-12 05:12:59-- http://www.dev-eth0.de/wp-content/uploads/2012/04/svc-mediatomb
Resolving www.dev-eth0.de (www.dev-eth0.de)... 87.238.193.118
Connecting to www.dev-eth0.de (www.dev-eth0.de)|87.238.193.118|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 301 1
Saving to: `/lib/svc/method/svc-mediatomb'
100%[================================================>] 301 --.-K/s in 0s
2012-04-12 05:12:59 (16.1 MB/s) - `/lib/svc/method/svc-mediatomb' saved [301/301]
root@test:~# wget http://www.dev-eth0.de/wp-content/uploads/2012/04/mediatomb-smf.xml
--2012-04-12 05:13:09-- http://www.dev-eth0.de/wp-content/uploads/2012/04/mediatomb-smf.xml
Resolving www.dev-eth0.de (www.dev-eth0.de)... 87.238.193.118
Connecting to www.dev-eth0.de (www.dev-eth0.de)|87.238.193.118|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1544 (1.5K) [application/xml]
Saving to: `mediatomb-smf.xml'
100%[================================================>] 1,544 --.-K/s in 0.001s
2012-04-12 05:13:09 (1.10 MB/s) - `mediatomb-smf.xml' saved [1544/1544]
Now modify the /etc/mediatomb.conf file to match your IP and PORT.
root@test:~# chmod 755 /lib/svc/method/svc-mediatomb
root@test:~# svccfg validate mediatomb-smf.xml
root@test:~# svccfg import mediatomb-smf.xml
Now we have installed MediaTomb as a Solaris Service and can start and stop it with the svcadm command and check it’s status with svcs.
Commands:
svcadm enable mediatomb
svcadm disable mediatomb
The following commands will start tor and check if everything is ok and running.
root@test:~# svcadm enable mediatomb
root@test:~# svcs -x mediatomb
svc:/application/mediatomb:default (UPnP Media Server)
State: online since Thu Apr 12 05:31:12 2012
See: mediatomb(1)
See: http://mediatomb.cc
See: /var/svc/log/application-mediatomb:default.log
Impact: None.
That’s it, you now can access MediaTomb via http://YOUR_IP:YOUR_PORT.
This howto describes how to install MediaTomb, a free/opensource UPnP Media Server on OpenSolaris/OpenIndiana. Basic installation Install SpiderMonkey You can find the required steps to install the SpiderMonkey JS Library...