Skip to content
Byrne Reese edited this page May 12, 2011 · 4 revisions

Installing Melody on a CentOS System

This guide covers the procedures for setting up an entire server designed to run a Melody System. The server discussed will serve as the blueprint for the baseline system configuration.

Overview

What you will need

  • A server with CentOS release 5.2 (Final) installed [^2]
  • Root access
  • Internet connectivity

It is also assumed that your system already has yum installed, which should be a standard component of any CentOS system.

[^2]: If you are unsure what linux distribution you are running, check the contents of the file “/etc/redhat-release”

What will be done

Before the actual instructions are provided, let's first cover what we intend to install and ensure is operational before we continue.

  1. Setup Apache
  2. Install Fast CGI
  3. Install MySQL
  4. Install PHP
  5. Setup directories for logging
  6. Install all prerequisites for Melody
  7. Install Melody and Motion
  8. Setup the Melody run-periodic-tasks script
  9. Install and setup Sphinx Search

Installation and Setup Instructions

Execute the following commands as necessary:

  1. Setup users for MySQL. Typically this should not be necessary because by installing mysql via yum this should be done for you automatically. However in some systems, this has failed. Therefore, by doing this manually you ensure that it will not fail later. Run the following command:

     prompt> /usr/sbin/groupadd mysql
     prompt> /usr/sbin/useradd mysql -g mysql
    
  2. Create the directory we will use for capturing all Melody related logging info:

     prompt> mkdir /var/log/melody/
     prompt> chown -R apache /var/log/melody
     prompt> chgrp -R apache /var/log/melody
    
  3. Download and install Yum GPG keys:

     prompt> rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
     prompt> rpm --import http://centos.karan.org/RPM-GPG-KEY-karan.org.txt 
    
  4. Setup additional yum repositories needed for Fast CGI and Memcached. We will create a new file called /etc/yum.repos.d/mt-CentOS-Extras.repo. In it, place the following contents:

     # All new packages are now released to the testing repository first
     # and only moved into Stable after a period of time
     # Note: The testing repository is disabled by default
     [dag]
     name=Dag RPM Repository for Red Hat Enterprise Linux
     baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
     gpgcheck=1
     enabled=1
    
     [kbs-CentOS-Extras]
     name=CentOS.Karan.Org-EL$releasever - Stable
     gpgcheck=1
     gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
     enabled=1
     baseurl=http://centos.karan.org/el$releasever/extras/stable/$basearch/RPMS/
    
     [kbs-CentOS-Testing]
     name=CentOS.Karan.Org-EL$releasever - Testing
     gpgcheck=1
     gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
     enabled=1
     baseurl=http://centos.karan.org/el$releasever/extras/testing/$basearch/RPMS/
    
  5. Install all required libraries and applications via yum. For each of the following applications you will enter the following command: "yum install " where "" should be replaced with the application/library you want to install. Each package may have additional prerequisites, in which case those additional packages must also be installed. Here is a list of all the packages you will need to install via yum:

  • emacs [^3]
  • ImageMagick
  • mysql [^4]
  • php*
  • memcached
  • mod_fcgid
  • openssl
  • glib
  • freetype
  • libtiff
  • libxml
  • libxml2
  • ImageMagick-perl

Yum allows you to install multiple distributions all at once. As a convenience you can also just execute the following:

prompt> yum install ImageMagick php memcached mod_fcgid openssl glib freetype \
    libtiff libxml libxml2 ImageMagick-perl

[^3]: Unless of course you are a masochist and use vi. :)

[^4]: If you are installing the MySQL server on a different machine, then there is actually no need to run yum install mysql* which effectively installs all mysql components onto your local system, including obviously the server itself. So in a situation where you are running the database on a different server, all you need to install run is yum install perl-DBD-mysql

  1. Initialize the MySQL database server:

    prompt> mysql_install_db

Note: Don't forget to secure your installation by changing the root password for MySQL.

  1. Start the MySQL database server:

    prompt> /etc/init.d/mysql start

  2. Setup your Apache Virtual Host directories.

    prompt> mkdir -p /var/www/vhosts/www.somedomain.com/htdocs/ prompt> mkdir -p /var/www/vhosts/www.somedomain.com/cgi-bin/melody/

