We at DRI deal a lot with installing, demo’ing, customizing, and so on…of SugarCRM. No matter what or when I’m installing SugarCRM I run into a issue…especially being the newbie on the team. Working for a company that specializes in CRM and integration of Web Platform (WordPress, Drupal, and other front-ends) into Sugar is amazing and truly a lot of learning happens on the go.

I often find myself looking for scripts, trying to find installation documentation, and then actually trying to put it to use. The real question here is how often do we as individuals actually read the install documents from a Software Provider…especially when it dense. For my own references and my own sanity, I wrote this blog.

My intention – to use this blog posts whenever installing or creating a new instance of Sugar. The body and contents of this posts will be straightforward and will assume that you have a decent linux or system admin skill-set.

What should you understand before hand?
SugarCRM is a Customer Relationship Management solution / tool. It is used by various companies to manage customer relationships, create opportunity workflows and processes, meet sales quotas, and its also used a knowledge base & customer support solution. There are other various implementations of the system…which I won’t go into but feel free to reach out to me at DRI-Global.com. Learn more about how DRI Implements CRM.

Resources used for this tutorial:
Sugar Documentation
OS Tech Blog

First understand that I am installing SugarCRM on a Centos 6.4 32 VPS from Digital Ocean.

1) Download or have a zip / tarball / {insert favorite data compression format} of SugarCRM
2) Create the VPS on Digital Ocean – select NY1 or NY2, Centos 6.4 x32
3) Get the SSH information from your email and get ready to party…
4) Login in as root
5) Do centos system updates, yum update -y

6) Install required packages…install apache, vim, php, and MySQL on Centos. Remember its important to download PHP 5.3-.4 for Sugar and not higher.
yum install -y mysql mysql-server httpd php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-magickwand php-mapserver php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel unzip wget vim

7) Open your php.ini file located in /etc/php.ini and change the following values, vim /etc/php.ini
max_execution_time = 120
memory_limit = 512M
post_max_size = 30M
upload_max_filesize = 30M

8) Start MySQL (MYSQLD) and Apache (HTTPD)
/etc/init.d/httpd start
/etc/init.d/mysqld start
chkconfig httpd on
chkconfig mysqld on

alternative commands

service mysqld start
service httpd start
chkconfig httpd on
chkconfig mysqld on

9) Configure your MySQL installation by going through the wizard at /usr/bin/mysql_secure_installation, click enter and enter a new password

10) Now either use Secure Copy Transfer protocol to transfer the file over to the new VPS server or download the file using WGET
Option A (file is on desktop): scp /path/to/file.zip root@ipaddress:/var/www/html/{name of zip or leave blank}
Option B (Using wget): wget http://webaddress-to-file.com

11) unzip the SugarCRM file (the key here is to remember your file name), cd /var/www/html, unzip SugarCRM.zip

12) Now you have a folder named SugarCRM, its time to change the file / folder permission. everything must be owned by the apache user for apache to work.
chown apache:apache -R SugarCRM

13) We also now need to update the file / folder permissions so that Sugar can execute the appropriate actions
chmod 644 -R /config.php /config_override.php /sugarcrm.log
chmod 775 -R /cache /custom /data /modules

14) Edit the httpd config file, vim /etc/httpd/conf/httpd.conf and change AllowOverride to All in the root directory (/var/www/html/ )

15) Go through the SugarCRM installation tutorial / wizard, located at http://ipaddress/{folder-name}/install.php

16) After install go back to terminal and update the .htaccess file for optimizations

RedirectMatch 403 (?i).*\.log$
RedirectMatch 403 (?i)/+not_imported_.*\.txt
RedirectMatch 403 (?i)/+(soap|cache|xtemplate|data|examples|include|log4php|metadata|modules)/+.*\.(php|tpl)
RedirectMatch 403 (?i)/+emailmandelivery\.php
RedirectMatch 403 (?i)/+upload/
RedirectMatch 403 (?i)/+custom/+blowfish
RedirectMatch 403 (?i)/+cache/+diagnostic
RedirectMatch 403 (?i)/+files\.md5$

# Fix mimetype for logo.svg (SP-1395)
AddType image/svg+xml .svg
AddType application/json .json
AddType application/javascript .js

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
# Replace <basepath> with the relative web root path to your instance
RewriteBase /reebok
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^rest/(.*)$ api/rest.php?__sugar_url=$1 [L,QSA] RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^cache/api/metadata/lang_(.._..)_(.*)_public\.json$ api/rest.php/v10/lang/public/$1?platform=$2 [L,QSA] RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^cache/api/metadata/lang_(.._..)_([^_]*)\.json$ api/rest.php/v10/lang/$1?platform=$2 [L,QSA] RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^cache/Expressions/functions_cache(_debug)?.js$ api/rest.php/v10/ExpressionEngine/functions?debug=$1 [L,QSA] </IfModule>

<FilesMatch “\.(jpg|png|gif|js|css|ico)$”>
<IfModule mod_headers.c>
Header set ETag “”
Header set Cache-Control “max-age=2592000”
Header set Expires “01 Jan 2112 00:00:00 GMT”
<IfModule mod_expires.c>
ExpiresByType text/css “access plus 1 month”
ExpiresByType text/javascript “access plus 1 month”
ExpiresByType application/x-javascript “access plus 1 month”
ExpiresByType image/gif “access plus 1 month”
ExpiresByType image/jpg “access plus 1 month”
ExpiresByType image/png “access plus 1 month”

And thats it you’ve officially installed SugarCRM on your centos VPS.
Please feel free to reach out to me directly via contact page or through this blog for questions / comments.