Manual Installation Guide for Matrix 5
Squiz Matrix can be installed on your own hardware and using any operating system that supports the product's requirements. Manual code checkout and installation is performed using a Squiz Git repository. Alternatively, you can download Squiz Matrix as VM or as code.
The following installation guide is applicable for Squiz Matrix version 5 only.
This guide assumes you have already checked out the Matrix code from the Git repository under the /var/www/ directory of your server and called the Matrix directory "squiz_matrix".
Squiz Matrix should not be installed in a public web-accessible directory, like htdocs. Public web access should only be given to the directories that Squiz Matrix requires, as described in the Apache Aliases section below.
Database Setup
Squiz Matrix requires a PostgreSQL database for storing data. Before starting an installation, please follow the PostgreSQL database setup guide to ensure that you have created a database for Squiz Matrix to use.
Basic Configuration Settings
Squiz Matrix comes with 3 installation scripts that need to be run in a particular order. The first script will initialise the main configuration file.
$ cd /var/www/squiz_matrix
$ php install/step_01.php /var/www/squiz_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 /var/www/squiz_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_SYSTEM_ROOT_URLS
- SQ_CONF_DEFAULT_EMAIL
- SQ_CONF_TECH_EMAIL
The system root URLs are the URLs that you will use to access the Squiz 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_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');
You will also need to add your database details to the db.inc file. In this file, each database 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=squiz_matrix;host=db',
'user' => 'matrix',
'password' => '',
'type' => 'pgsql',
),
'db2' => array (
'DSN' => 'pgsql:dbname=squiz_matrix;host=db',
'user' => 'matrix',
'password' => '',
'type' => 'pgsql',
),
'db3' => array (
'DSN' => 'pgsql:dbname=squiz_matrix;host=db',
'user' => 'matrix_secondary',
'password' => '',
'type' => 'pgsql',
),
'dbcache' => NULL,
'dbsearch' => NULL,
);
return $db_conf;
The "dbsearch" database parameter should be populated with the database details of a replicated Squiz Matrix database - in DSN / user / password /type array format as shown above - to offload search index requests from the main DB server.
Initialise the Database Schema
The second installation script will initialise the Squiz Matrix database schema, creating database tables, views, functions and sequences.
$ php install/step_02.php /var/www/squiz_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. It also compiles languages on the system to ensure all errors, warnings and system asset names are translated correctly.
$ php install/step_03.php /var/www/squiz_matrix
Fix File System Permissions
Some directories of Squiz 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 /var/www/squiz_matrix.
$ cd /var/www/squiz_matrix
$ chown -R apache:apache data cache
Create Apache Aliases
Now that Squiz 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 Squiz Matrix. The recommended VirtualHost setup is as follows:
<VirtualHost *:80>
ServerName server.example.com
DocumentRoot /var/www/squiz_matrix/core/web
Options -Indexes FollowSymLinks
<Directory /var/www/squiz_matrix>
Order deny,allow
Deny from all
</Directory>
<DirectoryMatch "^/var/www/squiz_matrix/(core/(web|lib)|data/public|fudge)">
Order allow,deny
Allow from all
</DirectoryMatch>
<DirectoryMatch "^/var/www/squiz_matrix/data/public/assets">
SetHandler default-handler
</DirectoryMatch>
<FilesMatch "\.inc$">
Order allow,deny
Deny from all
</FilesMatch>
<LocationMatch "/(CVS|\.FFV)/">
Order allow,deny
Deny from all
</LocationMatch>
Alias /__fudge /var/www/squiz_matrix/fudge
Alias /__data /var/www/squiz_matrix/data/public
Alias /__lib /var/www/squiz_matrix/core/lib
Alias / /var/www/squiz_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 Squiz Matrix using the URL you have configured in Apache. If all goes well, you will actually see a notice on the screen. This indicates that Squiz Matrix is running but you have not yet created any sites within the system.
Cron Setup
To allow the Squiz Matrix cron system to function, you need to edit the crontab file for the user that your web server runs as by running the following command:
crontab -u apache -e
Now add entries to invoke the Squiz Matrix cron scripts.
*/15 * * * * php /var/www/squiz_matrix/core/cron/run.php
0 0 * * * /var/www/squiz_matrix/scripts/session_cleanup.sh /var/www/squiz_matrix