Tutorial – Installing GNU FM

I recently heard about a neat little site called libre.fm that provides a last.fm like service for listening to and sharing your musical interests. Libre.fm, however, runs on free software, respects user privacy, and includes only freely licensed music. The software that powers libre.fm is called GNU FM. I installed it on my home server just to check it out. This post explains what I had to do to get a working installation. The GNU/Linux distribution that I am using is Debian Squeeze. Hopefully this guide can be of help to someone.

Prerequisites

This guide makes the assumption that you already have a functional web server (Apache, nginx, etc.), PHP 5, and database server (either MySQL or PostgreSQL).

Setup Database

I made a MySQL user specifically for GNU FM

CREATE USER 'gnufm'@'localhost' IDENITIFIED BY 'yourpassword';

Create a database

CREATE DATABASE gnufm;

Download Source

GNU FM uses Git for version control. The source is available from gitorious. Clone the repository with the following command.

git clone git://gitorious.org/foocorp/gnu-fm.git

Install Gnukebox

From the gnu-fm directory, copy the server application, gnukebox, to the web server directory.

cp -r gnukebox/ /var/www/

From your web browser, go to http://yourwebserver/gnukebox/install.php. It’s quite straight forward. Enter the information in for your database server like the database name and the user that you have created.

If the web server cannot write to the directory in which you installed gnukebox, you will see a page that prints out the configuration code that you will need to manually insert into the config.php file in the gnukebox directory.

Install Nixtape

From the gnu-fm directory, copy the web interface, nixtape, to the web server directory.

cp -r nixtape/ /var/www/

From your web browser, go to http://yourwebserver/nixtape/install.php. You will enter the same database details as you did for gnukebox and give your GNU FM server a name.

Once again, if the web server cannot write to the directory in which you installed nixtape, you will see a page that prints out the configuration code that you will need to manually insert into the config.php file in the nixtape directory.

Nixtape requires some extra PHP libraries to be installed along with it. Please note that the version numbers of these libraries may be different depending on how far you in the future you are coming from. Which means that copy/paste’ing the commands I give you will not work, but you’ll probably only have to change the version number in the command to make it work.

Install ADOdb

ADOdb is a database abstraction library for PHP. Installing the library takes just a simple apt-get.

apt-get install php5-adodb libphp-adodb

Install Smarty

Smarty is a PHP templating library that nixtape uses for all web pages. There are packages available in the Debian Squeeze repository, but GNU FM does not work with them. The problem is the result of a slightly different path to the files contained in the Debian package. Since the GNU FM repo has a .tar.gz archive of Smarty within it, we’ll just install that instead.

From the gnu-fm directory, cd to the external_dependencies directory.

Extract Smarty and the Smarty text plugin.

tar zxf Smarty-2.6.22.tar.gz
tar zxf smarty-gettext-1.0b1.tgz

Copy the needed files to the nixtape directory.

mkdir /var/www/nixtape/smarty
cp -r Smarty-2.6.22/libs/ /var/www/nixtape/smarty
cp smarty-gettext-1.0b1/block.t.php /var/www/nixtape/smarty/plugins

Create a templates_c directory for compiled templates and make it writeable by the web server user.

mkdir /var/www/nixtape/themes/gnufm/templates_c
chgrp www-data /var/www/nixtape/themes/gnufm/templates_c
chmod 775 /var/www/nixtape/themes/gnufm/templates_c

Profit!

At this point I was able to have a working GNU FM installation. There are still plenty of things left to do such as add music, add a new theme, etc. Maybe once I get around to doing those things I will make a follow-up tutorial. Anywho, I hope this has been of some use to you folks out there in Internet land. Still having a hard time setting up GNU FM? If so, head on over to #libre.fm on irc.freenode.net and ask the developers for help. Oh, and don’t forget to leave a comment if there’s an error or something you would like me to improve in this tutorial. You can also leave a comment and say what a great guy I am. 🙂

Take it easy.

3 thoughts on “Tutorial – Installing GNU FM

  1. Hey David – thanks for posting this. I’ve been thinking about the idea of striking up a server myself but as a current Libre.fm user I am stuck with the idea that it’s not federated – meaning on a new server I’d be starting from scratch with my stats (short of exporting and re-importing them somwhow).

    Do you plan on opening your implementation up to the public? I like libre.fm for what they do and how they do it but the interface and features could use some work. I’m curious if you plan to extend that.

    And while I am here, I wrote a GNU-fm scrobbler for Google Music (Google Play) here:

    http://gitorious.org/anomaly-for-gnu-fm

    and one specific to Libre.fm is available in the Chrome Web store here:

    https://chrome.google.com/webstore/detail/ajbkmdgmhbjjhephmgbpgialfbnjbmkb?utm_source=chrome-ntp-icon

    Cheers,
    Darryl

    • Hey Darryl,

      Just so you know. We are now federated. We even have special federation for Last.fm.

      I hope you’re enjoying Libre.fm and if not, write to me and tell me why.

      Best,
      matt

  2. Thanks for making the first real comment on my blog!

    I heard one of the developers give a talk about that involved libre.fm the other day. If I remember correctly, the GNU FM developers are working on federation via OStatus. I have contacted the developers about helping them out. So, hopefully I will be helping make things better for people such as yourself. Another one of the developers gave a talk about libre.fm that you might find informative: http://www.youtube.com/watch?v=PL2wSA3uc3I

    The server running my copy of GNU FM is just a small Intel Atom machine that I have at home, so it couldn’t handle any real world web traffic. Thus, I won’t have a publicly available server. However, I do want to acquire some webspace to host one in the future. I have a couple of ideas for a niche GNU FM service: A site for New England-based artists since I am from Massachusetts, or a site for freely licensed punk rock.

    The scrobbler you wrote seems nice from the description/screenshot. I don’t use Google Music so I can’t give it a spin myself, but maybe someone else that stumbles upon this blog can. I personally use MPD+Sonata, which is a pretty obscure media player. Sonata scrobbles to last.fm but I may try to make it scrobble to libre.fm or any other GNU FM server if I find the time.

    Thanks again for commenting!

Leave a Reply

%d