Ubuntu Music Streaming Server – Ampache

Overview

I wanted a music server for personal use so that I can access my music collection remotely or locally. A web front end with the ability to stream to various players would be key. It had to run on my Ubuntu system.

I do not / this article does not condone the use for piracy in any way.

GNUMP3d

GNUMP3d is a GNU music server. It is in the Ubuntu 8.04 repository and includes it’s own light weight server (good and bad points to this method). It’s all self contained so it does not require Apache or a database installed to run it.

The web front end is very basic with only text on the web page but has the ability to record statistics. Being a basic music server it does not support album art but it does have a lot of themes built in. All settings are changed in the config file but cannot be changed using the web front end. This means starting up SSH to even change a small setting like your chosen theme.

It runs on any system which has perl installed. The problem I had with this set up was the lack of user authentication. It had a “weak” and basic method of using a .password file which can be placed in the root of the music directory but this support was removed in the new version because it was “weak”. I do not want my server to be publicly accessible (that’s just asking for trouble). I went ahead and removed it.

Ampache

Ampache has more weight to it than GNUMP3d. It requires a web server, PHP and MySQL (Not tried it with any other database). It supports tags and album art, There is also an option for lyrics but I have yet to see this in action.

The music server has many options including different playlist formats:

And also different streaming formats like shoutcast as well as different playback methods. The best part about Ampache is the built in flash player. Just like the BBC Radio player it opens a new window with the player and controls.

The web front end allows you to create and modify playlists, upload, download, and find duplicate music files. Ampache has built in access control level (ACL) which is basic but it works.

There are only 2 themes included and last.fm plugin. The non default theme is “pretty” but I find the font to be too small and there is no way of changing it. It has statistics and recently played songs which are bonus features.

Pre-Requisite To Ampache

Install Apache and MySQL if not already done so:
sudo apt-get install apache mysql
When prompted, enter the root password.

Ensure Apache is up and running by typing http://localhost in a web browser. A message saying “It works!” should appear.

Optional:
Install MySQL Administrator to easily maintain the MySQL database:
sudo apt-get install mysql-admin

The following steps are beyond the scope of this how to:
Connect to the database using your root account (using MySQL Admin).

Create a username and password for Ampache as well as a schema. For remained of this post I will user the username=Ampache and password=password using the database schema Ampache.

Ensure the Ampache database user has all privileges to the Ampache schema.

Install Ampache

Download the latest Ampache from Ampache.org/”>http://Ampache.org/ In my case it was 3.5.1
wget http://Ampache.org/downloads/Ampache-3.5.1.tar.gz

Extract the compressed files:
tar -xzvf Ampache-3.5.1.tar.gz

Move (and rename) the directory Ampache-3.5.1 to the web directory (by default in /var/www). Depending on where you want to access Ampache will depend on where you move the directory. Do ONE of the following:

For Ampache to appear in the “root” directory e.g http://www.dannytsang.co.uk move all the files in Ampache-3.5.1 to /var/www:
cd Ampache-3.5.1
sudo mv * /var/www

For Ampache to appear in the sub directory e.g http://www.dannytsang.co.uk/Ampache move all the files in Ampache-3.5.1 to /var/www:
sudo mv Ampache-3.5.1 /var/www/Ampache

Ensure you have got your Ampache files in the place you want to access them. I had to re-install it because I kept the directory as Ampache-3.5.1 which made it http://www.dannytsang.co.uk/Ampache-3.5.1/
To re-install I have to remove the file /etc/apache/config.d/Ampache and go back to the beginning to copying the file.

Next step is to ensure the file permissions are set correctly. For method one:
sudo chmod -R 774 /var/www

For method two:
sudo chmod -R 774 /var/www/Ampache
sudo chown -R root:www-data /var/www/Ampache

Head over to http://localhost or http://www.localhost/Ampache and follow the on screen instructions to install Ampache.

Post Install

Everything else can be configured from the web interface with the exception of the music directory. Where ever you want to add music to Ampache, you have to make sure it has at least xx4 (read) file permission otherwise the Apache / Ampache will not be able to see the file. If you want to allow Ampache to manage files e.g upload new music files to your library you will need to give it write access too. The best way to deal with this is to add www-data to your username group. Either way I do not recommend allowing write access for security reasons.

Review

Ampache Login Page

I intend on using the server whilst I’m not at home e.g abroad or at work. I can listen to all my collection without carrying it around with me and now my iPhone has more juice. I only use my iPhone to listen to music when I’m not in the office or listen to podcasts.

The reason why I won’t use it for podcasts is because it doesn’t have speed playback and no bookmarking feature which allows you to resume from where you left off.

Flash Player

The Flash player was usable. It showed a dark grey buffering bar and a light grey bar for the currently playing track. A good visual of how much has been downloaded from the stream. All the tracks for the current play list is shown along with the album art cover (nice touch).

WMP Player

M3U streaming to Windows Media Player (WMP) worked very well. It too showed the album art and this method I could use the media keys on the computer.

Both players had reasonably good quality but the flash player lacked settings to adjust the buffer rate. The problem with both methods was the buffering. Not only did it need to buffer for each track but it had to re-buffer if a song has already played – something common to streaming media except for QuickTime.

WMP did lack the track titles until it got to the track itself. All it shows is index in the play list for the track if it hadn’t gotten to it yet.

I suffered a lot of pauses from the flash player because it had to buffer a lot through random moments through the day. However, WMP also had it’s buffering problems too but I could set the buffer limits to cope. When this happens I had to turn to the player to see what was going on, distracting me from work.

Ampache Track List

Playlists can be a powerful tool but in this case it’s pretty simply use. There is a current playlist which you add you tracks to. You can save this list determinately as one playlist which adds a date time stamp and your username. You cannot rename it to something more useful. The current playlist can be formed of multiple store playlists as well as adhoc tracks.

Ampache supports tags and track ratings. Ratings can be changed online too. It includes the usual filtering and sort of tracks by artists and albums as well as search.

Adding libraries are fairly easy. You give it a directory path and it will index the given path. Libraries may exist locally or remotely. Options to update, clean, etc will automate management of songs.

Ampache ACL

Working with Ampache User Access Control Level (ACL) was easy but may be too simple for power users. It has a drop down of all available groups for a given feature. The bad part is it assumes that any group above the selected group also has access to that feature. I believe it does not allow you to add new groups either.

Summary

Ampache is a good but media server. As always the user interface could be tweaked and a lot more plugins and features can be added e.g HTML 5 player, uPNP but that’s like asking for the world. The set up was very easily to do and does all the basics I want.

GNUMP3d Website

Ampache Website

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Linux, Music and tagged , , , , , , , , , , , , , , , , . Bookmark the permalink.

One Response to Ubuntu Music Streaming Server – Ampache

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.