Please note, that on a Plesk managed system, this step is not necessary as Plesk will create these directories for you when you setup your domain.

  1. Setup your Apache configuration file. See "Configuration Files." Placing it in this directory will cause Apache to load it automatically, assuming you have a standard install of Apache on your web server.

    prompt> emacs /etc/httpd/conf.d/melody.conf

Plesk users will want to

  1. Install all necessary Perl Modules. For each of the following Perl modules, you will need to execute the simple command cpan <module name>. Some of the modules below have additional prerequisites, and some have a lot of them. Be sure to "follow" and install all necessary prerequisites. Pay close attention to what is output to the console and make sure all the perl modules are installed properly. If a module is not installed, resolve the issue prior to continuing. See Installing Perl Modules. Install these modules:

    • Bundle::CPAN
    • Convert::PEM
    • Archive::Zip
    • Archive::Tar
    • Crypt::DSA
    • XML::Atom
    • Mail::Sendmail
    • IPC::Run
    • FCGI
    • Cache::Memcached
    • Cache::Memcached::Fast
    • GD
    • XML::XPath
    • JSON::XS

This is the most time consuming part of the installation. So go get a coffee or something. Be careful not to leave the terminal unattended for too long though because it will prompt you from time to time. You can turn that off though by: TODO

  1. Download Melody into your home directory.

  2. Install Melody. You will need to download the latest version of Melody from openmelody.org, and then copy the files into the proper location.

    prompt> unzip melody-v1.0.0.zip prompt> cp -a melody-v1.0.0/* /var/www/vhosts/www.somedomain.com/cgi-bin/melody/

  3. Setup your Fast CGI scripts, which are nothing more than copies of the core Melody .cgi scripts using the file extension .fcgi.

    prompt> cd /var/www/vhosts/www.somedoman.com/cgi-bin/melody prompt> for file in ls *.cgi; do base=basename $file .cgi; cp $base.cgi $base.fcgi; done

  4. Setup run-periodic-tasks by editing the crontab for the apache user:

    prompt> sudo -u apache crontab -e -u apache

    When your text editor comes up, you will need to enter the following into the file (all on a single line), save and then exit:

    0,5,10,15,20,25,30,35,40,45,50,55 * * * *
    cd /var/www/vhosts/www.somedomain.com/cgi-bin/melody;
    perl ./tools/run-periodic-tasks

Note: The version of the Sphinx Search plugin currently available for download with Melody is non-functional. The following instructions will not work until such time as Six Apart updates their plugin.

  1. Download and install the Sphinx search engine. Visit the following URL to download the Sphinx Search engine:http://www.sphinxsearch.com/downloads.htmlThen install it using the following sequence:

    prompt> tar zxvf sphinx-0.9.8.1.tar.gz prompt> cd sphinx-0.9.8.1 prompt> ./configure prompt> make prompt> make install

    We will assume for the remainder of this manual that your sphinx.conf file has been placed in:/etc/sphinx/sphinx.conf

  2. Download and install Sphinx Search Plugin for Melody. Visit the following URL to download the Sphinx Search plugin for Melody:

    http://www.apperceptive.com/plugins/sphinxsearch/

    Then install it using the following sequence:

    prompt> unzip SphinxSearch-0.99.8mt4.zip prompt> cp -a SphinxSearch-0.99.8mt4/plugins/SphinxSearch
    /var/www/vhosts/www.somedomain.com/cgi-bin/melody/plugins/

  3. Set up the Sphinx Search Plugin for Melody by reading and following the instructions at this URL:

    http://www.apperceptive.com/plugins/sphinxsearch/documentation.html

    The instructions will guide you through the process of generating a sphinx.conf file and starting the searchd daemon.

THE FOLLOWING DOES NOT WORK YET. DO NOT DO. Sorry.

  1. Optional: Setup Sphinx init.d scripts to ensure that sphinx will start automatically if the server is rebooted. Visit the following URL and follow the instructions under "Create Searchd init.d Script:"

    http://www.notsofaqs.com/catsdoc/doku.php?id=sphinx:install

    Note: the /etc/init.d/searchd script provided will need to be edited to point at your sphinx.conf file. Look for:startproc -l $LOGFILE $SEARCHD --config \ /srv/www/htdocs/cats/modules/search/sphinx.confAnd change it to:startproc -l $LOGFILE $SEARCHD --config /etc/sphinx/sphinx.conf

Installing Perl Modules

Normally the process of installing Perl modules is very, very straightforward. Most systems come standard these days with a Perl package manager, not dissimilar to yum or apt, called "cpan." In almost all circumstances the process of installing a Perl module is as simple as running the following command as root:

 prompt> cpan Perl::Module

What do to when things fail

Sometimes a Perl module will have tons of prerequisites, and for whatever reason, one of those prerequisites will stubbornly not install. The first thing to try is identify the perl module having difficulty, and try to install that module separately. Let's take a look at an example:

prompt> cpan Perl::Module
***** snip *****
---- Unsatisfied dependencies detected during [B/BY/BYRNE/Perl-Module-0.01.tar.gz] -----
XML::Simple
Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes]
***** snip *****
Running make for G/GR/GRANTM/XML-Simple-2.16.tar.gz
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install

Depending upon how many prerequisites are queued up for installation the key phrase "Make has some problems, won't install" may scroll by on your console too quickly for you to see. If you see a bad exit status when your prompt returns, however, scroll back up and identify which module had difficulty. In this case, it is XML::Simple. So now, try to install that module separately like so:

prompt> cpan XML::Simple

Doing this has two advantages:

  1. It will help you to isolate the build error that occurred.
  2. It may actually work. Why? I don't know, but sometimes CPAN has difficulty installing lots of Perl modules at once.

If this works and the module is installed properly, then try re-installing the Perl module you were trying to install initially.

If it does not work, then there is most likely a missing dependency or pre-requisite. Consult the documentation for the perl module that is failing and see if anything can be learned.

Under virtually no circumstances should you "force" the installation of a Perl module. If a unit test fails, then that is an indication that something is wrong. And if something is "wrong" it is best to determine what it is, resolve it, and then continue. This is a production system after all, don't you want everything to be perfect?

Appendix A: Configuration Files

The following section contains all of the various configuration files you will need:

Yum Repositories

The following file should be placed in /etc/yum.repos.d/mt-CentOS-Extras.repo

Apache Configuration File

The following file should be placed in /etc/httpd/conf.d/melody.conf

  • Replace "127.0.0.1" with the IP address of your server

  • Replace www.somedomain.com with the domain name of your server.

  • Replace yourname@somedomain.com with your email address.

    <VirtualHost 127.0.0.1:80> ServerName www.somedomain.com DocumentRoot /var/www/vhosts/www.somedomain.com/htdocs/ ServerAdmin yourname@somedomain.com DirectoryIndex index.php index.html CustomLog /var/log/melody/access_log common ErrorLog /var/log/melody/error_log LogLevel info RewriteEngine on # rewrite rules go here php_value magic_quotes_gpc off AddHandler fcgid-script .fcgi AddHandler cgi-script .cgi
    Alias /cgi-bin/ /var/www/vhosts/www.somedomain.com/cgi-bin/
    <Directory /var/www/vhosts/www.somedomain.com/cgi-bin/> Options ExecCGI FollowSymLinks Includes AllowOverride Limit Order allow,deny
    Allow from all

vhost.conf (Media Temple)

See also: http://kb.parallels.com/article_41_432_en.html

DirectoryIndex index.php index.html
LogLevel info
<IfModule mod_rewrite.c>
     RewriteEngine on
     # rewrite rules go here
</IfModule>
<IfModule php5_module>
     php_value magic_quotes_gpc off
</IfModule>
AddHandler cgi-script .cgi
Alias /cgi-bin/ /var/www/vhosts/somedomain.com/cgi-bin/
<Directory /var/www/vhosts/somedomain.com/cgi-bin/>
     Options ExecCGI FollowSymLinks Includes
     AllowOverride Limit
     Order allow,deny
     Allow from all
</Directory>

Melody Config

The following file should be appended to /var/www/vhosts/www.somedomain.com/cgi-bin/config.cgi

AdminScript index.fcgi
CommentScript comments.fcgi
TrackbackScript tb.fcgi
SearchScript search.fcgi
ViewScript view.fcgi

 


Questions, comments, can't find something? Let us know at our community outpost on Get Satisfaction.

Credits

  • Author: Six Apart Ltd., Byrne Reese
  • Edited by: Violet Bliss Dietz
Clone this wiki locally