Awesome Music server = Your existing Ubuntu 8.10 Desktop + Ampache + Rhythmbox, Oh My!

One of the problems we were running into in our home was the distribution of media files, specifically music. My desktop has a nice 300+ Gigs of hdd space on it, so it's fairly easy for me to host all of the music on separate partitions (pretty useful when the smaller systems in the house need to update, or fresh install), but the transferring of files over the lan got tiresome, and my wife likes quite a bit of my music collection, and is really out of room on her laptop. Likewise, my daughter's desktop is in serious need of hdd space, and she has a growing musical "habit". Also, I want my music in places other than the room my desktop is in, other than the apartment my computer is in, and I don't have an mp3 player large enough for all of my files.

The solution was to find a way to host all of the files on my desktop, and to allow access to them in a nice streaming sort of way. I didn't want to just open up lan access to my partitions, I only share out one small folder for samba, and like to keep it that way. So I went out and found me some Ampache! And it was good...Ampache is a PHP based music server that uses a MySql database to store its information. It allows users to browse online music collections, build playlists, stream content to a desktop music player, or even download the tracks. There is quite a bit of flexibility with Ampache, it's theme-able, providing a nice user interface, has album art support and all the bells and whistles you could want. You can add users through the web interface and set access levels, so security is a no-brainer. There's a working demo here to get a feel for how it plays.

I simply installed the "AMP" portion of the LAMP stack on top of my existing Ubuntu desktop installation (this is easily done using the tasksel command from the terminal), installed and told Ampache to catalog all of the files in my music partition, and ran it from there. Then the hits kept on coming, I found a nice plugin for Rhythmbox that connects to the Ampache backend and loads your Ampache catalog right in your music browser! Happy, if you like Rhythmbox. Also, in Amarok2 there is built in support for subscribing to Ampache servers. Neat. So, after enabling the plugin on all of the client computers, all they have to do is fire up Rhythmbox, and they all have seamless access to my entire music collection. They get thier music fix, I look like a wizard!

Now, Ampache is in the repo, so after enabling community repo's, apt should get 'er done, but I have it installed manually. Here's how to do it:

  • Install the rest of the LAMP stack by opening a terminal and typing in
    • $ sudo tasksel
    • Select LAMP server and continue, following the instructions and answering the questions provided. Make sure to write down all of your answers!
  • Also install phpMyAdmin To help manage the database in an easy way.
    • $ sudo apt-get install phpmyadmin
    • Now you can browse to localhost/phpmyadmin with Firefox and login with the credentials you created during the LAMP install and create the required database and user for Ampache. Write this information down.
  • Install Ampache
    • Using the command line you can do this with apt-get
      • sudo apt-get install ampache ampache-themes
    • OR You can get the latest, most up to date release manually. You just need to
      • Download the package by visiting this link
      • Unpack it into your directory of choice, your /var/www/ folder is a good candidate if you are using a default LAMP install, and rename it so that it is easy to browse to. Something like /var/www/music/
      • Open your web browser to localhost/music and follow the instructions. You will need the username and database information you created in phpmyadmin. Make sure to write down user name information when you create your Ampache admin user.
  • Now you should be able to browse to locahost/music with Firefox, and log in. So go ahead and do this.
    • Go to the admin tab, and choose Add Catalog. Fill in the form and submit. This can take some time for large file systems.
    • In the admin tab, choose Add Users and add as many users as you need.
    • Still in the admin tab, choose add acl and add in some access control lists. Make the first one
      • Name Stream Access
      • Start Address 0.0.0.0
      • End Address 255.255.255.255
      • Level Read
      • User Ampache User (system)
      • Key Leave Blank
      • Type Stream Access
    • ​make another one
      • Name Interface Access
      • Start Address 0.0.0.0
      • End Address 255.255.255.255
      • Level View
      • User Ampache User (system)
      • Key Leave Blank
      • Type Web Interface
  • In your terminal
    • sudo gedit /var/www/music/config/ampache.cfg.php
    • and find the section that looks like this
; Use Access List
; Toggle this on if you want ampache to pay attention to the access list
; and only allow streaming/downloading/xml-rpc from known hosts xml-rpc 
; will not work without this on.
; NOTE: Default Behavior is DENY FROM ALL
; DEFAULT: false
;access_control = "false"

and change it to look like this

