Thursday, January 22, 2009

Installing MySource Matrix on Ubuntu 8.10 Intrepid

Ok, it's been an awful long time between posts. CentOS5.1 is now superseded, as is Matrix 3.18. Matrix 3.20 comes with lots of new features, courtesy of Squiz.net GPL'ing some of their previously commercial-only modules - calendar, ecommerce, news, bulkmail and search.

That means that what was previously an amazing Open Source CMS is now an astonishingly amazing Open Source CMS!

I've done up some instructions to set up a Ubuntu Server install to run Matrix, complete with instructions for installing eaccelerator and html tidy from source. To prepare, I've just done a basic server install using the Ubuntu 8.10 server cd, and haven't selected any of the default package sets when prompted.

If you're running in a VMWare virtual machine, press F4 after you are prompted for the language on the boot screen and select the minimal virtual machine install. This will install with a kernel that is optimised to run on VMWare architecture, and provides performance benefits over a standard install.

Without further ado, here are the instructions for installing a Matrix 3.20.0 GPL version of MySource Matrix on Ubuntu 8.10. We're assuming the basic OS install has happened, and you're logged in as root:

root@ubuntu:~# apt-get install php5 php5-cli php5-common php5-curl php5-gd php5-pgsql php5-pspell aspell-en php5-dev php-pear poppler-utils antiword openssh-server screen build-essential cvs

root@ubuntu:~# vi /etc/default/locale

---------------------------
Change the file to read:

LANG="C"
LANGUAGE="C"

---------------------------

root@ubuntu:~# export LANG="C"

root@ubuntu:~# export LANGUAGE="C"

root@ubuntu:~# apt-get install postgresql postgresql-client

root@ubuntu:~# pear upgrade-all

root@ubuntu:~# pear install Auth_SASL HTTP HTTP_Client HTTP_Request Image_Canvas-0.3.1 Image_Color Image_Graph-0.7.2 Mail Mail_Mime Mail_Queue Mail_mimeDecode Math_Stats-0.8.5 Net_SMTP Net_Socket Net_URL Numbers_Roman Text_Diff XML_HTMLSax XML_Parser XML_RPC XML_Tree

root@ubuntu:~# cd /usr/local/src

root@ubuntu:/usr/local/src# wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2

root@ubuntu:/usr/local/src# tar xjf eaccelerator-0.9.5.3.tar.bz2

root@ubuntu:/usr/local/src# cd eaccelerator-0.9.5.3/

root@ubuntu:/usr/local/src/eaccelerator-0.9.5.3# phpize

root@ubuntu:/usr/local/src/eaccelerator-0.9.5.3# ./configure

root@ubuntu:/usr/local/src/eaccelerator-0.9.5.3# make

root@ubuntu:/usr/local/src/eaccelerator-0.9.5.3# make install

root@ubuntu:/usr/local/src/eaccelerator-0.9.5.3# vi eaccelerator.ini

-------------------------------

Edit the following 2 lines:
zend_extension="/usr/lib/php4/eaccelerator.so"
eaccelerator.cache_dir = "/tmp/eaccelerator"

So that they say:
zend_extension="/usr/lib/php5/20060613+lfs/eaccelerator.so"
eaccelerator.cache_dir = "/var/cache/eaccelerator"

-------------------------------

root@ubuntu:/usr/local/src/eaccelerator-0.9.5.3# mkdir /var/cache/eaccelerator

root@ubuntu:/usr/local/src/eaccelerator-0.9.5.3# chown www-data:www-data /var/cache/eaccelerator

root@ubuntu:/usr/local/src/eaccelerator-0.9.5.3# cp eaccelerator.ini /etc/php5/conf.d/

root@ubuntu:/usr/local/src/eaccelerator-0.9.5.3# /etc/init.d/apache2 restart

root@ubuntu:/usr/local/src/eaccelerator-0.9.5.3# cd ..

root@ubuntu:/usr/local/src# cvs -z3 -d:pserver:anonymous@tidy.cvs.sourceforge.net:/cvsroot/tidy co -P tidy

root@ubuntu:/usr/local/src# cd tidy/build/gmake

root@ubuntu:/usr/local/src/tidy/build/gmake# make

root@ubuntu:/usr/local/src/tidy/build/gmake# make install

