Prerequisite Before you Install ZurmoCRM on Thecus NAS running ThecusOS 6


Before you install ZurmoCRM, please make sure you have meet the LAMP requirements. They will help ZurmoCRM to run faster and more responsive on your ThecusOS 6.

ZurmoCRM for ThecusOS is packaged by Stéphane Guérithault.

Install Apache 2.2.27 and PHP 5.5.11 Module

Please download the latest Apache 2.2.27 with PHP 5.5.11 Module from [ Apache x86 & x64 & PPC (PHP 5.5.11)] [2.2.27.1] Web Server on Thecus Forum. The build-in PHP 5.3.8 lacks some extensions required by ZurmoCRM. This module is a MUST HAVE.

Extract the RAR file, you will get Apache_2.2.27.1_x86.mod which is a Thecus module file. Install by uploading from Control Center→Application Server→App Installation.

After successful installation, click on play button which is a triangle icon in Action column to Enable Module.

Optional Installs MySQL 5.6.17 and phpMyAdmin 4.2.1 Module

ZurmoCRM runs faster with MySQL 5.6.17 than 5.5.14. You may download MySQL 5.6.17 with phpMyAdmin 4.2.1 from [ MySQL-PhpMyAdmin x86 & x64 ] [ 5.6.17-4.2.1 ] MySQL Server on Thecus Forum. This module is optional.

Extract the RAR file, you will get MySQL_5.6.17.0_Apache 2.2.x_x86_OS6.mod which is a Thecus module file. Install by uploading from Control Center→Application Server→App Installation.

After successful installation, click on play button which is a triangle icon in Action column to Enable Module.

MySQL and Socket

Use netstat to find out which socket is used by MySQL. The default MySQL 5.5.14 use /var/lib/mysql/mysql.sock while 5.6.17 from MySQL_5.6.17.0_Apache 2.2.x_x86_OS6.mod is /tmp/mysql56.sock. It might be different on you device.

Here is the result on N2560. More information may be found on How can I find out which socket mysql is running on, from the commandline? on Quora.

# netstat -ln | awk '/mysql(.*)?\.sock/ { print $9 }'
/tmp/mysql56.sock
/var/lib/mysql/mysql.sock

Modify php.ini to Make phpMyAdmin 4.2.1 Work with MySQL 5.6.17

Edit mysql.default_socket in /raid/module/apache/sys/etc/php.ini to tell PHP 5.5.11 in Apache_2.2.27.1_x86.mod to use the right socket.

Restart Apache 2.2.27 to take effect.

# /raid/module/apache/sys/bin/httpd -k restart

You may launch phpMyAdmin 4.2.1 by Control Center→Application ServerApp Installation→MySQLWeb Interface and it should work now.

The default account for MySQL 5.6.17 is root/[empty] while phpMyAdmin 4.2.1 is root/thecus. [empty] means no password.

Optional Installs phpMyAdmin 3.4.5 Module

If you choose to stay with build-in MySQL 5.5.14, you may install phpMyAdmin 3.4.5 from Control Center→Application Server→NAS ApplicationMySQL-kit.

After successful installation, click on play button which is a triangle icon in Action column to Enable Module.

You may launch phpMyAdmin 3.4.5 by Control Center→Application Server→MySQL-kit.

The default password for build-in MySQL 5.5.14 is root/admin which is the same to phpMyAdmin 3.4.5.

Setup Password for MySQL

Use phpMyAdmin or mysql commands to change password. Please specify the socket name with mysql as below if you are using MySQL 5.6.17 according to Solve: Can’t connect to local MySQL server through socket /tmp/mysql.sock on TechRecipes.

# /raid/module/MySQL/bin/BIN/bin/mysql --socket=/tmp/mysql56.sock -u root -p

With build-in MySQL 5.5.14, it is easier.

# mysql -u root -p

Now, run following SQL commands to change password to mysqladmin for root. You may replace mysqladmin with your password. More information may be found in MySQL Change root Password on nextCraft.

use mysql;
update user set password=PASSWORD("mysqladmin") where User='root';

Create MySQL Database

ZurmoCRM needs a MySQL database with COLLATE = utf8_unicode. It is okay to use a different database name to replace zurmo. Run following command in phpMyAdmin or mysql. You may learn more about the SQL syntax in MySQL 5.5 Reference Manual.

CREATE DATABASE zurmo COLLATE = utf8_unicode_ci;

Config your MySQL

ZurmoCRM has some special requirements for MySQL or it might hangs during first-time configuration. Edit my.cnf and add following server parameters in [mysqld] section.

max_allowed_packet     = 20M
max_sp_recursion_depth = 20
thread_stack           = 524288
optimizer_search_depth = 0
sql_mode               = "NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

PHP 5.5 OPcache and APC

Alternative PHP Cache is replaced by OPcache now. You will need APCu to provide user cache compatibility to APC which is included in Apache_2.2.27.1_x86.mod.

Because the default opcache.memory_consumption is 64MB, you might see a page display error message “include(): Unable to allocate memory for pool.” while saving any records. According to a Twitter by Dan O’Brien ‏@ abend0c4 18 Oct 2012, it happens when apc.shm_size is less than 96MB. Please look for opcache.memory_consumption in /raid/module/apache/sys/etc/php.ini and  increase to more than 96MB.

It happens when apc.shm_size is smaller than 96MB.
It happens when apc.shm_size is less than 96MB.

More information about APC configuration may be found in The Perfect APC Configuration by Greg Rickaby.

Increase max_execution_time on Slow Machine

ZurmoCRM needs about 12 minutes to install demo data on Atom. Therefore, please increase max_execution_time to 2000 in /raid/module/apache/sys/etc/php.ini before first-time configuration because it takes longer than default to install demo data.

Load memcached

Make sure memcached is running before first-time-configuration. It is default loaded every boot time after you install Apache_2.2.27.1_x86.mod.

Security

It would be a good idea to create another MySQL account for ZurmoCRM to access its own database. Using the same root account is convenient but risky. Synology Security Issue and How-to Harden your NAS explains some security concepts. You may use iptables to setup Firewall in ThecusOS 6.

ZurmoCRM First-Time Configuration

With MySQL 5.6.17 in MySQL_5.6.17.0_Apache 2.2.x_x86_OS6.mod, use 127.0.0.1 in Database Hostname. With build-in MySQL 5.5.14, use localhost.

FAQ

Where can I download the latest package?

You may download from my dropbox link.

ZurmoCRM for ThecusOS is packaged by Stéphane Guérithault.

It would be nice of you if you use my referral link to register a Dropbox account. Both of us will get extra 500MB of bonus space.

Why I only see a blank page?

Your browser fails to load the page. Please clear your browser cookie or restart Apache with following command. If it doesn’t work, try to restart your NAS.

# /raid/module/apache/sys/bin/httpd -k restart

In some case, it is due to privilege issue. You need to use chown to change the owner of zurmo folder to the same user runs Apache.

Why it fail to save and display “include(): Unable to allocate memory for pool.”?

It is an APC issue. Please increase apc.shm_size to greater than 96MB. Refer to PHP 5.5 OPcache and APC section of this post for detail explain.

Why I see “Error code: 111 Message(Memcached): Connection refused” when I push [Install] button during configuration?

Because memcached is not loaded. Refer to Load memcached section of this post for detail explain.

How to re-install ZurmoCRM?

Just replace $installed = true with $installed = false in /raid/module/ZurmoCRM/bin/ZurmoCRM/app/protected/config/perInstance.php. Then browse the same url again to being the first-time configuration again.

More Information

I list some useful resource here to help you fine tune your LAMP on ThecusOS 6.

  1. phpinfo() Reports on NAS
  2. Thecus ThecusOS6 Configuration and Executable Files

If you need a reference about performance, following post might be useful.

  1. Thecus N2560 as a ZurmoCRM Application Server Performance Report (working on it)

The last is about the session and multi-core processor in LAMP. It helps you to know why only one core is serving you when login to ZurmoCRM.

  1. How Multi-Core Processors Accelerate your LAMP Applications

Reference

  1. Apache
  2. AskUbuntu: How to run mysql command from terminal?
  3. cubecart: How can I turn off MySQL strict mode?
  4. Greg Rickaby: The Perfect APC Configuration
  5. How Multi-Core Processors Accelerate your LAMP Applications
  6. I-ON-RAILS: Creating a MySQL Database from Terminal or Command Line
  7. Intel Atom Processor
  8. LinkedIn Profile: Stéphane Guérithault
  9. MySQL
  10. MySQL: 4.5.2 mysqladmin — Client for Administering a MySQL Server
  11. MySQL: 4.5.1.2 mysql Commands
  12. MySQL: MySQL 5.5 Reference Manual :: 13 SQL Statement Syntax :: 13.1 Data Definition Statements :: 13.1.10 CREATE DATABASE Syntax
  13. netfilter: iptables
  14. nixCraft: MySQL Change root Password
  15. PHP
  16. PHP: Configuring: Runtime Configuration: apc.shm_size
  17. PHP: mysql.default_socket
  18. PHP: PHP Manual: Appendices: php.ini directives: max_execution_time
  19. phpinfo() Reports on NAS
  20. phpMyAdmin
  21. Quora: How can I find out which socket mysql is running on, from the commandline?
  22. Synology Security Issue and How-to Harden your NAS
  23. TechRecipes: Solve: Can’t connect to local MySQL server through socket /tmp/mysql.sock
  24. Thecus Forum: [ Apache x86 & x64 & PPC (PHP 5.5.11)] [2.2.27.1] Web Server
  25. Thecus Forum: [ MySQL-PhpMyAdmin x86 & x64 ] [ 5.6.17-4.2.1 ] MySQL Server
  26. Thecus ThecusOS6 Configuration and Executable Files
  27. Twitter by Dan O’Brien ‏@ abend0c4 18 Oct 2012
  28. Wiki: Firewall (computing)
  29. Wiki: LAMP (software bundle)
  30. Wiki: Multi-core processor
  31. Wiki: Session (computer science)
  32. Wiki: SQL
  33. ZurmoCRM

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.