Installing SuiteCRM on Debian 9: A Step-by-Step Guide

SuiteCRM, an enterprise open-source Customer Relationship Management (CRM) platform, is a fork of SugarCRM. This PHP-based platform empowers businesses to tailor strategies, actions, and decisions effectively.

This comprehensive guide walks you through the process of installing the latest SuiteCRM version on a Debian 9 server. We will deploy this powerful CRM application using Apache, PHP, and the MariaDB database engine.

Requirements

  • A server or VPS with at least 2GB of RAM and a minimal installation of Debian 9.
  • Root access to the machine, either locally or via SSH. Alternatively, an account with root privileges via sudo can be used.
  • A static IP address for the external network interface, configured either manually or via DHCP assignment.
  • A public domain name for internet access or server IP address for intranet setups.
  • An operational mail server for communication features. Public services like Gmail or Microsoft Exchange are also viable options.

Step 1: Prepare the Server

Log into your server with root or a sudo-privileged user, then configure the hostname:

hostnamectl set-hostname www.mycrm.org

Verify the hostname update:

hostnamectl
cat /etc/hostname
hostname -s
hostname -f

Update the system:

apt update
apt upgrade

Reboot to apply changes:

systemctl reboot

After rebooting, install essential utilities:

apt install wget curl zip unzip

Step 2: Install Apache and PHP

Install Apache and PHP with required modules for SuiteCRM:

apt install apache2 libapache2-mod-php7.0 php7.0 php7.0-gd php7.0-opcache php7.0-mbstring php7.0-xml php7.0-json php7.0-zip php7.0-curl php7.0-imap

Step 3: Install MariaDB Database

Install MariaDB and the PHP MySQL module:

apt install mariadb-server php7.0-mysql mariadb-client

Ensure Apache and MariaDB are active:

netstat -tlpn
ss -tulpn

Install Netstat if missing:

apt install net-tools

Enable secure connections with Apache SSL module:

a2enmod ssl
a2ensite default-ssl.conf
a2enmod rewrite
systemctl restart apache2

Edit Apache configuration for URL rewrite:

nano /etc/apache2/sites-enabled/000-default.conf
<Directory /var/www/html>
  Options +FollowSymlinks
  AllowOverride All
  Require all granted
</Directory>
nano /etc/apache2/sites-enabled/default-ssl.conf
<Directory /var/www/html>
  Options +FollowSymlinks
  AllowOverride All
  Require all granted
</Directory>

Restart Apache:

systemctl restart apache2

Step 4: Configure Firewall

Allow HTTP/HTTPS traffic:

ufw allow 'WWW Full'

Alternatively:

ufw allow 80/tcp
ufw allow 443/tcp

Step 5: Configure MariaDB and PHP

Secure MariaDB root access:

mysql -h localhost
MariaDB [(none)]> use mysql;
MariaDB [mysql]> update user set plugin='' where user='root';
MariaDB [mysql]> flush privileges;
MariaDB [mysql]> exit;

Run MariaDB security script:

mysql_secure_installation

Set and confirm new root password, remove anonymous users, disallow remote root login, remove test database, and reload privileges.

Update PHP settings in /etc/php/7.0/apache2/php.ini:

cp /etc/php/7.0/apache2/php.ini{,.backup}
nano /etc/php/7.0/apache2/php.ini
file_uploads = On
default_charset = UTF-8
memory_limit = 128M
post_max_size = 60M
upload_max_filesize = 60M
memory_limit = 256M
max_input_time = 60
max_execution_time = 6000
date.timezone = Europe/London

Set the correct timezone according to your location. Enable OPCache for improved performance:

[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

Restart Apache:

systemctl restart apache2

Create a PHP info file for verification:

echo '<?php phpinfo(); ?>' | tee /var/www/html/info.php

Visit https://yourdomain.tld/info.php to verify PHP settings.

Step 6: Install SuiteCRM

Download and extract SuiteCRM:

wget https://suitecrm.com/files/158/SuiteCRM-7.9/178/SuiteCRM-7.9.9.zip
unzip SuiteCRM-7.9.9.zip

Remove default web files, then move SuiteCRM to the webroot:

rm /var/www/html/index.html
rm /var/www/html/info.php
cp -rf SuiteCRM-7.9.9/* /var/www/html/

Set the correct permissions:

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

Create a SuiteCRM database and user:

mysql -u root -p
MariaDB [(none)]> create database mycrm_db;
MariaDB [(none)]> grant all privileges on mycrm_db.* to 'crm_user'@'localhost' identified by 'password1234';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;

Step 7: Finalize SuiteCRM Installation

Access SuiteCRM in a browser via https://yourdomain.tld. Follow the installer steps, providing the database name, user, and admin credentials. Set up your email settings, branding, and localization options.

Redirect to HTTPS

Modify the .htaccess file to enforce HTTPS:

nano /var/www/html/.htaccess
# Redirect to HTTPS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

Setting Up Schedulers

Add a cron job for SuiteCRM schedulers:

crontab -e -u www-data
*   *   *   *   *   /usr/bin/php7.0 -f /var/www/html/cron.php > /dev/null 2>&1

Conclusion

Congratulations! SuiteCRM is now installed and running on your Debian 9 server. For additional customization and support, visit the SuiteCRM wiki page.

Frequently Asked Questions (FAQ)

Q1: How do I access the SuiteCRM admin panel?

A: Use the admin credentials created during installation to log in to SuiteCRM at https://yourdomain.tld.

Q2: Why is there a browser warning when accessing SuiteCRM?

A: The warning appears due to the self-signed SSL certificate. Consider obtaining a certificate from a trusted CA.

Q3: How can I troubleshoot installation issues?

A: Check the server logs for errors, ensure all services are running, and verify file permissions are correctly set.

Q4: Can I install SuiteCRM on a system other than Debian?

A: Yes, SuiteCRM can be installed on various operating systems. The process may vary depending on the system’s package manager and service manager.