Installing MySource Matrix on Ubuntu

Posted on 10 Jan 2008 9:01pm by Aleks Bochniak

Let's begin

This how to is written specifically for Ubuntu Dapper, however the instructions should still work with Edgy, Feisty and Gutsy.

Ubuntu’s package management is done through apt-get. But it starts out handicapped. You need to edit a config file as root to add some additional sources:

$ su root
$ vi /etc/apt/sources.list

Uncomment these lines (remove the “#“):

# deb dapper universe
# deb dapper-security universe
# deb-src dapper-security universe

Now update the repository index and upgrade your built-in software:

$ apt-get update && apt-get upgrade

OK, first the prerequisites; the first line installs some basic compiling tools you’ll need, like “make”.

$ apt-get install build-essential

Install Apache and PHP 4

As root, apt-get install the following packages:

  • apache2
  • apache2-common
  • apache2-mpm-prefork
  • apache2-utils
  • apache-common
  • apache-dev
  • apache2-doc
  • apache2-prefork-dev
  • perl
  • perl-base
  • perl-doc
  • perl-modules
  • php-db
  • php-http
  • php-mail
  • php-net-smtp
  • php-net-socket
  • php-pear
  • php-xml-parser
  • php4
  • php4-cli
  • php4-common
  • php4-curl
  • php4-dev
  • php4-gd
  • php4-imagick
  • php4-imap
  • php4-ldap
  • php4-mcrypt
  • php4-mhash
  • php4-pear
  • php4-pspell
  • php4-rrdtool
  • php4-snmp
  • php4-sqlite
  • php5-common
  • libapache2-mod-php4

Apache configuration file is located at: /etc/apache2/apache2.conf and your web folder is /var/www.

Restart the web server.

$ /etc/init.d/apache2 restart

Install the necessary pear modules.

$ pear install DB
$ pear install Archive_Tar
$ pear install Mail
$ pear install Mail_Mime
$ pear install XML_HTMLSax
$ pear install XML_Parser
$ pear install Text_Diff !(may get prompted to download this package)

Install PostgreSQL

It is recommended to use PostgreSQL 8+ for versions of MySource Matrix above 3.8

$ apt-get install php4-pgsql
$ apt-get install postgresql-8.1
$ apt-get install postgresql-common
$ apt-get install postgresql-client-8.1
$ apt-get install postgresql-client-common

Make sure you switch to the postgres user before creating the users and database for your installation

$ su postgres
$ createuser -U postgres matrix
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
$ createuser -U postgres matrix_secondary
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
$ createdb -U postgres -O matrix -E SQL_ASCII mysource_matrix
$ createlang -U postgres plpgsql mysource_matrix

Switch user back to root.

$ su root

Check your pg_hba.conf file to ensure that local user accounts are allowed "trust" access to PostgreSQL (instead of "ident sameuser", which is the default).

$ vi /etc/postgresql/8.1/main/pg_hba.conf

Change the upper two "local" lines and change "ident sameuser" to "trust".

# Database administrative login by UNIX sockets
local   all         postgres                          trust
# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
host    all         all          md5
# IPv6 local connections:
host    all         all         ::1/128               md5

Install MySource Matrix 3.14.4

You can download the GPL version of MySource Matrix from the Squiz's Matrix website

$ su root$ cd /var/www
$ wget
$ tar -zxvf mysource_3-8-2.tar.gz
$ cd /var/www/mysource_matrix
$ php install/step_01.php .

Edit the installation config file

$ vi data/private/conf/

and change these settings:

define('SQ_CONF_DB_DSN', 'pgsql://matrix@unix()/mysource_matrix');
define('SQ_CONF_DB2_DSN', 'pgsql://matrix@unix()/mysource_matrix');
define('SQ_CONF_DB3_DSN', 'pgsql://matrix_secondary@unix()/mysource_matrix');

This lines are just the minimum required for an initial installation, you can change the others if need be. More info here

Note: The address/ip in this example is the localhost address. Find out the ip of your machine with the command ifconfig.

$ php install/step_02.php .
$ php install/compile_locale.php .
$ php install/step_03.php .
$ php install/compile_locale.php .
$ chmod -R 755 /var/www/mysource_matrix
$ cd /var/www/mysource_matrix
$ chown -R www-data:www-data data cache
$ chmod -R g+w data cache

Apache Configuration

Edit the file /etc/apache2/sites-available/default and paste these lines.

<VirtualHost *:80> 
     DocumentRoot /var/www/mysource_matrix/core/web 
     <Directory "/var/www/mysource_matrix"> 
            Options -Indexes FollowSymLinks 
            Order deny,allow 
            Deny from all 
     <Directory "/var/www/mysource_matrix/core/web"> 
            Options -Indexes FollowSymLinks 
            Order allow,deny 
            Allow from all 
     <Directory "/var/www/mysource_matrix/core/lib"> 
            Options -Indexes FollowSymLinks 
            Order allow,deny 
            Allow from all 
     <Directory "/var/www/mysource_matrix/data/public"> 
            Options -Indexes FollowSymLinks 
            Order allow,deny 
            Allow from all 
     <Directory "/var/www/mysource_matrix/fudge"> 
            Options -Indexes FollowSymLinks 
            Order allow,deny 
            Allow from all 
     Alias "/__data"    "/var/www/mysource_matrix/data/public" 
     Alias "/__lib"     "/var/www/mysource_matrix/core/lib" 
     Alias "/__fudge"   "/var/www/mysource_matrix/fudge" 
     Alias "/"          "/var/www/mysource_matrix/core/web/index.php/"  

Cron setup

$ crontab -u www-data -e

Insert these lines

*/15 * * * * php /var/www/mysource_matrix/core/cron/run.php
0 0 * * *  /var/www/mysource_matrix/scripts/

Installation Complete

Hopefully everything went smoothly and now you can start your webserver, as root user.

$ sudo /etc/init.d/apache2 start

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

Enjoy ;-)



There are 6 comment(s) so far... say something?

23 Jan 2008 7:50am

FWIW, there's quite a bit involved to install MySource Matrix on Gutsy, because libapache2-mod-php4 has been removed from the distro's repository.

I've gone back to running Dapper for now ;)

29 Mar 2008 10:05am

Oh dear... So I should stop with Gutsy and go with Silverstripe CMS? A no-brainer to install that one. Currenty having PEAR shaped probs with my MSM install on Gutsy.

17 Aug 2008 4:03am

Ok, it is 3:55am and about 3 weeks (on and off) into attempting to install matrix.

I can finally say that I have done it!!!!!!!!!!!!!!! (sigh of relief)

It is great that you made an easy to digest version of the Squiz installation guide. Thanks

Now the fun begins >:)

19 Aug 2008 5:55am

Jeff, which version of Mysource are you trying to install? I had problems too with 3.16 on Gutsy. I upgraded all the way from 6.06 to 7.10 for my upgrade from 3.14

27 Nov 2008 7:30pm

Great guide, any possibility of creating one for 3.18.7?

07 Apr 2011 12:43pm

Bring on a V4 version of this....

Leave a comment

Name (required)

Email (required)


Your comment

Security key
Enter the above security word

I am human