; Use Access List
; Toggle this on if you want ampache to pay attention to the access list
; and only allow streaming/downloading/xml-rpc from known hosts xml-rpc 
; will not work without this on.
; NOTE: Default Behavior is DENY FROM ALL
; DEFAULT: false
access_control = "true"

Save the file and exit gedit.

  • Almost Done! Repeat this next section on every client computer.
    • Get the Rhythmbox plugin by clicking here. The home page for this plugin is here, and a discussion on the Ampache forums about it can be found right here.
    • Unpack the plugin into the client computer's /home/YOUR_USER_NAME/.gnome2/rhythmbox/plugins folder and fire up Rhythmbox.
    • In Rhythmbox go to Edit==>Plugins and click on the new Ampache plugin, and click configure.
    • If the lan ip of the server is 192.168.1.3, and it should be static, then set the url to http://192.168.1.3/music/server/xml.server.php For good measure you can enter in the password for the user, but leave the name blank.
    • Save your settings and wait for the library to load, this may take some time for large collections. Also, these setting work for me, if you have problems, check out the forum link I posted.
    • Be Happy! You did it!

You should now have your music collection showing up in everybody's Rhythmbox library! Neat! This is particularly useful if you have a laptop in the living room or kitchen, and your collection of music is in the bedroom or study, and you need some tunes! You can also use this on a server with access from the internet if you have a static ip, or use DynDNS.org or some similar service. I use it to listen to music on my netbook while on campus. We also seem to be more into using the web interface than the Rhythmbox interface, since it simply can do more with the music. This setup (Ampache) is particularly nice, since it is not desktop environment, music player, 3rd party protocol or platform dependent. All you really need is an internet browser. What's more: This solution is 100% F/OSS.

What's also great about this setup? Now you have a working lamp install, and can experiment with other platforms (like Drupal!), and learn yourself some new skills.

Drawbacks? Well, the plugin doesn't seem to be actively maintained (any takers?), and if you use it you have to wait for the library to load every time you start Rhythmbox and this hang can take a few. Other than that, Ampache works wonderfully for us, I hope it works well for you, too!

Let me know what you think!

EDIT 2-2-2009: As if my favorite media server application wasn't already awesome enough: Ampache is getting video support! Hell yes!

Comments

daap

Unverified User's picture

rhythmbox has DAAP built right into it, all you have to do is start it, point it at your collection, and enable the daap plugin. Then enable the daap plugin on all the clients, and, as long as they're on the same subnet, your server will show up right in their rhythmbox and your music is seamlessly integrated. It works well for my 50 GB collection.

If you want to keep your server headless, or just dont want to leave rhythmbox running all the time, you can install mt-daapd, which is in the repos, and will do the same thing for your rhythmbox clients.

daap

joshp's picture

So, if all you need is lan access and your music player has support for it, DAAP can work for you, but if you are interested in accessing your files from the internet, or want more bells and whistles, then Ampache is a fun, stable, and very usable way to go. Ampache can solely run off the web interface, freeing up any need for a specific music player, or even operating system. The web interface also allows you to create, save, or download playlists, show others what you are listening to, and use an embedded flash mp3 player as well, which is nice when you're on the road or at someone else's computer (so long as you have decent upload capacity at home).

I've also heard of using Coherance with Ampache, and using an UPnP device to stream the music to, instead of a computer. This is my next step.

squeezecenter

Hal's picture

I have not used Ampache, so cannot speak about its functions, but I have been using Squeezecenter for some time. It is a music server with a web forntend that lets you stream to any device or player that will play an mp3 stream. There is also a Java app player that works well. You can stream over the internet, and it handles large collections and random playlists really well. It is still in active development as it is the music server for a device called the squeezebox. Squeezecenter is open source, and they have a debian repo that works for Ubuntu installs. It can also stream pretty much any format you may have collected over time.

Mobile streaming?

joshp's picture

Does that stream to say..my internet enabled Centro? I am waiting for something that can do that...or waiting to find something that can stream to my cell form home. That...would be sweet.

streaming to cell from squeezecenter

hal's picture
If your centro can play an mp3 stream, then yes. Only thing I see that might be difficult is you will either have an open port streaming music that anyone can see, or your centro needs to be able to sign in using ssh.

Just FYI

The Open Sourcerer's picture

On a similar note, I, along with a helpful contributor, have managed to create a "drop box" using Samba that allows anyone with access (local LAN usually) to add files and directories to a common share, but *not* and this is the important bit, be able to delete anything... Useful for storing your family photos and we also use it for storing our music too.