---------------------
You will get an error. It does not matter for our purposes, tidy will be successfully installed in /usr/local/bin/tidy

---------------------

root@ubuntu:/usr/local/src# ln -s /usr/local/bin/tidy /usr/bin/tidy

root@ubuntu:/usr/local/src# cd /home/

root@ubuntu:/home# mkdir websites

root@ubuntu:/home# cd websites

root@ubuntu:/home/websites/mysource_matrix# wget http://matrix.squiz.net/__data/assets/file/0004/34744/mysource_3-20-0.tar.gz

root@ubuntu:/home/websites/mysource_matrix# tar xzf mysource_3-20-0.tar.gz

root@ubuntu:/home/websites/mysource_matrix# cd mysource_matrix

root@ubuntu:/home/websites/mysource_matrix# vi /etc/postgresql/8.3/main/pg_hba.conf

----------------------

Insert the following 2 lines just above the line that reads
"local all all ident sameuser"
:

local matrix matrix_web md5
local matrix matrix_hipo md5

-----------------------

root@ubuntu:/home/websites/mysource_matrix# /etc/init.d/postgresql-8.3 restart

root@ubuntu:/home/websites/mysource_matrix# su postgres

postgres@ubuntu:/home/websites/mysource_matrix$ createuser -P matrix_web
Enter password for new role:
Enter it again:
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

postgres@ubuntu:/home/websites/mysource_matrix$ createuser -P matrix_hipo
Enter password for new role:
Enter it again:
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

postgres@ubuntu:/home/websites/mysource_matrix$ createdb -O matrix_web -E SQL_ASCII matrix

postgres@ubuntu:/home/websites/mysource_matrix$ createlang plpgsql matrix

postgres@ubuntu:/home/websites/mysource_matrix$ psql matrix
Welcome to psql 8.3.5, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

matrix=# grant all on database matrix to matrix_hipo;
GRANT
matrix=# \q

postgres@ubuntu:/home/websites/mysource_matrix$ exit

root@ubuntu:/home/websites/mysource_matrix# php install/step_01.php `pwd`

root@ubuntu:/home/websites/mysource_matrix# vi data/private/conf/db.inc

---------------------------
Change this to look like, obviously you will need to substitute 'yourpassword' with the password you entered when creating the matrix_web and matrix_hipo db users above:


array (
'DSN' => 'pgsql:dbname=matrix',
'user' => 'matrix_web',
'password' => 'yourpassword',
'type' => 'pgsql',
),
'db2' => array (
'DSN' => 'pgsql:dbname=matrix',
'user' => 'matrix_web',
'password' => 'yourpassword',
'type' => 'pgsql',
),
'db3' => array (
'DSN' => 'pgsql:dbname=matrix',
'user' => 'matrix_hipo',
'password' => 'yourpassword',
'type' => 'pgsql',
),
'dbcache' => NULL,
'dbsearch' => NULL,
);

return $db_conf;
?>


---------------------------

root@ubuntu:/home/websites/mysource_matrix# vi data/private/conf/main.inc

---------------------------
You should modify the following lines:


define('SQ_CONF_SYSTEM_OWNER', '');
define('SQ_CONF_SYSTEM_ROOT_URLS', '');
define('SQ_CONF_DEFAULT_EMAIL', '');
define('SQ_CONF_TECH_EMAIL', '');
define('SQ_CONF_WEB_MEMORY_LIMIT', 16);
define('SQ_CONF_CRON_MEMORY_LIMIT', 16);


As an example, I use:


define('SQ_CONF_SYSTEM_OWNER', 'matrixblogger');
define('SQ_CONF_SYSTEM_ROOT_URLS', 'ubuntu.matrix.local');
define('SQ_CONF_DEFAULT_EMAIL', 'myname@myemailhost.com');
define('SQ_CONF_TECH_EMAIL', 'myname@myemailhost.com');
define('SQ_CONF_WEB_MEMORY_LIMIT', 64);
define('SQ_CONF_CRON_MEMORY_LIMIT', 64);

------------------------------

Please note: You must use email addresses with fqdn's for the default and tech email addresses, i.e. somebody@someplace.someextension. If you just use somebody@someplace, your installation will fail miserably and you'll have to start over, which will not make your day ;)


