How to Install SuiteCRM on Ubuntu 20.04 with Apache/Nginx

This tutorial will be showing you how to install SuiteCRM on Ubuntu 20.04 with Apache or Nginx web server. SuiteCRM is a free open-source customer relationship management software solution that provides a 360-degree view of your customers and business. It’s a fork of the popular SugarCRM software because SugarCRM stopped releasing its open-source community edition in 2014.

SuiteCRM Features

  • Calendar/Reminder system
  • Document storage
  • Email marketing
  • Internal chat integration
  • lead qualification
  • marketing automation
  • mobile access
  • Quotas/Estimates
  • Segmentation
  • Social media integration
  • task management
  • territory management
  • sales-force automation, marketing campaigns, customer support, collaboration, Mobile CRM, Social CRM, and reporting.
  • Install plugins to extend the functionality of SuiteCRM.
  • SuiteCRM can be easily integrated with third-party SMTP relay services like Gmail, Mandrill, Sendgrid, Amazon SES. You can also use your own mail server.
  • Can integrate seamlessly with many popular third-party apps like Mautic, Gmail, Facebook, Twitter, GoToMeeting, MailChimp, Zoom, Quickbooks, Avaya, DocuSign, etc.
  • Supports multiple user accounts and roles.
  • And much more

how to install suitecrm on ubuntu 20.04 server

Prerequisites of installing SuiteCRM on Ubuntu 20.04 Server

SuiteCRM is written in PHP and relies on MySQL/MariaDB database server. So you need to set up a LAMP stack or LEMP stack. If you prefer Apache web server, then set up LAMP stack.

If you prefer Nginx web server, then set up LEMP stack.

You also need a domain name. I registered my domain name from NameCheap because the price is low and they give whois privacy protection free for life. Without further ado, let’s install SuiteCRM on Ubuntu 20.04 server.

Step 1: Download SuiteCRM onto Your Ubuntu 20.04 Server

Download the latest stable version by executing the following command on your server.

wget https://suitecrm.com/files/162/SuiteCRM-7.11/525/SuiteCRM-7.11.18.zip

Install the unzip utility and unzip it to /var/www/ directory.

sudo apt install unzip

sudo mkdir -p /var/www/

sudo unzip SuiteCRM-7.11.18.zip -d /var/www/

It will be saved under /var/www/SuiteCRM-7.11.18/ directory. We rename it to make it simpler.

sudo mv /var/www/SuiteCRM-7.11.18/ /var/www/suitecrm

Then run the following commands to set the correct permissions.

cd /var/www/suitecrm

sudo chown -R www-data:www-data /var/www/suitecrm/

sudo chmod -R 755 .

sudo chmod -R 775 cache custom modules themes data upload

sudo chmod 775 config_override.php 2>/dev/null

Step 2: Create a MariaDB Database and User for SuiteCRM

Log in to MariaDB console.

sudo mysql -u root

Next, create a new database for SuiteCRM using the following command. This tutorial names it suitecrm, you can use whatever name you like for the database.

CREATE DATABASE suitecrm;

The following command will create a database user and password, and at the same time grant all permission of the new database to the new user so later on SuiteCRM can write to the database. Replace red texts with your preferred database name, username, and password.

GRANT ALL ON suitecrm.* TO 'suitecrm'@'localhost' IDENTIFIED BY 'password';

Flush privileges table and exit MariaDB console.

FLUSH PRIVILEGES;

EXIT;

Step 3: Install Required and Recommended PHP Modules.

Run the following command to install PHP modules required or recommended by SuiteCRM

sudo apt install php-imagick php7.4-fpm php7.4-mysql php7.4-common php7.4-gd php7.4-imap php7.4-json php7.4-curl php7.4-zip php7.4-xml php7.4-mbstring php7.4-bz2 php7.4-intl php7.4-gmp

If you use Apache web server, then you need to disable the PHP module for Apache.

sudo a2dismod php7.4

You also need to disable the prefork MPM module in Apache.

sudo a2dismod mpm_prefork

Now you need to run the following command to enable three modules in order to use PHP-FPM in Apache, regardless of whether mod_php is installed on your server.

