Recently I have been looking for a way to stream music from my Ubuntu server to my iOS devices. I've investigated several options, including Plex, StreamToMe, iSub, Ampache, Air Playit, and others. However none of these* provide two features I really want to have:
- queue tracks as you are listening to one so that your queue just keeps playing as you listen. I love this feature in Rhythmbox because it makes it so easy to listen to exactly what you want on-the-fly
- download/cache songs on the iOS device so that I can listen to them when I do not have WiFi access. This will allow me to stream and download, the best of both worlds.
*iSub might, but I didn't try it because it is $15.00 after buying the server
Enter Audiogalaxy
I then came across Audiogalaxy, a free app for iOS and Android. You create an account, start an Audiogalaxy helper program on your server, and launch the app on your device. It is easy because the server application is tied to your Audiogalaxy account and automatically connects you to your server, no port forwarding or hostname entering required. There currently isn't a Linux version of the server, though one is in development. The developers have reported a number of people getting the server to work under WINE, so I tried it out and was able to get it running on my Ubuntu 11.04 desktop. However, I want to run it on my Ubuntu server, which does not have X11 installed and thus no graphical environment for WINE. To get around this and get the server working, I used the fake X11 server xvfb.
Initial Server Installation
Initially you need to run the installer and verify that everything is working. This requires that you forward the X packets to your local machine:
- install the
xauth
package on the server to forward the X packets - open
/etc/ssh/sshd_config
in a text editor as root and make sureX11Forwarding
is set to "yes". If you needed to update this file restart ssh:sevice ssh restart
- open an ssh connection to the server, using the -X option:
ssh -X user@serverhostname
If you are running Linux locally, you are already running an X server.
For Mac OS X you need to launch the installed X11 application. For
Windows, use xming. Try launching Audiogalaxy using WINE on your
Ubuntu server: wine Audiogalaxy.exe
. If everything works, you should
see an icon appear in your system tray. Audiogalaxy will now be running
and scanning your "My Music" folder in the WINE bottle. You now need to
point this folder to your music collection:
1cd ~/.wine/drive_c/users/yourusernamerm "My Music"ln -s /path/to/your/music "My Music"
Now check the Audiogalaxy web client or mobile client after a few minutes and you should see your songs start to appear.
Permanent Server Configuration
Under normal circumstances you want the fake x server (and thus Audiogalaxy) to remain running when you are not connected to the server. To accomplish this, install xvfb, a fake X server. Then create the init scripts below to start the server using the fake X11 environment.
Init Scripts
Install the following scripts for starting Audiogalaxy (and chmod +x them so they can be executed):
/etc/init.d/audiogalaxy:
1#!/bin/sh
2case "$1" in
3 start)
4 echo -n "Starting audiogalaxy"
5 /opt/bin/startag
6 echo "."
7 ;;
8 stop)
9 echo -n "Stopping audiogalaxy"
10 killall Audiogalaxy.exe
11 echo "."
12 ;;
13 status)
14 echo "Showing audiogalaxy processes below:"
15 ps aux | grep -i audiogalaxy | grep -v grep
16 ;;
17 *)
18 echo "Usage: /sbin/service audiogalaxy {start|stop|status}"
19 exit 1
20esac
21exit 0
/opt/bin/startag:
1#!/bin/bash
2######################
3# Author: Andrew Martin (andrew "AT" avidandrew.com)
4## Description: starts the audiogalaxy server (using WINE)
5## Date: 08/30/11
6#####################
7# start the fake X server
8Xvfb :0 -ac -screen 1 800x600x24 &
9
10# set the $DISPLAY variable
11export DISPLAY=localhost:0.0
12
13# start audiogalaxywine /opt/bin/Audiogalaxy.exe &
14
15# wait a bit to amke sure it stays going
16
17echo -n "Waiting..."
18sleep 10
19
20# test to make sure it is still running
21ps aux | grep Audiogalaxy | grep -v grep > /dev/null 2> /dev/null
22if [ "$?" = "0" ]; then
23 echo "ok"
24 exit 0
25fi
26
27echo "failed"
28exit 1
Add /etc/init.d/audiogalaxy
to the default runlevels to start when the
system boots by running: update-rc.d audiogalaxy defaults
. Now, run
service audiogalaxy start
to start the server. Use
service audiogalaxy status
to confirm that the server is running and
then you can disconnect and enjoy your Audiogalaxy music streaming from
a Linux server!!