MySource Matrix Resources

Main Content

MySource Matrix Installation Guide

Introduction

This guide will help you install the MySource Matrix Content Management System (CMS) using the command line.

This guide assumes that you are installing MySource Matrix into /home/websites/ so make adjustments to the commands as required.

We apologise if you find this installation process difficult. MySource Matrix interacts with many other pieces of software and it’s this interaction that makes things complex. Our users tell us that the hardest part is getting the requirements right. From then on, installation is more straight forward.

If your system contains modules covered by the SSV licence, please contact Squiz for additional module installation instructions before proceeding.

Requirements

This installation guide assumes your system meets the requirements for MySource Matrix.

Database Setup

MySource Matrix requires a database for storing data. Before starting an installation, first ensure that you have created a database for MySource Matrix to use.

We have short guides to help you create a database. Please select your database management system from the list below:

The database installation guides will show you how to construct the database DSNs that will be required later in the install. A DSN is a connection string that MySource Matrix uses to connect to the database. Please make note of these before continuing.

Getting MySource Matrix

The easiest way to get MySource Matrix is to download it directly from the MySource Matrix web site using a program such as wget or curl. Alternatively, you can download MySource Matrix here.

Running the following commands will download a copy of the latest stable version of MySource Matrix using wget and unpack it to a directory called mysource_matrix.

Note that the filename of the download will contain a version number. The correct filename should be substituted into the instructions below.

$ cd /home/websites
$ wget http://matrix.squiz.net/download/mysource_matrix_stable.tar.gz
$ tar -zxvf mysource_matrix-3.x.x.tar.gz
If you don't have wget, you can also download MySource Matrix using curl. Running the following commands will download a copy of the latest stable version of MySource Matrix using curl and unpack it to a directory called mysource_matrix.

$ cd /home/websites
$ curl -OL http://matrix.squiz.net/download/mysource_matrix_stable.tar.gz
$ tar -zxvf mysource_matrix-3.x.x.tar.gz

For security reasons, MySource Matrix should not be installed in a public web-accessible directory, like htdocs. Public web access should only be given to the directories that MySource Matrix requires, as described in the Apache Aliases section below.

Those wishing to install MySource Matrix on a Solaris system should use GNU tar to extract the source tarball, rather than Solaris' version of tar. Some incompatibilities exist between the two versions that may have unintended results if Solaris tar is used.

Basic Configuration Settings

MySource Matrix comes with 4 installation scripts that need to be run in a particular order. The first script will initialise the main configuration file.

$ cd /home/websites/mysource_matrix
$ php install/step_01.php /home/websites/mysource_matrix

What step 1 of the installation did is create a configuration file for you. This is the main system configuration file and is located at /home/websites/mysource_matrix/data/private/conf/main.inc

You now need to edit this file and add some basic configuration settings.

$ vi data/private/conf/main.inc

The following configuration settings need to be completed as a minimum:

  • SQ_CONF_DB_DSN
  • SQ_CONF_DB2_DSN
  • SQ_CONF_DB3_DSN
  • SQ_CONF_DBCACHE_DSN
  • SQ_CONF_SYSTEM_ROOT_URLS
  • SQ_CONF_DEFAULT_EMAIL
  • SQ_CONF_TECH_EMAIL

You should have got the DSNs from the database setup guides (above). The system root URLs are the URLs that you will use to access the MySource Matrix system. The email addresses should both be set to your email address so you receive any errors or other email notifications from the system.

Examples of these configuration settings are shown below.

Note that the system root URLs should not contain the protocol (eg. HTTP) and each should be separated by a new-line. All system root URLs must be fully qualified domain names, so a system root URL such as "localhost" will not work correctly.

define('SQ_CONF_DB_DSN', 'pgsql://developers@db/matrix');
define('SQ_CONF_DB2_DSN', 'pgsql://developers@db/matrix');
define('SQ_CONF_DB3_DSN', 'pgsql://developers_secondary@db/matrix');
define('SQ_CONF_DBCACHE_DSN', 'pgsql://developers@db/matrix');