sudo a2enmod mpm_event proxy_fcgi setenvif

Then restart Apache.

sudo systemctl restart apache2

Step 4: Create Apache Virtual Host or Nginx Config File for SuiteCRM

Apache

If you use Apache web server, create a virtual host for SuiteCRM.

sudo nano /etc/apache2/sites-available/suitecrm.conf

Put the following text into the file. Replace suitecrm.example.com with your real domain name and don’t forget to create DNS A record for it.

<VirtualHost *:80>
  ServerName suitecrm.example.com
  DocumentRoot /var/www/suitecrm/

  ErrorLog ${APACHE_LOG_DIR}/suitecrm_error.log
  CustomLog ${APACHE_LOG_DIR}/suitecrm_access.log combined

  <Directory />
    Options FollowSymLinks
    AllowOverride All
  </Directory>

  <Directory /var/www/suitecrm/>
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>

Include /etc/apache2/conf-available/php7.4-fpm.conf

</VirtualHost>

Save and close the file. Then enable this virtual host with:

sudo a2ensite suitecrm.conf

Reload Apache for the changes to take effect.

sudo systemctl reload apache2

Now you should be able to see the SuiteCRM web-based install wizard at http://suitecrm.example.com/install.php.

Nginx

If you use Nginx web server, create a virtual host for SuiteCRM.

sudo nano /etc/nginx/conf.d/suitecrm.conf

Put the following text into the file. Replace suitecrm.example.com with your real domain name and don’t forget to create DNS A record for it.

server {
   listen 80;
   listen [::]:80;
   server_name suitecrm.example.com;

   root /var/www/suitecrm;
   error_log /var/log/nginx/suitecrm.error;
   access_log /var/log/nginx/suitecrm.access;
   client_max_body_size 20M;

   index index.php index.html index.htm index.nginx-debian.html;

   location / {
     # try to serve file directly, fallback to app.php
     try_files $uri /index.php$is_args$args;
   }

   location ~ \.php$ {
     include snippets/fastcgi-php.conf;
     fastcgi_pass unix:/run/php/php7.4-fpm.sock;
     #Note: If you install SuiteCRM on iRedMail server, you should use the TCP socket instead. 
     #fastcgi_pass 127.0.0.1:9999
   }

   location ~* ^/index.php {
     # try_files $uri =404;
     fastcgi_split_path_info ^(.+\.php)(/.+)$;
     # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

     fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
     #Note: If you install SuiteCRM on iRedMail server, you should use the TCP socket instead.
     #fastcgi_pass 127.0.0.1:9999
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include fastcgi_params;

     fastcgi_buffer_size 128k;
     fastcgi_buffers 256 16k;
     fastcgi_busy_buffers_size 256k;
     fastcgi_temp_file_write_size 256k;
   }

    # Don't log favicon
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    # Don't log robots
    location = /robots.txt  {
        access_log off;
        log_not_found off;
    }

    # Deny all attempts to access hidden files/folders such as .htaccess, .htpasswd, .DS_Store (Mac), etc...
    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }

     # A long browser cache lifetime can speed up repeat visits to your page
  location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
       access_log        off;
       log_not_found     off;
       expires           360d;
  }
}

Save and close the file. Then test Nginx configuration.

sudo nginx -t

If the test is successful, reload Nginx for the changes to take effect.

sudo systemctl reload nginx

Now you should be able to see the SuiteCRM web-based install wizard at http://suitecrm.example.com/install.php.

Step 5: Enabling HTTPS

To encrypt the HTTP traffic, we can enable HTTPS by installing a free TLS certificate issued from Let’s Encrypt. Run the following command to install Let’s Encrypt client (certbot) on Ubuntu 20.04 server.

sudo apt install certbot

If you use Nginx, then you also need to install the Certbot Nginx plugin.

sudo apt install python3-certbot-nginx

Next, run the following command to obtain and install TLS certificate.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d suitecrm.example.com

If you use Apache, install the Certbot Apache plugin.

sudo apt install python3-certbot-apache

And run this command to obtain and install TLS certificate.

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d suitecrm.example.com

Where

  • --nginx: Use the nginx plugin.
  • --apache: Use the Apache plugin.
  • --agree-tos: Agree to terms of service.
  • --redirect: Force HTTPS by 301 redirect.
  • --hsts: Add the Strict-Transport-Security header to every HTTP response. Forcing browser to always use TLS for the domain. Defends against SSL/TLS Stripping.
  • --staple-ocsp: Enables OCSP Stapling. A valid OCSP response is stapled to the certificate that the server offers during TLS.

The certificate should now be obtained and automatically installed.

suitecrm ubuntu certbot https

Step 6: Increase Upload File Size Limit

PHP sets a limit for upload file size. The default maximum file size for uploading is 2MB. To increase the upload size, edit the PHP configuration file.

sudo nano /etc/php/7.4/fpm/php.ini

Find the following line (line 846).

upload_max_filesize = 2M

Change the value like below. It’s recommended to set it at least 20MB.

upload_max_filesize = 20M

Save and close the file. Alternatively, you can run the following command to change the value without manually opening the file.

sudo sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 20M/g' /etc/php/7.4/fpm/php.ini

Then restart PHP-FPM.

sudo systemctl restart php7.4-fpm

Also restart Apache/Nginx.

sudo systemctl restart apache2

or

sudo systemctl restart nginx

Step 7: Finish SuiteCRM Installation in Web Browser

Now in your browser address bar, type in your domain name for SuiteCRM to access the web install wizard.

https://suitecrm.your-domain.com/install.php

First, accept the GNU AGPL license.

install suitecrm ubuntu 20.04

Then it will check your server environment. If everything is fine, click Next.

install suitecrm on ubuntu 20.

Then enter the MariaDB/MySQL database details created in step 2. You also need to set a password for the admin user, which will be used to log into the web interface. Change the URL to https://suitecrm.your-domain.com and enter your email address.

suitecrm Database Configuration

In the more options section, you can configure the email settings, such as setting the From name and From address.

If SuiteCRM is installed on your mail server, then you can use 127.0.0.1 as the SMTP server and port 25 as the SMTP port, so SuiteCRM will use your own mail server to send emails.

suiteCRM SMTP settings

If SuiteCRM and your mail server are running on different hosts and you want SuiteCRM to send emails via your mail server, then you need to choose Other as mailer transport. Then

  • Enter the hostname of your mail server
  • Choose port 587
  • Choose TLS encryption.
  • Enter the login credential of an email address on your mail server.

suitecrm smtp server specification

Click the Next button and SuiteCRM will be installed.

Step 8: Enable HTTP2 to Improve Performance

You can enable HTTP2 protocol to improve page loading performance for SuiteCRM.

Apache

First, you need to enable the HTTP2 module.

sudo a2enmod http2

Then open the SSL virtual host file.

sudo nano /etc/apache2/sites-enabled/suitecrm-le-ssl.conf

Put the following directive after the opening <VirtualHost *:443> tag.

Protocols h2 http/1.1

Save and close the file. Then restart Apache for the changes to take effect.

sudo systemctl restart apache2

Nginx

To enable HTTP2 protocol in Nginx virtual host, find the following line.

listen 443 ssl; # managed by Certbot

Simply add http2 after ssl.

listen 443 ssl http2; # managed by Certbot

Save and close the file. Then reload Nginx.

sudo systemctl reload nginx

Step 9: Add Cron Jobs

SuiteCRM relies on Cron jobs to work properly. Edit the www-data user’s crontab file. (You should not add SuiteCRM commands in root user’s crontab file.)

sudo -u www-data crontab -e

Add the following lines to the end of this file.

######  SuiteCRM Cron Job #######
* * * * *  php7.4 -f /var/www/suitecrm/cron.php > /dev/null 2>&1

Save and close the file.

How to Integrate with Mautic

Mautic is a free open-source alternative to commercial email service providers like MailChimp. Mautic has a SugarCRM plugin, and since SuiteCRM is based on SugarCRM 6.x, we can use the SugarCRM plugin to integrate with Mautic.

First, we need to go to SuiteCRM web interface, click the dropdown arrow on the upper-right corner to access the administration module.