root@ubuntu:/home/websites/mysource_matrix# php install/step_02.php `pwd`

root@ubuntu:/home/websites/mysource_matrix# php install/compile_locale.php `pwd`

root@ubuntu:/home/websites/mysource_matrix# php install/step_03.php `pwd`

root@ubuntu:/home/websites/mysource_matrix# php install/compile_locale.php `pwd`

root@ubuntu:/home/websites/mysource_matrix# chown -R www-data:www-data data cache

root@ubuntu:/home/websites/mysource_matrix# vi /etc/apache2/sites-available/matrix

------------------------

Create this file so that it looks like this (you'll need modify ubuntu.matrix.local to match the url you set in main.inc, otherwise confusion will abound). This is copied from the matrix installation page at http://matrix.squiz.net/resources/installation :

NameVirtualHost *:80

<VirtualHost *:80>
ServerName ubuntu.matrix.local
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>

-----------------------------

root@ubuntu:/home/websites/mysource_matrix# a2ensite matrix

root@ubuntu:/home/websites/mysource_matrix# /etc/init.d/apache2 reload

-----------------------------

This will give you a warning about "NameVirtualHost *:80 has no VirtualHosts". You can ignore this warning

-----------------------------


Now, add a hosts entry so that you can access the vm using the url you used in main.inc on this line:

define('SQ_CONF_SYSTEM_ROOT_URLS', '');

In my case I add a host entry like so:

ubuntu.matrix.local 192.168.201.131

And that's it! You should be able to access the administration interface on http://your.system.url/_admin

-------------------------------------------------------------
Addendum: I haven't included installation instructions for a Mail Transport Agent (mail server) for Matrix to send emails. I like postfix, personally, but you can use other MTA's like sendmail or qmail if you are more familiar with those.

7 comments:

  1. Nice article. Thanks.
    I've got to agree, MySource is amazing. It's in a completely different league to the other open source CMSs everyone always talks about. I wonder why isn't it more famous?
    Keep up the good work.

    ReplyDelete
  2. These instructions work for a GPL system on Ubuntu 9.04 however I ran into a problem with the apache configuration. Probably my inexperience in this area. It appeared that just enabling a site with the default virtual host file and the default virtual host meant that http requests never got routed to the matrix virtual host. I replaced the contents of the default file with the matrix virtual host syntax and it worked. Not sure what I did wrong. Thanks for the helpful install instructions. However the most interesting thing is that this install went smoothly for MSM 3.22.3 GPL but not so for CentOS! Very strange!

    ReplyDelete
  3. Hi Karl,

    The issue with MSM 3.22.3 GPL appears to be a problem with the installation code for the ecomms module, but only for RH5/CentOS5. If you rm -rf packages/ecommerce/ before running step 2 this problem is avoided, although you miss out on ecomms. I haven't tested it, but installing an earlier version (say 3.22.0) and upgrading it (instructions at http://matrix.squiz.net/resources/upgrading) may get you over the line.

    ReplyDelete
  4. Karl,

    I'm planning on doing a followup now that Ubuntu 9.04 and Matrix 3.22.3 are out. Also, if you have any thoughts on what you'd like to see on the blog, let me know. You can only install Matrix so many times, we should actually do something with it ;)

    ReplyDelete
  5. Anonymous,

    Thanks for the comments. I think that maybe MySource is not as popular as some of the other CMS packages out there because it's more complicated to install. That's why I've put these articles together ;)

    ReplyDelete
  6. Hello,

    I followed your instruction for the installtion in CentOS5. After finishing all the steps I got this issue: Whenever I go to my website via www.mydomain.com it says Mysource Notice URL "www.mydomain.com/index.php" not found SYS0218. Also I cannot login to _admin using www.mydomain.com/_admin/ but I can get to www.mydomain.com/index.php/_admin/ but then it redirect me to www.mydomain.com/_admin/ and generate page not found 404 error.

    Do you know what I am missing? I posted lot of question on Squiz Forum and Experts-Exchange.com but no one can help me until now. I think that you can help me with your experience.

    Thanks and best regards,
    Duy.

    ReplyDelete
  7. Hi Duy,

    It sounds like the alias for / in your apache vhost configuration could be wrong. Can you post your apache virtualhost configuration here and I'll have a look?

    ReplyDelete