define('SQ_CONF_SYSTEM_ROOT_URLS', 'www.example.com
another.example.com/matrix');

define('SQ_CONF_DEFAULT_EMAIL', 'you@example.com');
define('SQ_CONF_TECH_EMAIL', 'you@example.com');

See the annotated main.inc for more information about these and other MySource Matrix configuration parameters.

Version 3.18 RC1 and later:

In this version, the database details have been moved to a new file, db.inc. The SQ_CONF_DB_DSN variable and its brethren no longer exist in main.inc. These have to be set up slightly differently to previous versions - each connection is defined by an array of settings, including the data source name (DSN), which is provided in a different (PDO-compatible) format. The specific DSN format for each database is available from the setup guide for that database.

A typical db.inc on a PostgreSQL database system is shown below:

$db_conf = array (
        'db' => array (
                'DSN' => 'pgsql:dbname=matrix;host=db',
                'user' => 'developers',
                'password' => '',
                'type' => 'pgsql',
               ),
        'db2' => array (
                'DSN' => 'pgsql:dbname=matrix;host=db',
                'user' => 'developers',
                'password' => '',
                'type' => 'pgsql',
               ),
        'db3' => array (
                'DSN' => 'pgsql:dbname=matrix;host=db',
                'user' => 'developers_secondary',
                'password' => '',
                'type' => 'pgsql',
               ),
        'dbcache' => NULL,
        );

return $db_conf;

Adjust Memory Limit for 64 bit Platforms

For some installations it may be necessary to increase the maximum amount of system memory that is made available to MySource Matrix. In currently supported versions, this is located in the above main.inc configuration file.

The current memory limit is defined by the following lines:

define('SQ_CONF_WEB_MEMORY_LIMIT', 16);
define('SQ_CONF_CRON_MEMORY_LIMIT', 16);

The first line defines the maximum amount of memory available to the web interface of MySource Matrix. The second line defines the amount of memory used by MySource Matrix's Cron Job script.

A total of 16 megabytes of system memory is allocated by default for each. It is recommended that this be increased to 32 megabytes if your web server is operating on a 64 bit platform.

Increase the maximum amount of memory allocated as follows:

define('SQ_CONF_WEB_MEMORY_LIMIT', 32);
define('SQ_CONF_CRON_MEMORY_LIMIT', 32);

Initialise the Database Schema

The second installation script will initialise the MySource Matrix database schema, creating database tables, views, functions and sequences.

$ php install/step_02.php /home/websites/mysource_matrix

Install the Core Asset Types

The third installation script installs the different types of assets into the system. It also creates some system assets, such as the Trash folder and the root user account.

The compile_locale.php script is run before and after this step to ensure all errors, warnings and system asset names are translated correctly.

$ php install/compile_locale.php /home/websites/mysource_matrix
$ php install/step_03.php /home/websites/mysource_matrix
$ php install/compile_locale.php /home/websites/mysource_matrix

Fix File System Permissions

Some directories of MySource Matrix require read and write permission for the user that the Apache web server is run as. All other directories should be read-only for the Apache user.

The example below assumes your Apache web server is running as the user "apache" and with the group "apache" and that you own all the files in /home/websites/mysource_matrix.

$ chmod -R 755 /home/websites/mysource_matrix

$ cd /home/websites/mysource_matrix
$ chown -R apache:apache data cache
$ chmod -R g+w data cache

Create Apache Aliases

Now that MySource Matrix is installed, we need to enable web access to the system. This is done using Apache aliases.

Locate your Apache alias file, typically httpd.conf, and create a new VirtualHost directive for MySource Matrix. The recommended VirtualHost setup is as follows:

<VirtualHost *:80>
ServerName server.example.com
DocumentRoot /home/websites/mysource_matrix/core/web

Options -Indexes FollowSymLinks

<Directory /home/websites/mysource_matrix>
  Order deny,allow
  Deny from all
</Directory>
<DirectoryMatch "^/home/websites/mysource_matrix/(core/(web|lib)|data/public|fudge)">
  Order allow,deny
  Allow from all
</DirectoryMatch>

<FilesMatch "\.inc$">
  Order allow,deny
  Deny from all
</FilesMatch>
<LocationMatch "/(CVS|\.FFV)/">
  Order allow,deny
  Deny from all
</LocationMatch>

Alias /__fudge   /home/websites/mysource_matrix/fudge
Alias /__data    /home/websites/mysource_matrix/data/public
Alias /__lib     /home/websites/mysource_matrix/core/lib
Alias /          /home/websites/mysource_matrix/core/web/index.php/
</VirtualHost>

Note that the order of each alias is important. You should replace server.example.com with the hostname of your server, as specified in the /etc/hosts file.

Save the file and restart Apache. You should be now be able to access the frontend of MySource Matrix using the URL you have configured in Apache. If all goes well, you will actually see a MySource Notice on the screen. This indicates that MySource Matrix is running but you have not yet created any sites within the system.

Cron Setup

To allow MySource Matrix's cron system to function you need to edit the crontab file for the user that your web server runs as

crontab -u apache -e

and add an entry to invoke MySource Matrix's cron script with the appropriate frequency (default is 15 minutes)

*/15 * * * * php /home/websites/mysource_matrix/core/cron/run.php

Solaris and some other non-Linux systems may not allow the use of the format "*/15" (and the like) to specify "every 15 minutes". Instead the minutes should be entered explicitly - for example, "0,15,30,45" in its place will make the job run every 15 minutes.

For v3.8.5 onwards an entry is also required for the session files garbage collection script:

0 0 * * *  /home/websites/mysource_matrix/scripts/session_cleanup.sh /home/websites/mysource_matrix

Accessing the Administration Interface

At this point, MySource Matrix has been installed correctly and is web accessible. You can now access the administration interface as the root user and begin working with MySource Matrix.

To access the administration interface, append /_admin to the end of your system root URL. For example, http://www.example.com/_admin. You will see a login screen where you can enter the root user's username and password.

The root user's details are:

  • The username is root
  • The default password is root

You should change the root user's password as soon as you log in successfully. Leaving the root password unchanged is a serious security risk.

To change the root user's password, log into the administration interface, click on the My Space tab above the Java asset map, then click My Details. Lock this screen and enter a new password (twice) in the password boxes. Press Commit to save the new password.