Matrix manual install on Debian 6


(Anewport) #1

I've been using these pages as a guide to install Matrix: http://matrix.squizsuite.net/quick-start-guide/manual-installation, http://matrix.squizsuite.net/quick-start-guide/manual-installation/postgresql-db-setup-guide, http://matrix.squizsuite.net/requirements, http://www.zedsaid.com/blog/installing-mysource-matrix-in-15-min, http://www.solonode.com/install-commands-for-mysource-matrix-on-debia and these forums.


I'm trying to install Matrix 4.6.3 manually on Debian 6.0.4 can get as far a the /_admin login page but I always get a "Permission denied (13)" error on the folder "cache" and if I change the permissions to 777 then I get a blank login page, however the username:password (root:root) does not work and the message "Login Key incorrect" is shown.



Screen shots:

"data" and "cache" permissions set to 755 - http://i42.tinypic.com/1790dj.jpg

"data" and "cache" permissions set to 777 and failed to login as root - http://i41.tinypic.com/2z8q8mr.jpg



Running check_requirements.php does not return and requirements that are missing and running system_check.php all returns [OK]. There were no errors thrown during the install scripts (step_01.php etc.) and the only entries in <system_root>/data/private/logs/error.log is saying that a favicon.ico cannot be found for my root URL.



I'd be happy to post the contents of the db.inc, main.inc, httpd.conf or any other files or command outputs that can provide more information. I've tried the process of installation a few times and keep getting to this same point and can't figure out where I went wrong. I have no issue reinstalling Debian, dropping db's or removing all folders and starting from scratch as I already done this a couple times before.


(Nic Hubbard) #2

Yeah, something is going wrong as you should see the login box in color with the Matrix logo.


You made sure to run the following? On Debian the standard web user is www-data.


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

(Benjamin Pearson) #3

[quote]
I've been using these pages as a guide to install Matrix: http://matrix.squizsuite.net/quick-start-guide/manual-installation, http://matrix.squizsuite.net/quick-start-guide/manual-installation/postgresql-db-setup-guide, http://matrix.squizsuite.net/requirements, http://www.zedsaid.com/blog/installing-mysource-matrix-in-15-min, http://www.solonode.com/install-commands-for-mysource-matrix-on-debia and these forums.



I'm trying to install Matrix 4.6.3 manually on Debian 6.0.4 can get as far a the /_admin login page but I always get a "Permission denied (13)" error on the folder "cache" and if I change the permissions to 777 then I get a blank login page, however the username:password (root:root) does not work and the message "Login Key incorrect" is shown.



Screen shots:

"data" and "cache" permissions set to 755 - http://i42.tinypic.com/1790dj.jpg

"data" and "cache" permissions set to 777 and failed to login as root - http://i41.tinypic.com/2z8q8mr.jpg



Running check_requirements.php does not return and requirements that are missing and running system_check.php all returns [OK]. There were no errors thrown during the install scripts (step_01.php etc.) and the only entries in <system_root>/data/private/logs/error.log is saying that a favicon.ico cannot be found for my root URL.



I'd be happy to post the contents of the db.inc, main.inc, httpd.conf or any other files or command outputs that can provide more information. I've tried the process of installation a few times and keep getting to this same point and can't figure out where I went wrong. I have no issue reinstalling Debian, dropping db's or removing all folders and starting from scratch as I already done this a couple times before.

[/quote]



Sounds like you missed:

    $ cd /home/websites/squiz_matrix
    $ chown -R www-data:www-data data cache


And further to that, I would guess the URL that you are trying to log in at, is not listed under data/private/conf/main.inc. This is the most common case of getting the login box and correct details do not work.

Also if you make these changes, you do not have to re-run any steps, just refresh in the browser and (fingers crossed) it should work.

Hope that helps

(Anewport) #4

[quote]
Yeah, something is going wrong as you should see the login box in color with the Matrix logo.



You made sure to run the following? On Debian the standard web user is www-data.


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

[/quote]



