DLNA(Digital Living Network Alliance)[加盟各社の製品が互いに互換性を持ち、家庭内で電子装置間のネットワークを可能にする業界標準(ガイドライン)]用のサーバのインストール
http://mediatomb.cc/pages/downloadからソースをDownload
以下のソフトをapt-getでインストール
以下のソフトをソースからインストール
tarで展開して
コンパイル
$ ./configure $ make $ su # make install
/usr/local/lib/libextractor.so.1 のシンボリックリンクを /usr/libへ作成
# cd /usr/lib # ln -s /usr/local/lib/libextractor.so.1
$ tar zxvf mediatomb-0.11.0.tar.gz $ cd mediatomb-0.11.0 $ LDFLAGS=-L/usr/lib ./configure -with-mysql-cfg=/usr/bin/mysql_config --enable-libextractor
最終表示で結果
ONFIGURATION SUMMARY ---- sqlite3 : yes mysql : yes libjs : missing libmagic : yes inotify : yes libexif : yes expat : yes id3lib : disabled taglib : yes ffmpeg : disabled external transcoding : yes libextractor : yes
$ make $ su $ make install
# /usr/local/bin/mediatomb MediaTomb UPnP Server version 0.11.0 - http://mediatomb.cc/ =============================================================================== Copyright 2005-2008 Gena Batsyan, Sergey Bostandzhyan, Leonhard Wimmer. MediaTomb is free software, covered by the GNU General Public License version 2 2009-03-13 18:28:08 INFO: MediaTomb configuration was created in: /root/.mediatomb/config.xml 2009-03-13 18:28:08 INFO: Loading configuration from: /root/.mediatomb/config.xml 2009-03-13 18:28:08 INFO: UUID generated: ebca88e0-c604-4f0f-b026-dbab46136bac 2009-03-13 18:28:08 INFO: Checking configuration... 2009-03-13 18:28:08 INFO: Setting filesystem import charset to EUC-JP 2009-03-13 18:28:08 INFO: Setting metadata import charset to EUC-JP 2009-03-13 18:28:08 INFO: Setting playlist charset to EUC-JP 2009-03-13 18:28:08 INFO: Configuration check succeeded. 2009-03-13 18:28:08 WARNING: Sqlite3 database seems to be corrupt or doesn't exist yet. 2009-03-13 18:28:08 INFO: no sqlite3 backup is available or backup is corrupt. automatically creating database... 2009-03-13 18:28:08 INFO: database created successfully. 2009-03-13 18:28:08 INFO: Initialized port: 49152 2009-03-13 18:28:08 INFO: Server bound to: 10.1.5.188 2009-03-13 18:28:09 INFO: MediaTomb Web UI can be reached by following this link: 2009-03-13 18:28:09 INFO: http://10.1.5.188:49152/ # ^C <=停止(ctrl+C) 2009-03-13 18:29:25 INFO: MediaTomb shutting down. Please wait... 2009-03-13 18:29:26 INFO: Server terminating
/etc/mediatomb.confを作成
雛形をコピー
# cp config/mediatomb-conf-fedora /etc/mediatomb.conf
sample
# This is a sambel configuration file for the MediaTomb daemon script ## used on Fedora Core ## By default the configuration will be created in /etc/mediatomb ## Network interface on which the server will run, you need to edit this! ##MT_INTERFACE="NOT_SET" MT_INTERFACE="eth0" <==追加 ## User defined command line options that may be passed to the server MT_OPTIONS="" ## MediaTomb will be started on port 50500 MT_PORT="50500" ## MediaTomb will run as mediatomb ##MT_USER="mediatomb" ##MT_GROUP="mediatomb" MT_USER="root" <==修正 MT_GROUP="root" <==修正 ## Location of the PID file MT_PIDFILE="/var/run/mediatomb.pid" ## Location of the log file MT_LOGFILE="/var/log/mediatomb" ## Location of the config file/database MT_HOME="/etc" MT_CFGDIR="mediatomb"
/etc/rc.d/init.d/mediatombの作成
雛形をコピー
# cp scripts/mediatomb-service-fedora /etc/rc.d/init.d/mediatomb
sample
#!/bin/sh # # mediatomb This script starts and stops the mediatomb daemon # # chkconfig: 2345 95 30 # processname: mediatomb # description: mediatomb is a daemon process which provides a UPnP service # config: /etc/mediatomb # config: /etc/mediatomb/config.xml # pidfile: /var/run/mediatomb.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 # Set default mediatomb configuration. # either make an installation in /etc/mediatomb and leave this blank, # or specify an alternative config file location using the -c option # Note: be aware, that -i parameter is used to set the ip of the # interface specified above . /etc/mediatomb.conf ############################### # make sure to run it as nobody MEDIATOMB="-d -u $MT_USER -g $MT_GROUP -P $MT_PIDFILE -l $MT_LOGFILE \ -m $MT_HOME -f $MT_CFGDIR -p $MT_PORT" [ -f /usr/local/bin/mediatomb ] || exit 0 <==パスを修正 [ ${MT_INTERFACE} = "NOT_SET" ] && echo "Please edit /etc/mediatomb.conf and change \ the MT_INTERFACE variable to your network device (eth0, eth1, etc.)" && exit 0 PATH=$PATH:/usr/bin:/usr/local/bin # By default it's all good RETVAL=0 # See how we were called. case "$1" in start) # Start daemon. echo -n "Applying multicast settings to $MT_INTERFACE... " # those settings are necessary for us to react to M-SEARCH requests route add -net 239.0.0.0 netmask 255.0.0.0 $MT_INTERFACE >/dev/null 2>&1 ifconfig $MT_INTERFACE allmulti touch $MT_PIDFILE chown mediatomb $MT_PIDFILE mkdir -p "/$MT_HOME/$MT_CFGDIR" chown mediatomb "/$MT_HOME/$MT_CFGDIR" echo -n "Starting mediatomb: " ## daemon $NICELEVEL mediatomb $MEDIATOMB -e $MT_INTERFACE $MT_OPTIONS daemon $NICELEVEL mediatomb $MEDIATOMB <==修正 RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/mediatomb ;; stop) # Stop daemons. echo -n "Shutting down mediatomb: " killproc mediatomb RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/mediatomb ;; restart) $0 stop $0 start ;; condrestart) [ -e /var/lock/subsys/mediatomb ] && $0 restart ;; status) status mediatomb RETVAL=$? ;; *) echo "Usage: $0 {start|stop|restart|status|condrestart}" RETVAL=1 ;; esac exit $RETVAL
/etc/mediatomb/config.xmlの作成
雛形をコピー
# cp (展開フォルダ)/config/mappings.xml /etc/mediatomb/config.xml
sapmle
<?xml version="1.0" encoding="UTF-8"?> <config xmlns="http://mediatomb.cc/config/1" \ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \ xsi:schemaLocation="http://mediatomb.cc/config/1 \ http://mediatomb.cc/config/1.xsd" version="1"> <server> <ui enabled="yes"> <accounts enabled="no" session-timeout="30"/> </ui> <name>MediaTomb</name> <udn>uuid:a865d0aa-aa5f-4502-bb8c-6b273f2775f8</udn> <home>/root/.mediatomb</home> <webroot>/usr/local/share/mediatomb/web</webroot> <protocolInfo extend="yes"/> <storage> <mysql enabled="yes"> <host>localhost</host> <== DBホストの指定 <username>mediatomb</username> <== DB User <database>mediatomb</database> <== DB 名 を追加 <password>パスワード</password> <== DBパスワード(ないときは省略) </mysql> </storage> </server> <import hidden-files="no"> <filesystem-charset>EUC-JP</filesystem-charset> <metadata-charset>CP932</metadata-charset> <scripting script-charset="UTF-8"> <virtual-layout type="builtin"/> </scripting> <mappings> <extension-mimetype ignore-unknown="no"> <map from="mp3" to="audio/mpeg"/> <map from="ogg" to="application/ogg"/> <map from="asf" to="video/x-ms-asf"/> <map from="asx" to="video/x-ms-asf"/> <map from="wma" to="audio/x-ms-wma"/> <map from="wax" to="audio/x-ms-wax"/> <map from="wmv" to="video/x-ms-wmv"/> <map from="wvx" to="video/x-ms-wvx"/> <map from="wm" to="video/x-ms-wm"/> <map from="wmx" to="video/x-ms-wmx"/> <map from="m3u" to="audio/x-mpegurl"/> <map from="pls" to="audio/x-scpls"/> <map from="avi" to="video/avi"/> <map from="divx" to="video/divx"/> <map from="m4v" to="video/mp4"/> <map from="mp4" to="video/mp4"/> <map from="gif" to="image/gif"/> <map from="jpeg" to="image/jpeg"/> <map from="png" to="image/png"/> </extension-mimetype> <mimetype-upnpclass> <map from="audio/*" to="object.item.audioItem.musicTrack"/> <map from="application/ogg" to="object.item.audioItem.musicTrack"/> <map from="video/*" to="object.item.videoItem"/> <map from="image/*" to="object.item.imageItem"/> </mimetype-upnpclass> <mimetype-contenttype> <treat mimetype="audio/mpeg" as="mp3"/> <treat mimetype="application/ogg" as="ogg"/> <treat mimetype="audio/x-flac" as="flac"/> <treat mimetype="image/jpeg" as="jpg"/> <treat mimetype="audio/x-mpegurl" as="playlist"/> <treat mimetype="audio/x-scpls" as="playlist"/> <treat mimetype="video/x-msvideo" as="avi"/> </mimetype-contenttype> </mappings> </import> <transcoding enabled="no"> <mimetype-profile-mappings> <transcode mimetype="video/x-flv" using="vlcmpeg"/> <transcode mimetype="application/ogg" using="vlcmpeg"/> <transcode mimetype="application/ogg" using="oggflac2raw"/> <transcode mimetype="audio/x-flac" using="oggflac2raw"/> </mimetype-profile-mappings> <profiles> <profile name="oggflac2raw" enabled="no" type="external"> <mimetype>audio/L16</mimetype> <accept-url>no</accept-url> <first-resource>yes</first-resource> <accept-ogg-theora>no</accept-ogg-theora> <agent command="ogg123" arguments="-d raw -f %out %in"/> <buffer size="1048576" chunk-size="131072" fill-size="262144"/> </profile> <profile name="vlcmpeg" enabled="no" type="external"> <mimetype>video/mpeg</mimetype> <accept-url>yes</accept-url> <first-resource>yes</first-resource> <accept-ogg-theora>yes</accept-ogg-theora> <agent command="vlc" arguments="-I dummy %in --sout #transcode\ {venc=ffmpeg,vcodec=mp2v,vb=4096,fps=25,aenc=ffmpeg,acodec=mpga,ab=192,\ samplerate=44100,channels=2}:standard{access=file,mux=ps,dst=%out} vlc:quit"/> <buffer size="14400000" chunk-size="512000" fill-size="120000"/> </profile> </profiles> </transcoding> </config>
# /usr/bin/mysql -p
Enter password: 空ENTER Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 to server version: 5.0.27-standard Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> CREATE DATABASE mediatomb; Query OK, 1 row affected (0.06 sec) mysql> GRANT ALL ON mediatomb.* TO 'mediatomb'@'localhost'; Query OK, 0 rows affected (0.00 sec) mysql> quit Bye
# mysql -p mediatomb < /usr/local/share/mediatomb/mysql.sql Enter password: 空ENTER #
# service mediatomb start Applying multicast settings to eth0... Starting mediatomb: [ OK ] #
/var/log/mediatombで起動、エラーが確認できる
以下のようなエラーは/etc/mediatomb/config.xmlでDBのホストやDB名が未定義。上の3行が設定されていない。
2009-03-13 19:56:23 ERROR: Config: option not found: /server/storage/host 2009-03-13 20:08:47 INFO: Loading configuration from: /etc/mediatomb/config.xml 2009-03-13 20:08:47 INFO: Checking configuration... 2009-03-13 20:08:47 INFO: Migrating server configuration 2009-03-13 20:08:47 ERROR: Config: option not found: /server/storage/database 2009-03-13 20:10:26 INFO: Loading configuration from: /etc/mediatomb/config.xml 2009-03-13 20:10:26 INFO: Checking configuration...
# chkconfig mediatomb on
・Web UIの起動 http://localhost:50500/ ・登録 Filesystemから該当フォルダを選択し"+"アイコンをクリック
http://mtada.cocolog-nifty.com/blog/2008/02/vinelinux42medi_7e9d.html