How to Install SuiteCRM on Ubuntu 20.04
This tutorial exists for these OS versions
- Ubuntu 22.04 (Jammy Jellyfish)
- Ubuntu 20.04 (Focal Fossa)
- Ubuntu 16.04 (Xenial Xerus)
On this page
SuiteCRM is a free, open-source, and enterprise-class CRM system developed by SalesAgility. It is a fork of the SugarCRM Community Edition. It comes with all the functionalities required to run any business with CRM and ERP needs. It offers a wide range of features including, Email marketing, Social media integration, marketing automation, Internal chat integration, Document storage, Reminder, Task management, and many more. This post will show you how to install SuiteCRM with Nginx and Let's Encrypt SSL on Ubuntu 20.04.
Prerequisites
- A server running Ubuntu 20.04.
- A valid domain name pointed with your server IP.
- A root password is configured on the server.
Getting Started
Before starting, you will need to update your system packages to the latest version. You can update them using the following command:
apt-get update -y
Once your server is updated, you can proceed to the next step.
Install Nginx, MariaDB and PHP
First, you will need to install the Nginx web server, MariaDB, PHP, and other PHP extensions to your server. You can install all of them using the following command:
apt-get install nginx mariadb-server php7.4 php7.4-fpm php7.4-gd php7.4-opcache php7.4-mbstring php7.4-xml php7.4-json php7.4-zip php7.4-curl php7.4-imap php-mysql unzip -y
After installing all the packages, edit the php.ini file and change the recommended settings:
nano /etc/php/7.4/fpm/php.ini
Change the following settings:
post_max_size = 60M upload_max_filesize = 60M memory_limit = 256M max_input_time = 60 max_execution_time = 5000 date.timezone = Asia/Kolkata
Save and close the file then restart the PHP-FPM service to apply the changes.
systemctl restart php7.4-fpm
At this point, the LEMP server is installed in your server. You can now proceed to the next step.
Create a Database for SuiteCRM
SuiteCRM requires a database to store their contents. First, log in to the MariaDB shell using the following command:
mysql
Once you are log in, create a database and user with the following command:
MariaDB [(none)]> CREATE DATABASE suitecrm;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON suitecrm.* TO 'suitecrm'@'localhost' IDENTIFIED BY 'password';
Next, you will need to flush the privileges to apply the changes.
MariaDB [(none)]> FLUSH PRIVILEGES;
Next, exit from the MariaDB console with the following command:
MariaDB [(none)]> EXIT;
Now, you have a database and users are ready for SuiteCRM. You can now proceed to the next step.
Install SuiteCRM
First, go to the SuiteCRM official website and download the latest version of SuiteCRM using the following command:
wget https://sourceforge.net/projects/suitecrm/files/SuiteCRM-7.11.19.zip
Once the download is completed, unzip the downloaded file with the following command:
unzip SuiteCRM-7.11.19.zip
Next, move the extracted directory to the Nginx root directory with the following command:
mv SuiteCRM-7.11.19 /var/www/html/suitecrm
Next, set proper permission and ownership to the suitecrm directory:
chown -R www-data:www-data /var/www/html/suitecrm/
chmod 755 -R /var/www/html/suitecrm/
Once you are finished, you can proceed to configure Nginx.
Configure Nginx to Host SuiteCRM
Next, you will need to create an Nginx virtual host configuration file to host SuiteCRM on the internet. You can create it with the following command:
nano /etc/nginx/conf.d/suitecrm.conf
Add the following lines:
server { listen 80; server_name suitecrm.example.com; root /var/www/html/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; } 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; 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 when you are finished then verify the Nginx for any syntax error using the following command:
nginx -t
You should get the following output:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Next, restart the Nginx service to apply the changes:
systemctl restart nginx
To check the status of the Nginx service, run the following command:
systemctl status nginx
You should get the following output:
? nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2021-05-22 10:16:45 UTC; 4s ago Docs: man:nginx(8) Process: 18988 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Process: 19000 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Main PID: 19001 (nginx) Tasks: 2 (limit: 2353) Memory: 2.7M CGroup: /system.slice/nginx.service ??19001 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; ??19002 nginx: worker process May 22 10:16:45 ubuntu2004 systemd[1]: Starting A high performance web server and a reverse proxy server... May 22 10:16:45 ubuntu2004 systemd[1]: Started A high performance web server and a reverse proxy server.
At this point, Nginx is configured to serve SuiteCRM. You can now proceed to access SuiteCRM.
Access SuiteCRM
Now, open your web browser and access the SuiteCRM using the URL http://suitecrm.example.com. You should see the following page:
Accept the license agreement and click on the Next button. You should see the following page:
Make sure all prerequisites are installed then click on the Next button. You should see the following page:
Provide your database name, user, password, admin username, password, SuiteCRM URL, email address then click on the Next button. Once the installation has been finished, you should see the following page:
Now, click on the Next button. You should see the SuiteCRM login page:
Provide your admin username, password and click on the LOG IN button. You should see the SuiteCRM dashboard on the following page:
Secure SuiteCRM with Let's Encrypt
Next, you will need to install the Certbot client package to install and manage the Let's Encrypt SSL.
First, install the Certbot with the following command:
apt-get install certbot python3-certbot-nginx -y
Once the installation is finished, run the following command to install the Let's Encrypt SSL on your website:
certbot --nginx -d suitecrm.example.com
You will be asked to provide a valid email address and accept the term of service as shown below:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator nginx, Installer nginx Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [email protected] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Obtaining a new certificate Performing the following challenges: http-01 challenge for suitecrm.example.com Waiting for verification... Cleaning up challenges Deploying Certificate to VirtualHost /etc/nginx/conf.d/suitecrm.conf
Next, choose whether or not to redirect HTTP traffic to HTTPS as shown below:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Type 2 and hit Enter to finish the installation. You should see the following output:
Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/suitecrm.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://suitecrm.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=suitecrm.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/suitecrm.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/suitecrm.example.com/privkey.pem Your cert will expire on 2021-10-30. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le - We were unable to subscribe you the EFF mailing list because your e-mail address appears to be invalid. You can try again later by visiting https://act.eff.org.
Now, your SuiteCRM is secured with Let's Encrypt SSL. You can access it securely using the URL https://suitecrm.example.com
Conclusion
That's it for now. You have successfully installed SuiteCRM with Nginx and Let's Encrypt SSL on Ubuntu 20.04. You can now implement SuiteCRM in your organization. For more information visit the SuiteCRM user manual.