Posted on Leave a comment

Install SuiteCRM on Ubuntu 20.04 with Nginx, MariaDB and PHP

In this guide, we will show you how to install SuiteCRM (version 7.11.15) on Ubuntu 20.04, and the software will be running under Nginx webserver with MariaDB database.

Now, follow the steps below to install and start using SuiteCRM:

Step 1: Install Nginx Webserver

SuiteCRM is a web based software, so basicaly it needs a webserver to function, and the most popular webserver nowaday is Apache2, then go and install Nginx on Ubuntu.

First, connect to Ubuntu Server and update the repository:

sudo apt-get update

 Then, install the Nginx web server:

sudo apt-get install nginx

After the installation, run the commands below to to launch automatically every time at system boot:

sudo systemctl start nginx.service 
sudo systemctl enable nginx.service

Type http://localhost on your browser, if you see the text below, then Nginx is successfully installed

Step 2: Install MariaDB

SuiteCRM requires a database server to function, in this step we will install and configure MariaDB. To install it run the commands below:

sudo apt-get install mariadb-server mariadb-client

After installing, run the commands below to start the service and enable it to launch every time at system boot:

sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Or

systemctl start mysql
systemctl enable mysql

After that, run the commands below to secure MariaDB server:

sudo mysql_secure_installation

When prompted, you will be asked about the configuration, answer the questions below by following the guide:

  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat password
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]:  Y
  • Reload privilege tables now? [Y/n]:  Y

Restart MariaDB server

sudo systemctl restart mariadb.service

Step 3: Install PHP

SuiteCRM also requires PHP to function and it compatible with multiple PHP versions. In this tutorial, we will use PHP version 7.2 for SuiteCRM installation. To install PHP along with other required extensions, run the commands below:

sudo apt install php7.2-fpm php7.2-common php7.2-mysql php7.2-gmp php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-gd php7.2-bcmath php7.2-imap php7.2-xml php7.2-cli php7.2-zip

sudo apt-get install php-7.2-imap

After the installation is complete, open PHP default configuration to edit php.ini:

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

Then edit the below lines to look like this and save the file:

file_uploads = On 
allow_url_fopen = On 
short_open_tag = On 
memory_limit = 256M 
cgi.fix_pathinfo = 0 
upload_max_filesize = 100M 
max_execution_time = 360 
date.timezone = America/Chicago

That’s it. Save these changes and exit, PHP configuration has been completed. Now start the service and enable it to launch every time at system boot:

systemctl start php7.2-fpm
systemctl enable php7.2-fpm
sudo systemctl restart nginx.service

After PHP is installed, create a test file called phpinfo.php in Nginx default root directory ( /var/www/html/)

sudo nano /var/www/html/phpinfo.php

Type the content below and save

<?php phpinfo( ); ?>

Open your browser and type: http://localhost/phpinfo.php, you should see PHP default test page.

Step 4: Create SuiteCRM Database

Now you’ve install all the required packages, continue below to create SuiteCRM database.

Run the commands below to logon to the database server, when prompted for a password, type the root password you created on Step 2:

sudo mysql -u root -p

Then create a database called suitecrm

create database suitecrm;

Create a database user with new password

create user 'suitecrmuser'@'localhost' identified by 'your_password';

Then grant the user full access to the database

grant all on suitecrm.* TO 'suitecrmuser'@'localhost' IDENTIFIED BY 'your_password' with grant option;

Finally, save your changes and exit

flush privileges;
exit;

Step 5: Download SuiteCRM Latest Release

To get the latest SuiteCRM version, use Github repository, install git tool to download SuiteCRM packages

sudo apt install curl git curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

After installing curl above, change into the Nginx root directory and download SuiteCRM packages from Github

cd /var/www/html sudo git clone https://github.com/salesagility/SuiteCRM.git suitecrm cd /var/www/html/suitecrm sudo composer install --no-dev

Then run the commands below to set the correct permissions for SuiteCRM root directory and give Nginx control

sudo chown -R www-data:www-data /var/www/html/suitecrm/ 
sudo chmod -R 755 /var/www/html/suitecrm/

Step 6: Configure Nginx

Finally, configure Nginx site configuration file for SuiteCRM. This file will control how users access Moodle content. Run the commands below to create a new configuration file called suitecrm

sudo nano /etc/nginx/sites-available/suitecrm

Then copy and paste the content below into the file and save it. Replace the bold line with your own domain name and directory root location.

server {
    listen 80;
    listen [::]:80;
    root /var/www/html/suitecrm;
    index  index.php index.html index.htm;
    server_name mysuitecrm.com www.mysuitecrm.com;

    client_max_body_size 100M;

    location ~ \.php$ {
    try_files           $uri =404;
    fastcgi_index       index.php;
    fastcgi_pass        unix:/var/run/php/php7.2-fpm.sock; # for Ubuntu 20.04
    fastcgi_param   PATH_INFO       $fastcgi_path_info;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }
}

Save the file and exit. After that, run the command below:

sudo nano /etc/hosts

Then add the line below and save:

127.0.0.1 mysuitecrm.com

After configuring the VirtualHost above, enable it by running the commands below to enable the SuiteCRM Site:

sudo ln -s /etc/nginx/sites-available/suitecrm /etc/nginx/sites-enabled/

To load all the settings above, restart Nginx by running the commands below.

sudo systemctl restart nginx.service

Step 7: SuiteCRM Web Installer

Open your web browser and type the SuiteCRM URL in the address bar, you will be redirected to the HTTPS connection and the install.php page, you should see SuiteCRM setup wizard.

http://mysuitecrm/suitecrm/install.php

Follow the on-screen instruction, accept the agreement and click Next

 Validate that all your PHP requirements are met and continue

Type in the database connection info you created above, you’ll also create and admin account to manage SuiteCRM 

After installing, here is your result

Congratulation! You have successfully installed SuiteCRM on Ubuntu 20.04.

Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *