How to install SugarCRM on Ubuntu 16

Try it in our public cloud & Get $50 Credit
CLAIM NOW

SugarCRM is a popular customer relationship management system that has an open source version, SugarCRM Community Edition, with many devoted Linux users. This guide will walk you through the installation of SugarCRM Community Edition on Ubuntu 16.

Getting Started

Before you begin our guide, make sure you have the following:
• 1 server (Cloud Server or Dedicated Server) running a fresh installation of Ubuntu 16
• All commands must be entered in root

Tutorial

SugarCRM requires a few specific PHP modules to be installed on your server.

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

You’ll need to also adjust some settings in your php.ini. Open up the file and edit these two variables.

nano /etc/php/7.0/apache2/php.ini

First, find upload_max_filesize and increase it to 16M.

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

Next, find post_max_filesize and increase it to 24M. Just to be safe, it should be higher than the value you entor for upload_max_filesize.

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 24M

Save and close the file. Now, restart Apache so that the changes you made to php.ini will take effect.

service apache2 restart

The required php modules will need to be manually enabled.

phpenmod imap
phpenmod zip
phpenmod mbstring

SugarCRM will need its own database, so create that now. Make sure to remember the name and password for later on in the guide.

mysql -u root -p
create database sugarcrm;
grant all privileges on sugarcrm.* to 'globotech'@'localhost' identified by 'globotech1234';
flush privileges;
exit

Finally, we can download SugarCRM itself. Unzip the archive and copy the content to the Document root directory on the server, 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-Full-6.5.23*

You’ll need to modify the permissions of some directories and files and grant Apache write permissions in order for SugarCRM to work correctly.

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

Create a .htaccess file with the following rules:

cd /var/www/html
nano .htaccess

# BEGIN SUGARCRM RESTRICTIONS
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$
# END SUGARCRM RESTRICTIONS

Naturally, you’ll need to grant Apache write permissions to .htaccess for it to take effect.

chown www-data:www-data .htaccess

Now restart Apache once again.

service apache2 restart

The rest of the installation takes place through a web interface. Visit the following URL for the final steps:

http://your_IP/install.php

Now simply enter all the information that the form requests of you. This will include your name, email address, and the database name and password that you set earlier in the guide.

Once you’re all finished with that, you should remove the installation directory for security reasons.

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

Conclusion

With the successful installation of SugarCRM, you will now have access to a premier, affordable customer relations solution. If you found this article helpful, feel free to share it with your friends and let us know in the comments below!

  • Kapil Kalra

    Mention here that all the files in HTML will be deleted due to “rm -f” command, my colleague was not aware about commands, so while installing sugarCRM, she accidentally DELETE all the projects from /var/www/html , otherwise nice and helpful post

    • Guillaume Lemay-Hains

      Greetings Kapil,

      Thank you for your comment about the post, we updated the tutorial to add a warning about the command and the removal of the content of /var/www/html

      Regards,