Qadry
unixcop Admin

How To Install SuiteCRM on CentOS 8

Introduction

SuiteCRM is a free open source Customer Relationship Management application for servers. It is written in PHP. Open source CRM is often used as an alternative to proprietary CRM software from major corporations such as HubSpot, Salesforce and Microsoft Dynamics CRM applications. SuiteCRM is a software fork of the popular customer relationship management (CRM) system from SugarCRM. The SuiteCRM project started when SugarCRM decided to stop development of its open-source version.

In this guide, we will show you how to install SuiteCRM in your CentOS 8 Linux.

Installation

Just follow the steps below:

  • Update system
dnf update -y && dnf upgrade -y 
  • Install PHP and required extensions
sudo dnf -y install yum-utils

sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

sudo dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

dnf module reset php    #run this with root user

sudo dnf module install php:remi-7.3

sudo yum install wget php php-bcmath php-json php-xml php-fpm php-common php-curl php-intl php-zip php-imap php-pear php-cgi php-mbstring php-gd php-mysqlnd php-gettext -y
  • Increase php timeout and max file upload size as shown:
sudo vim /etc/php.ini

Then modify the values

upload_max_filesize = 20M
max_execution_time = 120
  • Set the user and group for nginx to run php-fpm
sudo vim /etc/php-fpm.d/www.conf

Then modify them as follows:

user = nginx
group = nginx
  • Start and enable php-fpm
systemctl start php-fpm && systemctl enable --now php-fpm
  • Install MariaDB and Nginx Web Server
sudo dnf -y install nginx mariadb mariadb-server
  • Start and enable nginx and mariadb services
sudo systemctl start nginx && sudo systemctl enable nginx 
sudo systemctl start mariadb && sudo systemctl enable mariadb
  • Once database server has been installed, secure with
mysql_secure_installation
  • Answer all questions as shown below
Enter current password for root (enter for none):
Set root password? [Y/n] Y 
New password: 
Re-enter new 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
  • Create a database for SuiteCRM.
mysql -u root -p
CREATE DATABASE suitecrm_db;
CREATE USER 'suitecrm_usr'@'localhost' IDENTIFIED BY 'unixcopPassword';
GRANT ALL PRIVILEGES ON suitecrm_db.* TO 'suitecrm_usr'@'localhost';
FLUSH PRIVILEGES;
\q;
sudo wget https://github.com/salesagility/SuiteCRM/archive/refs/tags/v7.12-rc.tar.gz
sudo tar xvf v7.12-rc.tar.gz
  • Install composer
sudo wget https://getcomposer.org/installer -O composer-installer.php
sudo php composer-installer.php --filename=composer --install-dir=/usr/local/bin 
  • Move SuiteCRM extracted files to /var/www/html/
sudo mkdir /var/www/html/suitecrm
sudo cp -r SuiteCRM-7.12-rc/* /var/www/html/suitecrm
  • Run composer install
cd /var/www/html/suitecrm
composer install
  • Change ownership of the files to the web-service user
sudo chown -R nginx:nginx /var/www/html/suitecrm
sudo chmod -R 766 /var/www/html/suitecrm
  • Configure SELinux for the files
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/suitecrm(/.*)?"
sudo restorecon -Rv /var/www/html/suitecrm/
  • Configure Nginx
sudo vim /etc/nginx/conf.d/suitecrm.conf 

Then add the following:

server {
    server_name suitecrm.unixcop.com;
    client_max_body_size 20M;
    root /var/www/html/suitecrm;
    
    location / {
       try_files $uri /index.php;
   }
location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass unix:/var/run/php-fpm/www.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }
error_log /var/log/nginx/suitecrm_error.log;
access_log /var/log/nginx/suitecrm_access.log;
location ~ /\.ht {
    deny all;
  }
}
  • Restart nginx and php-fpm.
sudo systemctl restart nginx php-fpm 
  • Allow http port on the firewall settings.
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --reload
  • Access SuiteCRM Web Interface with opening your browser and go to http://suitecrm.unixcop.com

Note: If you get this error, you may need to add session folder to solve the error

Solution

In such case, confirm there is an existing folder /var/lib/php/session, otherwise, create it. Then, make sure the appropriate web server engine has permissions on it

sudo mkdir -p /var/lib/php/session
sudo chown -R nginx:nginx /var/lib/php/session
  • Restart nginx then reload your web-page
  • Select I Accept then click Next
  • Here is an information about the System Environment, you can check that all are OK as shown above Then click Next
  • Provide your database name you created before and edit the site configurations with your info as shown above then click Next.
  • Wait for The installation and creating the default settings.
  • Click Finish button to get start with login SuiteCRM.
  • Provide the username and password that you added them before in the site configurations settings.
  • You will be directed successfully to the SuiteCRM Dashboard as shown above.
  • Also set up cron for the web user to run SuiteCRM Schedulers.
sudo crontab -e -u nginx
  • Then add the following line to the crontab
* * * * * cd /var/www/html/suitecrm; php -f cron.php > /dev/null 2>&1

Conclusion

In this article, we illustrated how to completely install SuiteCRM on your CentOS 8 server.

That’s all … thank you.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

x