| Run Audiogalaxy on a Linux Server |
|
|
|
| Written by Andrew |
| Tuesday, 30 August 2011 21:55 |
|
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:
*iSub might, but I didn't try it because it is $15.00 after buying the server
Enter AudiogalaxyI 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 InstallationInitially you need to run the installer and verify that everything is working. This requires that you forward the X packets to your local machine:
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: cd ~/.wine/drive_c/users/yourusername rm "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 ConfigurationUnder 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 ScriptsInstall the following scripts for starting Audiogalaxy (and chmod +x them so they can be executed): /etc/init.d/audiogalaxy: #!/bin/sh
case "$1" in
start)
echo -n "Starting audiogalaxy"
/opt/bin/startag
echo "."
;;
stop)
echo -n "Stopping audiogalaxy"
killall Audiogalaxy.exe
echo "."
;;
status)
echo "Showing audiogalaxy processes below:"
ps aux | grep -i audiogalaxy | grep -v grep
;;
*)
echo "Usage: /sbin/service audiogalaxy {start|stop|status}"
exit 1
esac
exit 0
/opt/bin/startag: #!/bin/bash
#####################
## Author: Andrew Martin (andrew "AT" avidandrew.com)
## Description: starts the audiogalaxy server (using WINE)
## Date: 08/30/11
#####################
# start the fake X server
Xvfb :0 -ac -screen 1 800x600x24 &
# set the $DISPLAY variable
export DISPLAY=localhost:0.0
# start audiogalaxy
wine /opt/bin/Audiogalaxy.exe &
# wait a bit to amke sure it stays going
echo -n "Waiting..."
sleep 10
# test to make sure it is still running
ps aux | grep Audiogalaxy | grep -v grep > /dev/null 2> /dev/null
if [ "$?" = "0" ]; then
echo "ok"
exit 0
fi
echo "failed"
exit 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!! |