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.
From the blog David Thompson » WSU CS by davexunit and used with permission of the author. All other rights reserved by the author.