Ah I didn't know that the standard web user was www-data. Ran the code again with www-data as the user/group and got the login screen with no design.


[quote]

Sounds like you missed:

    $ cd /home/websites/squiz_matrix
    $ chown -R www-data:www-data data cache


And further to that, I would guess the URL that you are trying to log in at, is not listed under data/private/conf/main.inc. This is the most common case of getting the login box and correct details do not work.

Also if you make these changes, you do not have to re-run any steps, just refresh in the browser and (fingers crossed) it should work.

Hope that helps
[/quote]

My URL was included in main.inc but I had just entered "www.squizexample.com.au". I added a new line to the SQ_CONF_SYSTEM_ROOT_URL with "debian.squizexample.com.au" and refreshed the login page and got the design.


I've logged in as root user and I'll start making a test site to ensure that everything is working fine. Thanks for the help from both of you.

(Router Daemon) #5

Yet Another Matrix Install How-To.


NOTE(S) : these steps should really be carried out as a user with super user privileges not as root!



If you decide to continue as root, make sure your permissions are correct as to folder & file ownership.



You can use your preferred editor or in the following example, the defacto linux editor 'vi'. If you choose to use a graphical editor, make sure that after editing, the file ownership permissions are correct. The edited file should be owned by the same user as the install files & folders.



1.Download and run the Squiz Matrix checkout script ;



$ wget http://public-cvs.squiz.net/cgi-bin/viewcvs.cgi/checkout/mysource_matrix/scripts/dev/checkout.sh



$ sh checkout.sh mysource_4-8-0 /home/websites/squiz_matrix/



(At this point consider making a nice neat tarball of your install folder, just in case you need it later)



2.Check your environment with the requirements script, anything with 'required' is a MUST.



$ php install/check_requirements.php /home/websites/squiz_matrix/



Continue to install required libraries etc. with pear and apt-get or yum until ALL requirements are met, don't worry too much about 'suggestions' unless you know you definitely need them for additional matrix features. So run the check_requirements.php script after each install and you should see the requirements updated each time.



3.Create your config file with the following script.



$ php install/step_01.php /home/websites/squiz_matrix/



What step 1. of the installation did is produce an installation configuration file. This is the main system configuration file and is located at /home/websites/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', 'awesomematrix.mysite.com mysite.com/awesomematrix');



define('SQ_CONF_DEFAULT_EMAIL', 'webmaster@awesomematrix.mysite.com');

define('SQ_CONF_TECH_EMAIL', 'awesomematrixwebmaster@gmail.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 basic db.inc on a PostgreSQL database system is shown below:



<?php

$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



);

return $db_conf;

?>



4. Create database and database users, this can be done from a ctrl panel or manually like this ;



$ createuser -SRDU postgres matrix

$ createuser -SRDU postgres matrix_secondary



This will create new postgres users that are not superusers, have no password,

can't create new databases and can't create new roles.



Alternatively you can get createuser to prompt you for the information:

$ 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

CREATE ROLE



$ 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

CREATE ROLE



$ createdb -U postgres -O matrix -E SQL_ASCII squiz_matrix

CREATE DATABASE



If errors are thrown regarding templates, use template0.

If errors are thrown regarding permissions, change (su) to user 'postgres' and try again;



$ su postgres



$ createdb -U postgres -O matrix -E SQL_ASCII squiz_matrix

CREATE DATABASE



5. Create language for database



$ createlang -U matrix plpgsql squiz_matrix

Again, if errors are thrown regarding permissions, change (su) to user 'postgres' and try again



or try the following as user postgres;

$ createlang -U postgres plpgsql squiz_matrix





6. Create database fields and tables for installation



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



NOTE - If this throws errors, you probably haven't updated your environment enough. This means that you'll have to delete the entire squiz_matrix folder & the database, re-run the checkout script and then start again from the beginning !



If everything goes well and screens full of db tables scroll past, then it's time for :



7. Set locale details



$ php install/compile_locale.php /home/websites/squiz_matrix/



