Running Google Music Beta on a Headless Linux

KeyWords: google, music, beta, manager, linux, headless, daemon, automatic, run, vnc, server, command, line, cli, x11, xserver, x windows, setup, howto, tutorial

Having received a Google Music Beta invite and finding out that Google Music Beta supports linux, I decided to venture down the path of getting Google Music Beta to run on my headless Linux Server as a daemon. In an attempt to not have to copy my music off of my RAID Array just to upload it to Google. Luckily this process was actually really easy. My server is Debian based, so the instructions are for a Debian based Linux server (Ubuntu distros should work as well). The first thing to do is to download Google Music Beta Linux version. There is a .deb or .rpm, since this is for a Debian based distro I opted for the .deb. I have heard rumors that in order to get the Linux download file, you need to have a Linux User Agent setup in your browser. If you are not using Linux, google your browser and how to change the User Agent. I have provided an Agent string that should work: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4 (Splashtop-v1.0.5.0) Let me know of any problems with it and I will find another one.

Installing the Google Music Beta Manager
The first step will be to obviously install Google Music Beta Manager, this will require a few pre-requisites on the Server. Since my system is headless the main package that needed to be installed was X11 (I already had X11 installed for other items I do on my headless linux server). If you do not have X11 installed, the process may take some time to install, so be patient with it. Next I ssh'ed in to install few extra packages that are required by Google Music Manager Beta. Running a: sudo apt-get install libqtgui4 libqt4-network libvorbisfile3 xdg-utils should install the packages required. Once those are installed, cd to where you downloaded the Google Music Beta Manager to on the server (I used wget to download the .deb) and since I have a 32 bit system, I grabbed that version, here is a link (this may break at anytime and could change, so I would suggest getting the link from Google Music Beta's site.: wget http://dl.google.com/linux/direct/google-musicmanager-beta_current_i386.deb. Now that the file is on my server and the pre-requisites have been installed, it is time to install Google Music Manager Beta! Luckily this is pretty simple: sudo dpkg -i google-musicmanager-beta_current_i386.deb (again that may change if you are on x64 or a different distro so use that file name instead). Now Google Music Manager is installed, but how will we access the interface on the headless?

Accessing Google Music Manager Beta on Headless
Of course, if you do not want to run Google Music Manager Beta as a daemon (running the background) then all you have to do is setup X11 forwarding over SSH and you can stop reading here (ssh -X servername), however, if you want to leave it running as a daemon like process, we have to get a bit more creative than that. First up let's install the pre-requisites for this part. sudo apt-get install xvfb Xvfb is a VNC server, which we can setup on a headless linux as a display and run the Google Music Manager Beta inside of it. Once that is installed, we will want to create a bash script, the script is very simple:

Edit: Thanks to anonymous, I updated this with a cool option so you do not have to vnc in and enter your password! Thanks again!

#!/bin/bash
export DISPLAY=:2
Xvfb :2 -screen 0 1024x768x16 &
google-musicmanager -p mypassword &
x11vnc -display :2 -bg -nopw -listen localhost -xkb


I named the file googlemusic.sh. After that I did a chmod +x googlemusic.sh to make it executable. Once that has been done, I simple did a ./googlemusic.sh When this runs you will see a lot of output on the screen, do not worry about it. Press enter and you should be back at the command line. A ps aux | grep google should tell you if google-musicmanager is running. Edited instructions, given the -p command line option. If it is, then let's exit out of the server's ssh connection and get back to your desktop. Since I run a Debian Linux box, I installed xvnc4viewer: sudo apt-get install xvnc4viewer. Once that was done I just needed to create an ssh tunnel for the 5900 port. ssh -p 9450 -fCNL 5900:localhost:5900 server.name This will be ran in the background of the desktop (this can also be done in PuTTY, see the instructions here). Now that we have the 5900 port tunneled, it is a simple vncviewer localhost and now you should see the Google Music Manager Beta asking you for your username and password. Go ahead and enter it in and follow the setup procedure. Once it is done, you can close the VNC session and Google Music Manager Beta will continue to run in the background on your server!

Notes
After doing this myself I learned a couple items. Edited instructions, given the -p command line option. One, you seem to have to always authenticate manually to Google Music Manager Beta. This is annoying, so if you do add the googlemusic.sh file to the start up, remember to VNC in to login to Google Music Manager Beta after the fact. If you are on Windows, using a program like UltraVNC Viewer, you should be able to connect if you setup the SSH Tunnel over port 5900 via PuTTY (or using cygwin). Other than that, your music should be set to auto upload (as long as you told it to upload new music) and it should start transferring music, then when you buy music and add it to the folder, it should automatically upload that music as well. I have found after I have disconnected from the initial VNC session I need to re-run the command: x11vnc -display :2 -bg -nopw -listen localhost -xkb in order to connect back up to the VNC session, just a little tidbit that had me confused for a few minutes.

Finished
That is pretty much it. Hopefully Google offers a Command Line Interface mode or daemon option in the future for the Music Manager in Linux, that would be awesome and extremely helpful. If Google does not well at least the method I described above should work just fine. If you have any tips, problems, etc please let me know, I am all about improving the article and getting a better performance for myself as well. For now, enjoy your Google Music Manager Beta running on a headless Linux server!

Posted by frost on Jul 28th, 2011 22:25 - Subscribe Bookmark and Share


Post a comment:


ReCaptcha:

Posting as anonymous Anonymous guest, why not register, or login now.



Posted by anonymous on July 31st, 2011

Very useful thanks. Hopefully Google make it easier. I recall SimplifyMusic had a daemon app that was able to run in the background. Since Google Music is made by the same team, hopefully they can deliver something similar.



Posted by anonymous on August 29th, 2011

Thanks for this. Also hoping they add some command line options further down the line.



Posted by anonymous on September 04th, 2011

I am the poster of the comment from August 29th. I was just looking through the Google music help and found the response to an issue:

"In the meantime, other users have reported that they've been able to work around the issue by starting the program, and with the "-p" option followed by their password, it logs them in successfully without a windowed prompt asking for the password. /opt/google/musicmanager/google-musicmanager -p mypassword"

This would imply that there may be some other command line switches that are not advertised. Even running with the above options requires X11 forwarding. I'll keep trying things to see if there is a way I can get it running without the UI.



Posted by anonymous on October 01st, 2011

Very nifty guide. Thanks. A suggestion though, adding -forever parameter to x11vnc will allow the server to continue running after you have disconnected allowing it to listen for additional clients.



Posted by frost on October 01st, 2011

Awesome, thanks for that!

Also, it might be wise to store the password in a separate file and modify the permissions so it is not shown during a ps aux listing. If I get a chance I will update the entry.



Posted by anonymous on May 29th, 2012

I took the most recent google-musicmanager-beta update this last week and now the program starts and appears to be running but does not upload new songs I add to my music directory.
Anyone else having a similar issue?



Posted by anonymous on November 23rd, 2012

Thanks for the solution. On ubuntu you should try the -auth and the -forever option:

x11vnc -auth ~/.Xauthority -display :2 -bg -nopw -xkb -forever

Greetings, Martin



 

Widget

Hypersmash.com

Extras

  • Not Implemented