http://www.theopensourcerer.com/2008/04/17/a-shared-drop-box-using-samba/

Cheers

what about sshfs?

Tommy's picture

This sounds little complicated. Isn't it just a matter of automounting folders in another machine with sshfs? It has been a stable and fast solution in my home.

There's really nothing

joshp's picture

There's really nothing wrong with sshfs, or complicated about this one. All you do is:

  1. Install the lamp stack and phpmyadmin - 2 commands.
  2. Install Ampache..available in the repos if you choose. If not, just download, unpack it, browse to it w/Firefox and follow the instructions.
  3. Tell Ampache where your music is, and then listen to your music from anywhere via the flash player built into the Ampache interface, or with streaming playslists, or similar built in technology..
  4. Optionally you can

  5. Tell Ampache who can listen and how, and then tell your music player(s) where the Ampache backend is via a plug-in or built in service in Amarok2.

The benefit of this is what I find to be a particularly snazzy web-based front end, with a built in player, that requires absolutely nothing from the client devices. It requires no specific media player, no specific desktop environment, no specific operating system, and no other protocol other than what is already a part of a typical installation on 99.999% of systems: an internet browser, (and optionally a media player that can handle a stream).

What's more, you can connect to this from absolutely anywhere, track who is listening to what, etc. I'm not saying this solution is for everyone, but it's something we find very useful and fun! What's even more than that, I have heard of people successfully using Coherence to connect to the Ampache backend, and then using upnp enabled devices (such as the PS3) to interact with the databse acting as a front end...even neater! So you just browse the entire media library from your PS3, or similar device, right on your TV.

I know there are several ways to go about sharing media on a lan, or over the internet for that matter, and there are drawbacks and benefits to each all of these ways. Here is my favorite set up. I find it very flexible, stable, attractive and easy to use!

http://www.kplaylist.net/

Jason's picture

http://www.kplaylist.net/ .... being using it for 5+ years. Still the best and easiest option for exactly what you are wanting to achieve.

Best damn player in the universe!

joshp's picture

What's nice about Kplaylist: it appears simple, clean with a nice polished look, and lightweight.

Drawbacks: This simplicity appears to leave the interface not quite as full and feature rich as Ampache's for my taste. The Ampache interface is just more...engaging and information rich. There is just more information about what is going on with the music and what is available, and it is presented in a more exciting way. Also, I don't see a way to allow streams to play on music players other than the embedded player on Kplaylist. In other words, to download the playlist and play it on rhythmbox or winamp something like this. Perhaps this is a feature not advertised on the site, and not enabled in the demo? It seems a pretty basic feature, so it should be there. If it is, it's not easy to locate, so the usability score drops.

Also, can you access the backend of Kplaylist with plugins? How easy is it, if you can? Can you use it with Coherence, and make it upnp compatible? How does it fare on internaet enabled mobile devices like a palm centro or blackberry? (Without icecast)

It seems the two approaches, Kplayklist and Ampache, share some basic qualities: Icecast integration, custom playlist creation, a multiuser environment with an optional shoutbox, and other basic features, but Ampache stays on my server, since it seams more feature rich...more options for the end user, and still easy to use. Perhaps I'll give kplaylist another whirl, I passed it up on my search for solutions when I found Ampache because it seemed overly simple, and Ampache seemed more complete.

So, when you guys let the rest of us know about your solution, can you please try to be more specific about WHY it's better for you, and what problem does it solve, and not just "This is the best...etc."? That would be great. I'm hoping to hear more great solutions from my readers, keep 'em coming.

I love suggestions and am a big fan of options, particularly open source options,so keep 'em coming!

playing from browser

achandia's picture
I already have a network with NFS sharing from a server, so I mount the server disks at my stations, that way I play my music locally, but the problem is that one of my stations is running out of memory when I load rhythmbox with all off the songs, so I would like to release resources avoiding to load the files locally and playing them through the browser, do you know how to do this, if so, can you explain it please. since now you have a good how-to. Thanks for your help.

Easy as pie

joshp's picture
If you follow the directions for installing Ampache, this will be default behavior. Ampache even has a built in flash player so you theoretically don't need anything but a web browser. You're welcome

Volume?

Anonymous's picture
Am trying out Ampache now, and so far it's great! One question though. Is there a way to permanently alter the volume on the flash player? It adjusts ok for a song, but then it will revert back to the original volume setting as soon as a new song starts. Any pointers?

