Install Squiz Matrix in 10 minutes on Debian 7.0 using Digital Ocean

Sun, Nov. 10, 2013

Note: This is an updated guide following in the footsteps of my previous installation guides. This uses Debian 7.0 and the newest 4.18.0 version of Matrix.

If you have ever been confused or overwhelmed by the thought of installing Squiz Matrix, worry no more. Use this simple guide and you will have Matrix up and running in 10 minutes.

Hosting: Digital Ocean
OS: Debian 7.0 32 bit using root user
Matrix: 4.18.0

Install the Essentals

// Update and install needed packages
apt-get update
apt-get install apache2 postgresql-9.1 php5 php5-cli php5-pgsql php-pear php5-curl php5-ldap php5-gd postfix cvs curl vim postfix


// Update and install PEAR packages
pear upgrade PEAR
pear install Archive_Tar Mail Mail_Mime Mail_mimeDecode XML_HTMLSax XML_Parser Text_Diff Mail_Queue HTTP_Client HTTP_Request Net_URL Image_Graph-0.8.0 Image_Color Image_Canvas-0.3.4 Numbers_Roman Numbers_Words-0.16.4 pear/MDB2#pgsql I18N_UnicodeNormalizer

Install Matrix

// Create Folder to hold Matrix
mkdir /home/websites
cd /home/websites

// Checkout and install Matrix
curl -O
sh mysource_4-18-0


// Edit Postgres config
vim /etc/postgresql/9.1/main/pg_hba.conf

// Use trust for both
# Database administrative login by Unix domain socket
local all postgres trust
# "local" is for Unix domain socket connections only
local all all trust

// Restart Postgres
/etc/init.d/postgresql restart

// Create users and DB
createuser -SRDU postgres matrix
createuser -SRDU postgres matrix_secondary
createdb -U postgres -O matrix -E UTF8 squiz_matrix
createlang -U postgres plpgsql squiz_matrix

Init Matrix

// Init the main config
cd /home/websites/squiz_matrix
php install/step_01.php /home/websites/squiz_matrix

// Edit the main config file
vim data/private/conf/

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

// Edit Database file
vim data/private/conf/

// Update the PHP array
$db_conf = array (
       'db' => array (
          'DSN' => 'pgsql:dbname=squiz_matrix',
          'user' => 'matrix',
          'password' => '',
          'type' => 'pgsql',
       'db2' => array (
          'DSN' => 'pgsql:dbname=squiz_matrix',
          'user' => 'matrix',
          'password' => '',
          'type' => 'pgsql',
       'db3' => array (
          'DSN' => 'pgsql:dbname=squiz_matrix',
          'user' => 'matrix_secondary',
          'password' => '',
          'type' => 'pgsql',
       'dbcache' => NULL,
       'dbsearch' => NULL,
return $db_conf;

// Init database schema
php install/step_02.php /home/websites/squiz_matrix

// Install core asset types
php install/compile_locale.php /home/websites/squiz_matrix
php install/step_03.php /home/websites/squiz_matrix
php install/compile_locale.php /home/websites/squiz_matrix

Fix Permissions

chmod -R 755 /home/websites/squiz_matrix
chown -R www-data:www-data data cache
chmod -R g+w data cache


// Edit apache virtual hosts file
vim /etc/apache2/sites-enabled/000-default

<VirtualHost *:80>
DocumentRoot /home/websites/squiz_matrix/core/web

Options -Indexes FollowSymLinks

<Directory /home/websites/squiz_matrix>
Order deny,allow
Deny from all
<DirectoryMatch "^/home/websites/squiz_matrix/(core/(web|lib)|data/public|fudge)">
Order allow,deny
Allow from all
<DirectoryMatch "^/home/websites/squiz_matrix/data/public/assets">
SetHandler default-handler

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

Alias /__fudge /home/websites/squiz_matrix/fudge
Alias /__data /home/websites/squiz_matrix/data/public
Alias /__lib /home/websites/squiz_matrix/core/lib
Alias / /home/websites/squiz_matrix/core/web/index.php/

// Restart apache
/etc/init.d/apache2 restart

Cron Setup

// Edit apache user cron file
crontab -u www-data -e

// Add cron jobs
*/15 * * * * php /home/websites/squiz_matrix/core/cron/run.php
0 0 * * * /home/websites/squiz_matrix/scripts/ /home/websites/squiz_matrix
*/15 * * * * php /home/websites/squiz_matrix/packages/bulkmail/scripts/run.php

Login to Matrix

Now login to Matrix using root for the username and password by accessing

Nicholas Hubbard


Andrew Smallwood
Nov 11, 2013
Hi Nicholas, This is great stuff. I've been wanting to do this since I left my last place of work and I'm no longer using Matrix every day. I'd like to get it up and running, especially after I bought your iOS app. I'm currently up to the database configuration but I'm a bit stuck. In the set up, do we change the word 'peer' to trust on both lines? If so, after I've done that, I press escape to get rid of the -INSERT- bit and then restart postgres. On doing that, I get the error E486: Pattern not found: etc The bit that threw me off was the line above saying 'Put your actual configuration here'. I'll keep plugging away but any help would be greatly appreciated. Cheers Andi
Nicholas Hubbard
Nov 11, 2013
Yes, that is correct, you change peer to trust. Did you make sure to save the config file in vim? Just use :x which will save the file. Were you trying to do a search and replace?
Andrew Smallwood
Nov 11, 2013
Thanks Nicholas, that's great. Apologies for asking such basic questions. I'm getting there now though! I've changed the DNS on a domain I own to forward to my new DigitalOcean Nameservers. I've used that domain name in the Apache ServerName config but it says it can't find it and it will just use for now. Is that the correct thing to add in serverName? It's the same domain I added in the Init Matrix SYSTEM ROOT URL. Just the Cron to go after this and I'll have lift off!
Nicholas Hubbard
Nov 11, 2013
Yeah, that should be fine to ignore for now. I am assuming that your DNS just hasn't propagated yet. For ServerName you should use your fully-qualified domain name that you are using in Matrix.
Chris Horikx
Jun 10, 2014
Thanks Nicholas, This page is always such a time-saver! Looking forward to an update with the GIT only matrix repo v5+
Aug 20, 2014
Hi Nic, Got stuck at the create user bit. I'm using postgresql 9.3 on Centos and it said could not connect to database postgres: FATAL: Peer authentication failed for user "postgres". I did vim the config file and used :q! to exit
Nicholas Hubbard
Aug 20, 2014
Did you make sure to edit the postgres .conf file as described in the steps?
Sep 7, 2014
Hi Nicholas... this guide is a lifesaver! I followed it for Ubuntu 14.04 and everything worked perfectly right up until the point where I went to log in. I'm now getting apache 403 messages, which I'm guessing is a misconfiguration in my virtualhost entries. I followed all the permission steps and copied the virtualhost entries from above, but no luck so far. Any ideas? Is there something that would be different in Ubuntu which might be causing problems?
Nicholas Hubbard
Sep 8, 2014
And you restarted Apache and correctly set the permissions for the web user? The web user probably won't be www-data on Ubuntu.
Sep 8, 2014
Thanks for the reply! Did a bit of an investigation and the web user is www-data on Ubuntu. It turns out that I needed to edit my apache2.conf file at /etc/apache2/ to include the following: <Directory /home/websites/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> I'm up and running now, thanks for your help again:)

Add Comment