Debianhelp.co.uk


SugarCRM Configuration in debian Sarge

What is SugarCRM ?

SugarCRM includes a sales, marketing, and service suite of CRM applications. Sugar.Sales includes account and contact management, opportunity management, activity tracking, charting, reporting, and email integration with MS Outlook. SugarCRM is easy to install and supports custom user interface templates that are optimized for speed.

SugarCRM v4.0.1 now available! A complete CRM and groupware system for businesses of all sizes. Functionality includes sales force automation, marketing campaigns, support cases, project mgmt, calendaring, documents and more. Built on PHP and MySQL.

Download SugarCRM

https://sourceforge.net/projects/sugarcrm/

SugarCRM Documentation ,outlook plugin ,language packs and themes

http://www.sugarcrm.com/crm/download/sugar-suite.html

Required packages for debian

apache2
libapache2-mod-php4
php4-common
php4-gd2
php4-mysql
mysql-server
mysql-client

Installing SugarCRM in Debian

There is no Debian package for Sugar, and so we need to download the source from the Sugar website to our home directory:

# cd ~

# wget http://www.sugarforge.org/frs/download.php/919/SugarSuite-4.0.1.zip

Become root, and then move Sugar to your web-root and extract the files:

# su

# cp SugarSuite-4.0.1.zip /var/www

# cd /var/www

# unzip SugarSuite-4.0.1.zip

Here we are using Apache virtual hosts to host lots of domains on a single server. We create a directory for each host under /var/www named, for example, hostname.example.com.

Assuming your are using Apache virtual hosts and a similar directory structure, rename the Sugar directory to match it's domain name. Here we use sugar.example.com:

# mv SugarSuite-Full-4.0.1 sugar.example.com

# rm SugarSuite-4.0.1.zip

Note we have also removed the ZIP file.

By default on Debian Apache runs as www-user. Set ownership of the Sugar directory to the Apache user:

# chown -R www-data:www-data /var/www/sugar.example.com

The Apache user requires write access to certain directories and the config file in order for the system to function properly. Set the permissions on these as follows:

# chmod -R 755 /var/www/sugar.example.com
# chmod -R 775 /var/www/sugar.example.com/cache
# chmod -R 775 /var/www/sugar.example.com/custom
# chmod -R 775 /var/www/sugar.example.com/data
# chmod -R 775 /var/www/sugar.example.com/modules
# chmod 774 /var/www/sugar.example.com/config.php

Apache Configuration

Next we need to configure a virtual host for our Sugar domain sugar.example.com in Apache.

Note our use of the AllowOverride directive, which is used to allow a .htaccess file in the Sugar root directory to affect web-server configuration:

# vi /etc/apache/conf.d/sugar.example.com.conf
<VirtualHost *>
ServerAdmin webmaster@sugar.example.com
DocumentRoot /var/www/sugar.example.com
ServerName sugar.example.com
</VirtualHost>
<Directory /var/www/sugar.example.com/>
AllowOverride All
</Directory>

Once you have these pieces in place (and started), you need to edit the configuration file for apache to know about PHP4 and your server. To enable PHP4 uncomment or add the following line to /etc/apache2/apache2.conf

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps


Once this is done make sure your server knows about the directory where you want to install the SugarCRM. Edit /etc/apache2/sites-enabled/000-default and change all occurances of /var/www with the directory you want to use (e.g. /web/sugarcrm).

Edit /etc/php4/apache2/php.ini and add the following two lines

extension=mysql.so
extension=gd2.so

And then restart Apache and test the website:

# /etc/init.d/apache reload

http://sugar.example.com/You may have noticed some warnings on Sugar's status check page. See below.

PHP tuning for apache

Increase PHP's maximum file upload size:

# cp /etc/php4/apache/php.ini /etc/php4/apache/php.ini.20060312

# ee /etc/php4/apache/php.ini

memory_limit = 50M

And restart Apache:

# /etc/init.d/apache restart

Extra Packages

Install some packages that Sugar can use:

# aptitude install catdoc xpdf-utils

MySQL Configuration

Sugar can help us setup the MySQL database if we provide it some credentials:

enter a database password for Sugars database

check Create database and Create user

uncheck Database account above is a privileged user

enter the root Mysql user username and password

and then click next

Basic Configuration

Enter an admin password for Sugar's interface

Check for errors

check your config file contains 'installer_locked' => true

and click next

Now login and explore the interface. Come back to finalise a few points later.

Schedule

Sugar can perform actions according to a schedule, but we need to configure the scheduler. Add a cron job to the Apache user's crontab:

# crontab -e -u www-data

* * * * * wget --quiet --non-verbose http://sugar.example.com/cron.php > /dev/null 2>&1
The scheduler should now function.

As sugarcrm contains sensible data it is mandatory to create backups, especially as we don't trust mysql that much. Therefore I created the following backup script in /web/sugarcrm/etc/backup.sh

#!/bin/sh
datum=$(date +%Y%m%d)
file=/web/backup/sugarcrm/$datum-sugarcrm-backup.sql
/usr/bin/mysqldump sugarcrm --complete-insert -u sugarcrm --flush-logs --opt --add-locks >$file /bin/gzip $file