8. Go ahead with the main installation script :



$ php install/step_03.php /home/websites/squiz_matrix/



9. You then need to re apply the locale details



$ php install/compile_locale.php /home/websites/squiz_matrix/



10. With the install finished, it's now a matter of setting permissions for the default apache user who may be 'apache' or may be 'www-data' depending on your particular distribution;



$ chmod -R 755 /home/websites/squiz_matrix

$ cd /home/websites/squiz_matrix

$ chown -R www-data:www-data data cache

$ chmod -R g+w data cache



11. The next step is the creation of an apache virtual host for your shiny new install of Squiz Matrix;



Paste the following into your apache virtual hosts config file, normally 'apache2.conf' or possibly 'httpd.conf'





#<VirtualHost *:80>

#ServerName awesomematrix.mysite.com

#DocumentRoot /home/websites/squiz_matrix/core/web

#

#Options -Indexes FollowSymLinks

#

#<Directory /home/websites/squiz_matrix>

Order deny,allow

Deny from all

#</Directory>

#<DirectoryMatch "^/home/websites/squiz_matrix/(core/(web|lib)|data/public|fudge)">

Order allow,deny

Allow from all

#</DirectoryMatch>

#<DirectoryMatch "^/home/websites/squiz_matrix/data/public/assets">

php_flag engine off

#</DirectoryMatch>

#

#<FilesMatch "\.inc$">

Order allow,deny

Deny from all

#</FilesMatch>

#<LocationMatch "/(CVS|\.FFV)/">

Order allow,deny

Deny from all

#</LocationMatch>

#

#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/

#</VirtualHost>



In Debian or Ubuntu, this file also needs to be contained within /etc/apache2/sites-enabled. Once this has been added, use the following command to place a symlink in /etc/apache2/sites-available;



$ a2ensite awesomematrix.mysite.com



Ensure the server name is exactly the same as in your edited 'main.inc' file. In this example the server name is awesomematrix.mysite.com. If you are creating a live install on the world wide web, this needs to be a valid domain or subdomain.



If you are installing locally then you can name it anything you like but it has to be replicated in the hosts file on your local machine. In Linux; /etc/hosts or in MS Windows; c:\windows\system32\drivers\etc\hosts the file must contain an additional entry to point at your local instance of matrix.

eg:



192.168.0.3 awesomematrix.mysite.com



12. Finally, you are ready to add the Cron job;



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 /home/websites/squiz_matrix/core/cron/run.php

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







Additional info & Troubleshooting:



With non RH based distros (Debian, Ubuntu, etc) there is a requirement to edit /etc/postgres/8.4/main/pg_hba.conf to include the following line ;



local all all trust



If you end up having to repeat these steps numerous times (it's highly likely) a quick methodology is to make the edits to db.inc and main.inc and store them locally along with a tar.gz of an original Matrix checkout sitting next to your install directory.



Then, if you have updated your environment properly (main failure reason), created your subdomain/hosts redirect/DNS and set up your db users correctly, you should literally be able to do everything in about 7 minutes ;



Delete squiz_matrix folder



Delete squiz_matrix database



Extract matrix archive



$ php install/step_01.php /home/websites/squiz_matrix/



Overwrite db.inc & main.inc



$ su postgres



$ createdb -U postgres -O matrix -E SQL_ASCII squiz_matrix

$ createlang -U postgres plpgsql squiz_matrix



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



$ 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/



$ chmod -R 755 /home/websites/squiz_matrix



$ cd /home/websites/squiz_matrix

$ chown -R www-data:www-data data cache





$ chmod -R g+w data cache











You should then be able to login to the backend at the following URL;





http://awesomematrix.mysite.com/_admin









Good luck !







NB:

Am in discussion with Squiz UK SA's to produce one package for the CVS repository that will facilitate installs with fix-missing and hopefully negate all the messing around with Pear / Pecl.

Also, there seems to be some discrepancy with UTF8 versus SQL_ASCII as to DB type. So far SQL_ASCII is winning !