After we installed all required dependencies, we can start to build munin. This part of the guide describes how to build munin and install a munin-node on a OpenSolaris/OpenIndiana system.

Basics

First we create a user and a group for munin to run as.

root@test:~/perl-5.16.0# cd ~
root@test:~# mkdir -p /export/home
root@test:~# useradd -d /export/home/munin -s /usr/bin/false -m munin
root@test:~# groupadd munin
root@test:~# usermod  -g munin munin

Now we are ready to download munin.

root@test:~# wget http://downloads.sourceforge.net/project/munin/stable/2.0.0/munin-2.0.0.tar.gz

--2012-06-05 22:29:50--  http://downloads.sourceforge.net/project/munin/stable/2.0.0/munin-2.0.0.tar.gz
HTTP request sent, awaiting response... 200 OK
Length: 1317614 (1.3M) [application/x-gzip]
Saving to: `munin-2.0.0.tar.gz'

100%[===========================================================>] 1,317,614   1.63M/s   in 0.8s

2012-06-05 22:29:52 (1.63 MB/s) - `munin-2.0.0.tar.gz' saved [1317614/1317614]

root@test:~# tar xf munin-2.0.0.tar.gz
root@test:~# cd munin-2.0.0

The munin source contains a config, which will not match our needs. Therefor we have to edit the Makefile.config and set the CONFDIR as following:

CONFDIR = $(DESTDIR)/opt/munin

Now build munin and install it.

root@test:~/munin-2.0.0# gmake
root@test:~/munin-2.0.0# gmake install-common-prime
root@test:~/munin-2.0.0# gmake install-node
root@test:~/munin-2.0.0# gmake install-plugins-prime

Configure Munin

Munin is delivered with a sample config-file which can be used as basic for our new installation. So we copy it and create a folder for the munin logs.

root@test:~/munin-2.0.0# cp build/node/munin-node.conf /opt/munin/
root@test:~/munin-2.0.0# mkdir /var/log/munin
root@test:~/munin-2.0.0# chown munin:munin /var/log/munin/

Edit /opt/munin/munin-node.conf and set the logfile to use the new directory and set the run dir:

log_file /var/log/munin/munin-node.log
pid_file /var/run/munin-node.pid

There is a cool script available, which tries to enabled a number of plugins automatically. The script contains a reference to the original perl path and has to be edited before we can run it. So change the header

#!/usr/bin/perl -w

to

#!/opt/perl/bin/perl -w

in

/opt/munin/sbin/munin-node-configure

and run it:

root@test:~/munin-2.0.0# /opt/munin/sbin/munin-node-configure --shell -families=contrib,auto | sh -x

The same problem can be found in another file:

#!/usr/bin/perl -wT

to

#!/opt/perl/bin/perl -wT

in

/opt/munin/sbin/munin-node

Munin-Node as Solaris Service

The final step is to integrate the munin-node into Solaris’ Service Management Facility (smf). This requires a XML config file which describes the Munin-Node-service.
The required file can be found here:

munin.xml

root@test:~/munin-2.0.0# cd /tmp/
root@test:/tmp# wget http://www.dev-eth0.de/wp-content/uploads/2012/06/munin.xml
root@test:/tmp# svccfg import -V munin.xml

Now we have installed Munin-Node as a Solaris Service and can start and stop it with the svcadm command and check it’s status with svcs.

Commands:

svcadm enable munin-node
svcadm disable munin-node

The following commands will start tor and check if everything is ok and running.

root@test:/tmp# svcadm enable munin-node
root@test:/tmp# svcs -x munin-node
svc:/application/munin-node:default (?)
 State: online since Tue May 29 23:28:13 2012
  See: /var/svc/log/application-munin-node:default.log
Impact: None.

This guide describes how to install a Munin 2.0 Node and Master on an OpenSolaris/OpenIndiana system.
As there are many requirement, the guide is split up in three parts. The first part is about the required dependencies for a Munin Node and Master.