subsonic

Anonymous's picture
I have been using subsonic for a few days now, and I like it. But I don't think it is as feature-rich as Ampache, so I will be trying Ampache soon. http://subsonic.sourceforge.net/

ampache + ampache

Anthony's picture
I agree, ampache works great no matter where you are! I use it on the thin clients at work who virtualize pretty much everything. One thing though, as my linux knowledge progresses, my curiosity grows stronger. I want to engage myself with localplay. I have a small computer I want to hook up to my stereo downstairs (where as my server and primary stereo system resides upstairs in a remote part of the house) and attach that installation to my current ampache server and share all the music from my primary ampache server with my secondary and add more music to it locally. The catch is, though, I would like to be able to trigger Localplay through my downstairs/secondary server+stereo setup, so I can go about the house with my laptop controlling the music ALL over the house with my browser on either ampache page. Whew, i know that was long but I have faith that you understand what I'm talking about!

hm...

joshp's picture

If I understand you, you want to be able to set up your downstairs (satellite) system to access your upstairs music library (server), and use a third system, your laptop, to control both of them in sync.

The ampache support irc room is in #ampache on freenode.

I asked and this is what I was told:

Icecast / shoutcast is what you want (Ampache can control both)
mpd -> icecast is the recommended solution
1 ampache server + democratic play + 1 mpd + 1 icecast
then each "client" tunes into the icecast stream
using democratic play each client can independently vote for what they want to hear
highest votes is next played
each client can do whatever they want
could have 5 doing the democratic play thing 2 doing stream one using flash
and at any time any one client could change what "method" they were using
or you can prevent them from doing that if you want

So you want to set up your server (upstairs) with mpd -> icecast, and have it controllable using democratic play, tuning your clients into the icecast stream. I believe that once that is set up, you can mess with the configuration any way you want.

I would really like to know the outcome, let me know!

Where is the flash player?

Ray's picture
This maybe a dumb question, but how to load the flash player? ampache-3.5.4/login.php ? or is in somewhere else. Thanks!

Easy...

joshp's picture

After logging in, in the upper right hand corner there is widget to select to "stream" the playlist, which will spit out the playlist file which you can open with just about any desktop media player,

or to use the "flash player" to play the playlist,

which will pop up the embedded flash player.

Hope that helps.

Ampache Installation

Merry Joy's picture
I am not a computer geek. I am nervous about trying to install this on my own. I am going to try to get my son to help me with it. He is a computer technician and knows quite a bit more about how to do stuff on the computer. I am not comfortable trying to do this on my own. I would really like to try this out though. Its free and it has good ratings which means a lot of people like it! I would love to be able to play all my music that is on my computer on my Palm Pre without using up all my memory on my Palm Pre phone. That is my main reason for wanting to try it. You can email me if you have any suggestions on how to make this easier for a non-geek like me. That is all I have to say for right now. P.S. I just love technology!

For use on a palm pre for a non geek...

joshp's picture
It's actually quite easy to use with a Palm Pre, especially if you have access to the AmpachePre, or Ampache Mobile apps for the pre, which I do, and I love it! If your son follows my directions, it will be easy (unless you are not using Ubuntu, then you have to install Apache, MySQL, and PHP on Windows, which is not within the scope of this article). Good luck, and let me know how you like using Ampache with the Pre! I just want the Pre to be able to recognice the video coming from my Ampache...FUN!

little confused...

Sean's picture
I'm trying to muddle through installing ampache, but you say "create the required database and user for Ampache" I'm stuck on that part. Do you mean create a database titled ampache? I've never used my phpadmin before. Can you shed some light on that part?

re:little confused

joshp's picture
you need to create a database for the ampache script to use. You can call it ampache, or anything you want, as long as your ampache installation knows what the name of the database is.

hi i m neeraj joshi i m using

NEERAJ JOSHI's picture
hi i m neeraj joshi i m using ubntu 8.10 in my laptop,plz give me instruction that how to use rhythmbox music player, also i m unable to use vlc in ubntu 8.10.

Rhythmbox should work just

joshp's picture
Rhythmbox should work just fine in this configuration if you follow the instructions above. Without more information I don't know what you want to know. If you are looking for information outside of the scope of this walk through, then perhaps the Ubuntu Forums is a good place for you. You may also want to consider upgrading to the latest version of Ubuntu (currently 10.10).

Add new comment