How to Install SugarCRM on Ubuntu 14

Try it in our public cloud & Get $5 Credit

How to Install SugarCRM on Ubuntu 14

If you’re running a small business and are looking for a way to track details on your customers, but aren’t quite ready to leap into the deep end with Salesforce, SugarCRM may be just what you need. SugarCRM is a self-hosted, open source, customer relationship management solution with all you’ll need to get started. This guide gets you up and running with SugarCRM on an Ubuntu 14.04 server.

Getting Started

To complete this guide, you will need the following:
• 1 Node (Cloud Server or Dedicated Server) running Ubuntu 14.
• All commands should be run as the root user
• A LAMP stack with Apache, PHP and MySql

When we’re done. SugarCRM will be running, and you can begin entering your business’ customers and other information.


This CRM requires a few PHP modules that are packaged in Ubuntu’s repositories. This command installs the necessary PHP libraries.

apt-get install php5-cli php5-common php5-dev php5-mysql php5-curl php5-gd php-pear php5-imap php5-mcrypt php5-xmlrpc php5-xsl

Now we need to install the PHP jsmin module.

pecl install jsmin

With all necessary libraries installed, we must now enable them in php.ini so they are automatically available to the PHP process.

nano /etc/php5/apache2/php.ini

You’ll likely be uploading some large files while using SugarCRM. To prevent web server errors, let’s increase the upload_max_filesize configuration parameter to 25 megs.

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 25M

With all modules installed and enabled, let’s restart Apache so any PHP apps have access to the new libraries and configuration.

service apache2 restart

The CRM expects to connect to an IMAP server for tracking inbound email. Let’s pull in the IMAP module so it can accomplish this.

php5enmod imap

SugarCRM also needs a database to store customers and other information. Let’s create that now.

mysql -u root -p

create database sugarcrm;
grant all privileges on sugarcrm.* to 'username'@'localhost' identified by 'password';
flush privileges;

Next, we download the zip file for SugarCRM. It is then unzipped and placed in Apache’s document root, make sure that you don’t have already something inside the html folder or it will be overwritten.

wget http://liquidtelecom.dl.sourceforge.net/project/sugarcrm/1%20-%20SugarCRM%206.5.X/SugarCommunityEdition-6.5.X/SugarCE-6.5.23.zip
unzip SugarCE-6.5.23.zip
cd SugarCE-Full-6.5.23/
cp -R * /var/www/html/
rm -rf /var/www/html/SugarCE-6.5.23*

We need to modify some directory permissions. In particular, Apache needs write access to some areas of your SugarCRM installation.

chown www-data:www-data -R /var/www/html/

An .htaccess file is critical in protecting certain files in your installation from being downloaded or run, particularly important for hiding credentials and other sensitive details. Create an .htaccess file in the document root with this content:

cd /var/www/html
nano .htaccess

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$

Apache should have write permissions on the .htaccess file.

chown www-data:www-data .htaccess

Again, restart Apache so the new modules are integrated.

service apache2 restart

Visit http://your_ip/install.php to complete the CRM’ installation in its web-based interface.

Fill in your name, email, database name and access credentials as set previously.

When finished, remove the installer and its directory so it cannot be run again later.

cd /var/www/html/
rm -rf install/ install.php


Your CRM is now running, and your user has been created with the credentials provided in the installer. It is now time to begin entering your business’ details and customers so you can begin keeping track of how they relate to your company. If this guide was helpful to you, kindly share it with others who may also be interested.