root/mb_server/trunk/INSTALL

Revision 10408, 14.1 kB (checked in by luks, 1 week ago)

Update install docs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 Install instructions for the MusicBrainz Server:
2 ------------------------------------------------
3
4 These instructions are general instructions for setting up MusicBrainz server.
5 If you want to set up a "slave" replication server (to use the data feed
6 provided by the master server), please read htdocs/docs/Replication.
7
8 Install Levels & Type
9 =====================
10
11 There are three different levels of a MusicBrainz Server:
12
13    - database server only -- run a standalone or replicated MusicBrainz
14                              database without the web interface.
15    - developer install    -- run a MusicBrainz server with web interface
16                              but without all the bells and whistles like
17                              RSS feeds, TRM submission and WikiDocs
18    - full install         -- Everything needed to run all aspects of
19                              a MusicBrainz server.
20
21 Choose your desired install level and then follow the instructions below. If
22 you're doing a DB only or developer install there may be quite a few
23 steps for you to skip, please keep this in mind!
24
25 There are also different types of installations:
26
27    - RT_REPLICATED        -- This is a replicated database install. Once
28                              a data snapshot has been imported, the database
29                              can be kept up to date with running an hourly
30                              data import script.
31    - RT_STANDALONE        -- This install does not updated at all and is
32                              best suited for development installations.
33    - RT_MASTER            -- This install is if you're installing a
34                              Master MusicBrainz server that will feed
35                              replicated servers. You would normally only
36                              install this if you're working on the replication
37                              code or are installing a new MB master server.
38                              Please read htdocs/docs/Replication for more
39                              details.
40
41 The two most common combinations of level and type are:
42
43   - database server only & RT_REPLICATED -- If you want a MusicBrainz install that
44                                             is kept up to date with not web interface.
45   - developer install & RT_STANDALIONE   -- If you want to help develop the MusicBrainz
46                                             server, this is the best starting config.
47
48
49 Requirements:
50 =============
51
52 The MusicBrainz server requires the following items. Please note the
53 inline notes about which type of server you are setting up -- if there are no
54 specific notes about a server type, the instructions apply to all server types.
55
56 1) PostgreSQL 8.1 or later
57
58    Locales
59
60    If you have trouble importing the data because "create unique index"
61    statements fail, please read the locales section in INSTALL.advanced.
62
63    PostgreSQL authentication and Security
64  
65    (Read the Postgres documentation ("Client Authentication") for details).
66
67    For normal operation, MusicBrainz only needs to connect from one or two OS
68    users (whoever your web server / crontabs run as), to one database (the
69    MusicBrainz database), as one Postgres user.  The Postgres database name
70    and user name are given in DBDefs.pm (look for the "READWRITE" key).
71    For example, if you run your web server and crontabs
72    as "www-user", the following configuration recipe may prove useful:
73    
74     # in pg_hba.conf (Note: The order of lines is important!):
75     local musicbrainz_db musicbrainz_user ident mb_map
76
77     # in pg_ident.conf:
78     mb_map www-user musicbrainz_user
79
80    The only time any other connection is required is if the "InitDb.pl"
81    installation script is invoked with "--createdb".  In this case it needs to
82    connect as the "postgres" user, so something else will need to be done to
83    allow that.  You could:
84    
85     a) configure Postgres to allow your MusicBrainz OS user to connect
86        as both "postgres" and "musicbrainz_user"; you can then run
87        everything from one user account, e.g.
88        
89        ./admin/InitDb.pl --createdb --import mbdump*.tar.bz2
90    
91    or
92    
93         b) Run the "--createdb" step separately, from someone who can
94        connect as "postgres" (e.g. the "postgres" OS user):
95
96        # as "postgres":
97        ./admin/InitDb.pl --createdb
98
99        # as your MusicBrainz OS user:
100        ./admin/InitDb.pl --import mbdump*.tar.bz2
101
102 2) A database dedicated to MusicBrainz.  The import scripts will help you
103    create this.
104
105 3) Perl 5.8 or later
106
107    The MusicBrainz server now uses Perl 5.8, required for its Unicode
108    capabilities and the "Encode" module.  Strange encoding problems were
109    observed with Perl 5.6.1.
110
111    Perl is assumed to be installed in /usr/bin/perl -- if you plan to use
112    a different perl location, see INSTALL.advanced for tips on how to do that.
113
114 4) Required perl modules:
115
116    All install levels require these modules:
117
118        DBD::Pg (version 1.32 recommended - see admin/depend.pl)
119        DBI
120        String::ShellQuote
121        LWP::UserAgent (only if you're going to set up a replicated slave)
122
123    If you're doing a database only install, you can skip the rest of the
124    modules.
125
126        Algorithm::Diff
127        Apache::Session
128        Apache::Session::File
129        Apache::AuthDigest
130        Bundle::Apache
131        HTML::Mason
132        Cache::Memcached
133        Date::Calc
134        Devel::Peek
135        Digest::SHA1
136        Digest::MD5 (should be included in Bundle::Apache)
137        HTTP::Negotiate
138        JSON
139        Language::Guess (see notes below about seed data for this module)
140        MIME::Lite
141        Storable
142        String::Similarity
143        Text::Unaccent
144        Text::WikiFormat
145        Time::ParseDate
146        OSSP::UUID (see notes)
147
148    For a more full install you will need to install these following
149    modules:
150
151        XML::RSS -- to display RSS feeds from the blog
152        RDFStore -- to accept POST queries of the old RDF based Web
153                    Service. (use 0.42 if 0.50 gives you install headaches)
154        Time::Duration -- this will give you pretty "last modified on" strings.
155
156    Notes on specific perl modules:
157
158        Language::Guess
159
160        Please download
161        ftp://ftp.musicbrainz.org/pub/musicbrainz/data/language-guess.tar.gz
162        and unpack it into your mb_server directory (i.e.
163        mb_server/data/language-guess/...)
164
165        OSSP::UUID
166
167        This module is currently not in CPAN, but is included in Ubuntu Linux.
168        You can download this module here: http://www.ossp.org/pkg/lib/uuid
169        Installing this module is less painful than the often confusing
170        UUID module from the e2fsprogs package.
171
172 5) Apache with mod_perl and Mason installed. You can skip this step
173    for a database only slave. See the following sites for more details on
174     each of these packages:
175
176       Apache:   http://www.apache.org
177       mod_perl: http://perl.apache.org for details.
178       Mason:    http://www.masonhq.com
179
180    NOTE: When configuring Apache, make sure to not include the built-in
181          expat, since that will conflict with the SiRPAC RDF parser's use
182          of the external expat module. Configure Apache with:
183
184          # mod_perl:
185      perl Makefile.PL \
186         APACHE_SRC=../apache_1.3.37/src \
187         DO_HTTPD=1 \
188         USE_APACI=1 \
189         PREP_HTTPD=1 \
190         EVERYTHING=1
191
192          # apache:
193      ./configure \
194         --enable-module=rewrite \
195         --disable-rule=expat \
196         --prefix=/usr/apache \
197         --activate-module=src/modules/perl/libperl.a
198
199     Also NOTE: Red Hat is known to ship their Apache packages with the
200                built-in expat support enabled, so you will have to build
201                Apache from scratch on Red Hat systems.
202
203     WARNING!  Don't compile Apache with mod_perl built as a DSO (Dynamic
204               Shared Object).  Mason doesn't get along with a DSO mod_perl
205               (though it's not alone). If you do build mod_perl as a DSO,
206               Apache can (and probably will) segfault or die silently on
207               startup.
208
209 5) Expat XML Parser library: http://sourceforge.net/projects/expat
210    Skip this step for a database only install.
211
212 6) Memcached: http://www.danga.com/memcached/
213    This is optional, but strongly encourged if you are going to be running
214    a MusicBrainz web site as well.
215    Skip this step for a database only install.
216
217 9) Other dependencies
218
219    Run ./admin/depend.pl to check to make sure that all the dependencies
220    have been met.
221
222
223 Installation:
224 =============
225
226 1) If you want to import the current live data into your database, you need
227    exactly the same version of the server codebase that created the database
228    snapshot. Otherwise the schema could be incompatible and the import would
229    fail. The same directory where you downloaded the snapshots also contains
230    a README file giving you the exact subversion command line to check out
231    the code.
232
233    NOTE: All releases of the MusicBrainz server are developed on branches, so
234      checking out code from the trunk is almost never the correct choice.
235      Depending on the release date, the URL has the following format:
236      http://svn.musicbrainz.org/mb_server/branches/RELEASE_yyyymmdd-BRANCH
237
238 2) Make sure you have all the prerequisite pieces of software installed.
239    Installing perl modules using CPAN is easier than doing it by hand.
240    To use CPAN, as root type 'perl -MCPAN -e shell'.
241
242 3) Decide on a name for your database (e.g. musicbrainz) and a database
243    owner (e.g. musicbrainz).  Decide on a location for the mb_server code.
244    Pick directories for storing Mason and session/lock data.  If you pick
245    these values, you'll have less work to do in the next step:
246
247    Database:
248    - database name "musicbrainz_db"
249    - database user "musicbrainz_user", with no password
250
251    Directories:
252    - mb_server code: /home/httpd/musicbrainz/mb_server
253    - Mason data:     /home/httpd/musicbrainz/mason
254    - session data:   /home/httpd/musicbrainz/sessions
255    - session locks:  /home/httpd/musicbrainz/locks
256
257    Make sure your "session data" and "session locks" directories exist.  (The
258    "Mason data" directory will be created automatically if it doesn't exist).
259
260 4) Edit the following files (in mb_server) to match the choices you made in
261    the previous step:
262
263    cgi-bin/DBDefs.pm
264      NOTE: You can find a default version of DBDefs.pm in DBDefs.pm.default;
265            copy this to DBDefs.pm and edit this.
266
267      This just contains lots of configuration settings; read the comments
268      in the file for more information.  There's at least one setting in there
269      which MUST be changed for you to run a server (SMTP_SECRET_CHECKSUM);
270      most of the settings you can probably leave unchanged if you wish.
271
272    admin/apache/startup.pl
273      NOTE: You can find a default version of startup.pl in startup.pl.default;
274            copy this to startup.pl and edit this.
275
276      There's only one thing to change here, namely the "use lib" line,
277      which is marked with a "TODO" comment.
278
279    admin/apache/vh_mb_backend.conf
280      NOTE: You can find a default version of vh_mb_backend.conf in
281            vh_mb_backend.conf.default; copy this to vh_mb_backend.conf and
282            edit this.
283
284      This contains many things to customize - look for the TODO comments,
285      which point out things that you might need to change.
286
287 5) Assuming you want to start off with a fully-populated database, you'll
288    want to download the database dump files from the FTP site:
289
290    ftp://ftp.musicbrainz.org/pub/musicbrainz/data/fullexport/<date>-<timestamp>
291
292    The FTP site contains two snapshots -- pick the latest snapshot and then
293    download the files with:
294
295    wget --mirror ftp://ftp.musicbrainz.org/pub/musicbrainz/data/fullexport/<date>-<timestamp>/*tar*
296
297    If you are setting up a development server you will probably want to
298    import all of the database dumps. However, for a slave server, you will
299    want to download only the following dumps:
300
301       mbdump-artistrelation.tar.bz2   
302       mbdump.tar.bz2
303       mbdump-derived.tar.bz2
304
305    Download the appropriate dump files, double-check your settings in
306    DBDefs.pm, make sure Postgres is running, then run the "InitDb.pl"
307    script, passing it the names of the "dump" files you just downloaded:
308
309     ./admin/InitDb.pl --createdb --echo --import mbdump*.tar.bz2
310
311    (but see the above notes about Postgres authentication and security).
312
313    When run in this way, the script should do everything, including creating
314    the database for you.  As a rough guide, on my Athlon 2500+ box it takes
315    about 90 minutes to run this step, creating and loading a full database.
316
317 NOTE: Steps 6 - 8 are optional for database only slaves!
318    
319 6) Configure Apache to use Mason.  In the admin/apache directory you will find
320    the vh_mb_backend.conf file, which is a VirtualHost fragment for Apache's
321    httpd.conf file.  I suggest you run MusicBrainz as a virtual host.
322    You should only have to import vh_mb_backend.conf into your virtualhosts section
323    of your httpd.conf file.  In the admin directory you'll also find
324    startup.pl, which is the mod_perl startup file.  You should have already
325    customised these two files in step 3.
326
327 7) Copy all the files/subdirs in the htdocs directory into DocumentRoot
328    directory that you specified in httpd.conf. Then copy all the files/subdirs
329    from the cgi-bin dir into the ScriptAlias directory specified in httpd.conf
330
331    However, I usually point my apache configuration right into my
332    svn checked out source. If you've done this, you can skip this step.
333
334 8) Now start Memcached and Apache and you should be set and ready to roll.
335    Go the the selected URL and you should see a MusicBrainz site, complete
336    with data.
337
338 9) Cron jobs (mostly optional, except for slaves)
339    The admin/cron directory contains some scripts to run hourly, daily and
340    weekly.  You might want to add these scripts to your server's crontab.
341    These scripts use various settings from ./admin/config.sh, which you'll
342    need to tweak to suit your installation before running them.  "daily.sh" in
343    particular is heavily geared towards the configuration of the main
344    MusicBrainz server; you probably will want to modify it in some way.
345
346    For slave servers, you need to add an hourly cron job (that runs
347    about 10 - 12 minutes after each hour) that runs the admin/cron/slave.sh
348    file to download and apply replication packets from the main server.
349
350    This should be it and now you have your very own MusicBrainz server.
351
352 Good luck!
Note: See TracBrowser for help on using the browser.