Some dependencies exist only for the Node or the Master but as most are simple Perl modules, I don’t take care for unused libs.

Basics

root@test:~# pkg install system/library/math/header-math gcc-43 wget developer/build/gnu-make
          Packages to install: 18
      Create boot environment: No
Create backup boot environment: No

DOWNLOAD                                  PKGS       FILES    XFER (MB)
Completed                                18/18   3086/3086    71.1/71.1

PHASE                                        ACTIONS
Install Phase                              4088/4088

PHASE                                          ITEMS
Package State Update Phase                     18/18
Image State Update Phase                         2/2

root@test:~# PATH=$PATH:/usr/gcc/4.3/bin

Build Perl

The delivered Perl version of OpenIndiana somehow does manage to fail installing the IO::Socket::INET library, which is required to run munin. Therefore we have to install a new version of Perl to /opt/perl:

First get the current relase from http://www.perl.org/get.html and untar it.

root@test:~# wget http://www.cpan.org/src/5.0/perl-5.16.0.tar.gz
--2012-05-29 22:43:17--  http://www.cpan.org/src/5.0/perl-5.16.0.tar.gz
Resolving www.cpan.org (www.cpan.org)... 212.117.177.118,
2a01:608:2:4::2, 2620:101:d000:8::140:1
Connecting to www.cpan.org (www.cpan.org)|212.117.177.118|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15727416 (15M) [application/x-gzip]
Saving to: `perl-5.16.0.tar.gz'

100%[=========================================================================>]
15,727,416  3.01M/s   in 5.3s

2012-05-29 22:43:23 (2.81 MB/s) - `perl-5.16.0.tar.gz' saved [15727416/15727416]

root@test:~# tar xf perl-5.16.0.tar.gz
root@test:~# cd perl-5.16.0

Now you can run the config file and then build it. The

gmake test

step will take quite a long time, so get a coffee icon wink Munin on OpenSolaris: Part 1   Requirements

root@test:~/perl-5.16.0# ./Configure -des -Dprefix=/opt/perl -Dcc=gcc
root@test:~/perl-5.16.0# gmake
root@test:~/perl-5.16.0# gmake test
root@test:~/perl-5.16.0# gmake install
root@test:~/perl-5.16.0# PATH=/opt/perl/bin:$PATH

Next we load the required perl modules.

root@test:~/perl-5.16.0# perl -MCPAN -e shell

Now enter the following commands:

install Net::Server
install Log::Log4perl
install IO::Socket::INET6
install URI
install HTML::Template
install File::Copy::Recursive
install Date::Manip
install FCGI
exit

or as a one liner:

root@test:~/perl-5.16.0# perl -MCPAN -e 'install Net::Server, Log::Log4perl, IO::Socket::INET6, URI, HTML::Template, File::Copy::Recursive, Date::Manip, FCGI'

That’s it, all requirements should be set up.

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.

As the currently available OpenSolaris packages of TOR are outdated, I compiled the sources and documented what to do.

Basic installation

First we need to install some packages which are required to download and compile TOR:

root@test:~#  pkg install wget gcc-43 system/library/math/header-math libevent
               Packages to install:    18
           Create boot environment:    No
DOWNLOAD                                  PKGS       FILES    XFER (MB)
Completed                                18/18   3066/3066    70.7/70.7

PHASE                                        ACTIONS
Install Phase                              4013/4013

PHASE                                          ITEMS
Package State Update Phase                     18/18
Image State Update Phase                         2/2


root@test:~# PATH=$PATH:/usr/gcc/4.3/bin

The next step is to create a user for TOR (we don’t want to run it as root).

root@test:~# mkdir -p /export/home
root@test:~# useradd -d /export/home/tor -s /usr/bin/false -m tor

Then we need to download and unpack the current TOR version from https://www.torproject.org/download/download.html.en.

