Since getting my PS3, then setting up my Ubuntu file server, I’ve really enjoyed watching movies on my TV. To get the media from computer to Playstation requires the use of software that employs the UPnP protocol, in the form of a DLNA server.
If there are too many acronyms in there, just remember the name Mediatomb. Mediatomb is an open-source, cross-platform DLNA server that streams a variety of media formats across a local network to whatever compatible device you happen to have running at the end. It can stream video, music, photos in numerous formats, and will even transcode others so that they can stream as well. All this tinkering comes at the expense of user-friendliness, though. In most cases, the regular binaries for each operating system will do most of the cool tricks I mention here. To get the most out of the system, however, requires you to compile from source.
As mentioned in my previous file server post, I’m running Ubuntu 9.04 Jaunty Jackolope on a “headless” Intel server, which I control via the terminal. Since the computer doesn’t restart, I wanted it to run as a daemon, which was where I ran into a problem. For some reason, Jaunty didn’t play nice with the standard daemon package, so I had do a little digging to find the solution.
- Create a temporary working directory by issuing this command
$ mkdir temp
- Install the ffmpegthumbnailer libraries by installing libffmpegthumbnailer. Use the command
sudo apt-get install libffmpegthumbnailerand enter your admin password when prompted.
- Compile ffmpeg using the tutorial at Juliensimon.blogspot.com but include the configure tag
--enable-libffmpegthumbnailer. Don’t move on until the configuration confirms thumbnailer installation.
- Compile and install the Mediatomb binaries from source — again, I used the excellent tutorial at Juliensimon.blogspot.com
- Check the functionality of Mediatomb to issuing the command
$ mediatombthen opening a web browser to http://ip_of_server:49152/
- To make the daemon work, first download the daemon package by issuing this command (one line)
$ wget http://mirrors.kernel.org/ubuntu/pool/universe/m/mediatomb/mediatomb-daemon_0.11.0-3ubuntu2_all.deb
- Now extract the files in the package to the temporary directory created earlier
$ dpkg-deb -x mediatomb-daemon_0.11.0-3ubuntu2_all.deb temp
As you can see, the daemon package is just a collection of configuration files, so installing it properly is just a matter of copying the files back.
- Change to the temporary directory with the files by typing
$ cd temp_directory_name
- Type these commands one line at a time to copy the files back to their rightful place. The commands with two lines should be printed as one single command.
$ sudo cp etc/mediatomb/config.xml /etc/mediatomb/config.xml
$ sudo cp etc/default/mediatomb /etc/default/mediatomb
$ sudo cp etc/init.d/mediatomb /etc/init.d/mediatomb
$ sudo cp etc/logrotate.d/mediatomb /etc/logrotate.d/mediatomb
$ sudo cp usr/share/doc/mediatomb-daemon/README.Debian usr/share/doc/mediatomb-daemon/README.Debian
$ sudo cp usr/share/doc/mediatomb-daemon/changelog.Debian.gz /usr/share/doc/mediatomb-daemon/changelog.Debian.gz
$ sudo cp usr/share/doc/mediatomb-daemon/changelog.gz /usr/share/doc/mediatomb-daemon/changelog.gz
$ sudo cp usr/share/doc/mediatomb-daemon/copyright /usr/share/doc/mediatomb-daemon/copyright
If the copy comes back with errors about directories, you’ll likely have to use the mkdir to create the requested folders.
- Now the important step is setting the proper permissions of the folder /var/lib/mediatomb. Change into that directory by issuing
$ cd /var/lib/
- The folder /var/lib/mediatomb should contain 3 files:
$ ls mediatomb
- Change the ownership of the folder and its contents.
$ chown -R mediatomb:mediatomb mediatomb
- Change the permissions of the HTML file.
$ sudo chmod 666 mediatomb/mediatomb.html
- Change the permissions of the remaining two files:
$ sudo chmod 644 mediatomb/sqlite3.db
$ sudo chmod 644 mediatomb/sqlite3.db-journal
- Make the script run at startup.
$ update-rc.d mediatomb defaults
To start the server, simply issue the command
sudo /etc/init.d/mediatomb start. If the server doesn’t start, view the Mediatomb log file to see what else is happening.
$ vi /var/log/mediatomb.log
Exit with :q. I’ve been running this setup since I first built the server, and it has worked exceptionally well.