User:OliverCharles/DebianSetup

From MusicBrainz Wiki
< User:OliverCharles
Revision as of 23:30, 7 March 2010 by Murdos (talk | contribs) (Perl setup)

MusicBrainz::Server runs really nicely on Debian. Here's how you can get it running! I'm using Debian 5.0.4 (which was stable, at the time of writing)

Perl setup

First, we need a few modules just to kick the build process off.

apt-get install libmodule-install-perl git-core build-essential

Now we can clone the core.git repository and build a Makefile to work from.

git clone git://git.musicbrainz.org/musicbrainz-server/core.git musicbrainz-server
cd musicbrainz-server
perl Makefile.PL

You'll see you don't have most of the modules. You could let the Makefile grab this all for you, but that's going to stick a load of junk all over you Debian system. And I don't like other people leaving their junk all around my house, do you? So, cancel that (keep answering 'no') and lets take care of the easy modules that have Debian packages:

apt-get install libcatalyst-modules-perl libcatalyst-view-tt-perl libdbd-pg-perl libexception-class-perl libhtml-tiny-perl liblocale-po-perl \
                liblist-moreutils-perl libmoose-perl libossp-uuid-perl libreadonly-perl libstring-shellquote-perl libtest-differences-perl \
                libxml-feed-perl libyaml-perl

Stable does not have everything we need though, so we will need to setup some more modules. For this, we will use the excellent local::lib to avoid putting stuff that's not Debian maintianed in our system (and keeping it in our home directory)

cd ~
wget http://search.cpan.org/CPAN/authors/id/A/AP/APEIRON/local-lib-1.004009.tar.gz
tar xzf local-lib-1.004009.tar.gz 
cd local-lib-1.004009
perl Makefile.PL --bootstrap
make test
make install
echo 'eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)' >>~/.bashrc
. ~/.bashrc

This is just what it says to do on the local::lib CPAN page. Now, lets jump back in to installing the Perl modules we need (fullow the prompts you get on screen):

perl Makefile.pl
make installdeps

If you get tired of saying "yes" what a dependency is encountered, you might want to do this:

cpan
o conf prerequisites_policy follow
o conf commit
quit

Once you have done this, you should manually verify the Makefile.PL is indeed satisfied. If any lines do not have "...loaded" the module is missing, and you should install it. Make a note of these, and install them with CPAN:

cpan
install Module::Name::Here

If it still fails, you can force it, with "force install Module::Name::Here"

.In my experience, some need to be installed manually through CPAN, and the following had to force installed. YMMV.

  • Catalyst::Plugin::Unicode::Encoding

Database Setup

(This is going to be much simpler, after NGS launch, phew!)

To setup the database, you need the last stable release of MusicBrainz, which is currently hosted through Subversion. We'll also be needing somewhere to put the database!

apt-get install subversion postgresql-server-dev-8.3 postgresql-contrib-8.3

Grab the latest version:

cd ~
svn co http://svn.musicbrainz.org/mb_server/branches/RELEASE_20090524-BRANCH last-release
cd last-release
cp cgi-bin/DBDefs.pm.default cgi-bin/DBDefs.pm

Open up cgi-bin/DBDefs.pm and check over the database connection details. I like to use the "musicbrainz" user and database, with no password. In order to do this, make sure your pg_hba.conf is set to trust connections (well, this is the easiest solution, anyway, if you know what you're doing there are other approaches). To do this, I set my /etc/postgresql/8.3/main/pg_hba.conf to:

# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
# IPv6 local connections:
host    all         all         ::1/128               trust

Remember to restart your postgresql if you make any changes.

Grab some database dumps now from ftp://ftp.musicbrainz.org/pub/musicbrainz/data/fullexport/:

wget ftp://ftp.musicbrainz.org/pub/musicbrainz/data/fullexport/20100306-000003/mbdump.tar.bz2
wget ftp://ftp.musicbrainz.org/pub/musicbrainz/data/fullexport/20100306-000003/mbdump-derived.tar.bz2

If that wget fails, check that you're using the current link (the dumps expire pretty quick!)