root@test:~# wget https://www.torproject.org/dist/tor-0.2.2.35.tar.gz
--2012-02-06 00:46:36--  https://www.torproject.org/dist/tor-0.2.2.35.tar.gz
Resolving www.torproject.org (www.torproject.org)... 86.59.30.36, 38.229.72.14, 38.229.72.16
Connecting to www.torproject.org (www.torproject.org)|86.59.30.36|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2787536 (2.7M) [application/x-gzip]
Saving to: `tor-0.2.2.35.tar.gz'

100%[==============================================>] 2,787,536   2.20M/s   in 1.2s

2012-02-06 00:46:56 (224 KB/s) - `tor-0.2.2.35.tar.gz' saved [2787536/2787536]

root@test:~# tar xf tor-0.2.2.35.tar.gz
root@test:~# cd tor-0.2.2.35
root@test:~/tor-0.2.2.35#

Now we can configure and build tor.

root@test:~/tor-0.2.2.35# ./configure --prefix=/opt/tor
checking for a BSD-compatible install... ./install-sh -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
...

root@test:~/tor-0.2.2.35# make
make  all-recursive
make[1]: Entering directory `/root/tor-0.2.2.35'
Making all in src
make[2]: Entering directory `/root/tor-0.2.2.35/src'
...

root@test:~/tor-0.2.2.35# make install
Making install in src
make[1]: Entering directory `/root/tor-0.2.2.35/src'
Making install in common
make[2]: Entering directory `/root/tor-0.2.2.35/src/common'
make[3]: Entering directory `/root/tor-0.2.2.35/src/common'
...

root@test:~/tor-0.2.2.35# cd /opt/tor/
root@test:/opt/tor#

Configuration

There is a sample configuration available which can be used as a base for further modification.

oot@test233:/opt/tor# cd etc/tor
root@test:/opt/tor/etc/tor# cp torrc.sample torrc

Have a look at the manual for further information.

Finally we have to create the data and log directory which are configured in the config.
e.g.:

Create data-directory
root@test:/opt/tor# mkdir -p /opt/tor/var/tor
root@test:/opt/tor# chown tor /opt/tor/var/tor

Create log-directory
root@test:~# mkdir /var/log/tor
root@test:~# chmod 777 /var/log/tor

TOR as Solaris Service

The final step is to integrate TOR into Solaris’ Service Management Facility (smf). This requires a XML config file which describes the TOR-service.
The required file can be found here:

tor.xml

root@test:/opt/tor# cd /tmp/
root@test:/tmp# wget http://www.dev-eth0.de/wp-content/uploads/2012/02/tor.xml
root@test:/tmp# svccfg import -V tor.xml

Now we have installed TOR as a Solaris Service and can start and stop it with the svcadm command and check it’s status with svcs.

Commands:

svcadm enable tor
svcadm disable tor

The following commands will start tor and check if everything is ok and running.

root@test:/tmp# svcadm enable tor
root@test:~# svcs -x tor
svc:/network/tor:default (Tor Relay Daemon)
 State: online since Mon Feb  6 01:29:18 2012
   See: tor(1M)
   See: /var/svc/log/network-tor:default.log
Impact: None.

Finally you can check the tor logfile which should contain a line similar to

Feb 06 02:00:44.494 [notice] Self-testing indicates your ORPort is reachable from the outside. Excellent. Publishing server descriptor.

Die meisten Entwickler nutzen den Android-Emulator ja wahrscheinlich dafür, selbst entwickelte Programme komfortabel zu testen. Es gibt aber auch noch einen weiteren interessanten Einsatzzweck, den Gaby Becker in einem Blog-Beitrag beschrieben hat.

Es geht hierbei um die Möglichkeit, über den Android Market Apps im Emulator zu installieren und diese dann sowohl lokal zu nutzen oder für Präsentationen zu nutzen.

Gaby Becker: Präsentieren mit dem Emulator