suiteCRM administration

Then scroll down and select OAuth Keys.

suiteCRM oauth keys

Create a new OAuth key. Give the key a name like mautic. Enter something like matuic-suitecrm in the Consumer key field. Then enter some random characters in the Consumer Secret field. Save your changes.

suitecrm create oauth key

Next, go to Mautic Settings -> Plugins -> SugarCRM. Enter your SuiteCRM URL, client key (consumer key), and client secret (consumer secret). Then enter the SuiteCRM admin username and password. Select 6.x/community version. Click the Authorize App button.

suiteCRM Mautic Integration

Once it’s authorized, you can change the publish status from No to Yes. If you encounter an error while trying to authorize the app, make sure the DNS records for your Mautic and SuiteCRM sub-domain are both propagated to the Internet.

Wrapping Up

I hope this tutorial helped you install SuiteCRM on Ubuntu 20.04. You can also check out SuiteCRM  user manual to learn how to use it. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 8 Average: 4.4]

15 Responses to “How to Install SuiteCRM on Ubuntu 20.04 with Apache/Nginx

  • Vincent
    3 years ago

    Hello Ad,
    Can SuiteCRM connect to the PBX voiceip and the managed call on SuiteCRM? Thank you Ad,

  • Great Installation Instructions, completely straightforward !!
    I have a Question:
    In your “How to Install LAMP Stack on Ubuntu 20.04 Server/Desktop” instructions, url: https://www.linuxbabe.com/ubuntu/install-lamp-stack-ubuntu-20-04-server-desktop

    You include the following command to Enable PHP-FPM for Apache: sudo a2enconf php7.4-fpm

    But this command is not included here in Step 3: Install Required and Recommended PHP Modules.

    What would be the reason for that?

    Thanks again for your support !!

    Julio

    • Xiao Guoan (Admin)
      3 years ago

      Because in this tutorial, the Apache virtual host file has the following line.

      Include /etc/apache2/conf-available/php7.4-fpm.conf

      So you don’t need to run sudo a2enconf php7.4-fpm again.

  • Antonio
    3 years ago

    First of all, I would like to thank you for all your precious work!
    I am a newbie and have a quick question: could SuiteCRM be installed also on UBUNTU 18.04?
    Thanks again.

    • Xiao Guoan (Admin)
      3 years ago

      Yes. You just have to change PHP7.4 to PHP7.2, because Ubuntu 18.04 ships with PHP7.2.

  • You should also change post_max_size=22M in php.ini or add that to the steps to increase the php file upload limit. POST will take precedence over file size.

  • Can you please make a guide for installing SuiteCRM8 on Ubuntu 20.04?? PLease!!!

  • Wow! This is the most complete guide I’ve found for installing SuiteCRM with both Apache & Nginx.

    I’ll be connecting to Modoboa instead of iRedMail, so do you know if I’ll need to tweak anything in the server blocks?

    Thank you very much!!

  • Michael
    2 years ago

    Thank you very much for the great instruction.
    I was using sugarcrm in a local installation on Windows and want now to switch over to suitecrm on Linux. The only thing which is giving me some headache is the server name in suitecrm.conf. If I use localhost as server name in the webbrowser I get the message file not found. Would be great if you could give me some help.

    • Xiao Guoan (Admin)
      2 years ago

      Maybe you should delete the default virtual host.

      sudo rm /etc/nginx/sites-enabled/default

      Then restart Nginx.

      sudo systemctl restart nginx
  • Do you plan on updating this to suitecrm 8.2? Also, I have Iredamail and Mautic on the same server, I was trying to add this but it kept defaulting to suitecrem.example.com/mail.

    • Xiao Guoan (Admin)
      2 years ago

      iRedMail doesn’t use /etc/nginx/conf.d/ for configuration file. You can move it to the /etc/nginx/sites-enabled/ directory.

      sudo mv /etc/nginx/conf.d/suitecrm.conf /etc/nginx/sites-enabled/suitecrm.conf

      Then restart Nginx.

  • Jun Fryan
    2 years ago

    Helo brother, how to go to mautic settings ?

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here