SuiteCRM is a free open source CRM (Customer Relationship Management) software written in PHP. It helps you to expand the marketing, sales and customer service departments in your company.

SuiteCRM is suitable for almost any industry, e.g. manufacturing, public sector, technology, finance, education and many more.

In this guide, we will show you how to install SuiteCRM on an Ubuntu 22.04 server with the LAMP stack (Apache, MariaDB and PHP), UFW (Uncomplicated Firewall) enabled and SSL/TLS via Certbot and Letsencrypt.

Prerequisites

To create this guide, you must fulfill the following requirements:

  • An Ubuntu 22.04 server.
  • A non-root user with sudo privileges.
  • A domain name that points to a server IP address.

Installing the LAMP stack as dependencies

Before you start, run the following command to update your Ubuntu repository.

sudo apt update

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

Now run the following command to install the package dependencies for SuiteCRM, including the LAMP stack (Apache2, MariaDB and PHP) and some PHP extensions.

sudo apt install apache2 mariadb-server php php-cli php-mysql php-bcmath php-xml php-zip php-curl php-mbstring php-gd php-tidy php-intl php-cli php-opcache php-soap php-imap php-ldap unzip

Enter y to confirm the installation.

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

Once the installation is complete, run the following command to check the Apache2 service. Make sure Apache2 is running and enabled on your system.

sudo systemctl is-enabled apache2
sudo systemctl status apache2

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

Now check the MariaDB service with the command below. If MariaDB is running, you should see that the output is active (running), if it is enabled, you will see the output enabled.

sudo systemctl is-enabled mariadb
sudo systemctl status mariadb

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

Finally, run the following command to check your PHP version and the list of enabled extensions.

php -v
php -m

Below you can see that PHP 8.1 is installed and used for the installation of SuiteCRM.

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

Set up UFW

In this guide you will run SuiteCRM with UFW enabled. So you need to open both HTTP and HTTPS ports on your Ubuntu server.

If you have not yet enabled UFW, you will need to add OpenSSH and enable UFW.

sudo ufw allow OpenSSH
sudo ufw enable

Type y to confirm and enable UFW.

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

Next, run the following command to add the Apache full profile and open the HTTP and HTTPS protocols.

sudo ufw allow 'Apache Full'

Now check the list of enabled rules for UFW with the following command.

sudo ufw status

Make sure that the OpenSSH and Apache Full profiles are activated.

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

Configure MariaDB server

After you have installed the LAMP stack, let’s take a look at the configuration of the MariaDB server. In this section, you set up the installation of the MariaDB server and create a new database and a new user that is required for SuiteCRM.

Now run the mariadb-secure-installation command to configure your MariaDB server installation.

sudo mariadb-secure-installation

During the whole process you will be confronted with the following MariaDB server configuration:

  • Switch to unix_socket authentication? Enter n and press ENTER. The default MariaDB root user is already protected. Optionally, you can also activate it by entering y for yes.
  • Change the root password? Enter y to confirm and set up your new MariaDB root password.
  • Remove anonymous user? Enter y to confirm.
  • Prohibit root login remotely? Enter y to confirm. If you use the MariaDB root user, only a local connection will be allowed.
  • Remove test database and access to it? Confirm with y and remove the default database “test”.
  • Finally, enter y again to reload all table permissions on your MariaDB server and apply the new changes.

Once the process is complete, you can set up a new database and a new user for SuiteCRM.

Log in to the MariaDB server with the following command. Press ENTER or enter your MariaDB root password when prompted.

sudo mariadb -u root -p

Now execute the following queries to create a new database suitecrmdb with the user suitecrm and the password p4ssw0rd. Make sure that you change the following password with the new password.

CREATE DATABASE suitecrmdb;
CREATE USER 'suitecrm'@'localhost' IDENTIFIED BY 'p4ssw0rd';
GRANT ALL PRIVILEGES ON suitecrmdb.* TO 'suitecrm'@'localhost';
FLUSH PRIVILEGES;

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

Next, run the following query to check the permissions of the suitecrm user. Make sure that the suitecrm user is authorized to access the suitecrmdb database.

SHOW GRANTS FOR 'suitecrm'@'localhost';

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

When all processes are complete, enter quit to exit the MariaDB server.

Configure PHP

After you have configured the MariaDB server, you can now configure the PHP installation. In this case, you will change the default PHP configuration as follows

  • Activate the custom error_reporting.
  • Activate the PHP module OPCcache.
  • Set up custom upload_max_filesize.
  • Set up post_max_size.

Open the default PHP configuration“https://vitux.com/etc/php/8.1/apache2/php.ini” and“https://vitux.com/etc/php/8.1/cli/php.ini” with the following nano editor command.

sudo nano /etc/php/8.1/apache2/php.ini
sudo nano /etc/php/8.1/cli/php.ini

Change the default time zone to the time zone of your server.

date.timezone = Europe/Amsterdam

Adjust the values memory_limit and max_execution_time to your current system. In this example, we will assign 256 MB for PHP.

max_execution_time = 60
memory_limit = 256M

Change the default values upload_max_filesize and post_max_size to 64 MB as follows.

upload_max_filesize = 64M
post_max_size = 64M

Change the default error_reporting parameter as follows.

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE & ~E_WARNING

Uncomment the session.save_path parameter to enable the PHP session path to the /var/lib/php/sessions directory.

session.save_path = "https://vitux.com/var/lib/php/sessions"

Add the parameter opcache.enable=1 to enable the PHP OPCache extension and customize the default configuration as follows.

```
opcache.enable=1

; The OPcache shared memory storage size.


opcache.memory_consumption=256

; The maximum number of keys (scripts) in the OPcache hash table.


; Only numbers between 200 and 100000 are allowed.


opcache.max_accelerated_files=20000

; When disabled, you must reset the OPcache manually or restart the


; webserver for changes to the filesystem to take effect.


opcache.validate_timestamps=0

Save the file and exit the editor when you are finished.

Now run the following command to restart the Apache2 web server and make your changes take effect.

sudo systemctl restart apache2

Downloading and installing SuiteCRM

If you’ve followed the instructions so far, you’ve installed the LAMP stack on your Ubuntu server and configured all the necessary programs, including MariaDB and PHP. Now it’s time to download SuiteCRM and install it on your Ubuntu machine.

First, run the following command to create a new target directory for the installation: /var/www/suitecrm.

mkdir -p /var/www/suitecrm

Browse the /var/www/suitecrm directory and download the SuiteCRM source code using the wget command below. Make sure that you find the link for the latest version on the SuiteCRM download page.

cd /var/www/suitecrm
wget https://suitecrm.com/download/144/suite85/563563/suitecrm-8-5-0.zip

Now run the unzip command to unzip the SuiteCRM source code into your working directory.

unzip suitecrm-8-5-0.zip

Execute the following command to configure the correct permissions for the SuiteCRM source code. In this example, you will also set up the execution permission for the SuiteCRM console command.

find . -type d -not -perm 2755 -exec chmod 2755 {} ;
find . -type f -not -perm 0644 -exec chmod 0644 {} ;
find . ! -user www-data -exec chown www-data:www-data {} ;
chmod  x bin/console

Next, run the following command to install SuiteCRM on your Ubuntu server.

sudo -u www-data ./bin/console suitecrm:app:install -u "alice" -p "AlicePassword" -U "suitecrm" -P "p4ssw0rd" -H "127.0.0.1" -N "suitecrmdb" -S "http://crm.hwdomain.io/"

Make sure that you change the following details:

  • -u and -p as the administrator user for SuiteCRM.
  • the parameters -U, -P, -H and -N as your MariaDB server information.
  • -S for the domain name of your SuiteCRM installation.

Once the installation is complete, you will see an output like the following:

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

Configure Apache Virtual Host

Now that you have downloaded and installed SuiteCRM, let’s add a new configuration for the Apache virtual host you want SuiteCRM to run on.

Before you start, use the following command to activate some Apache modules that SuiteCRM requires.

sudo a2enmod rewrite header ssl

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

Now run the following command in the nano editor to create a new Apache virtual host configuration `/etc/apache2/sites-available/suitecrm.conf`.

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

Add the following virtual host configuration for SuiteCRM. Change the ServerName option with the name of the target domain of your SuiteCRM installation.

DocumentRoot /var/www/suitecrm/public
ServerName crm.hwdomain.io


Options FollowSymLinks
AllowOverride All


ErrorLog /var/log/apache2/suitecrm-error.log
CustomLog /var/log/apache2/suitecrm-access.log common

When you are done, save and exit the file.

Next, run the following command to activate the new virtual host configuration and check the Apache syntax.

a2ensite suitecrm.conf
apachectl configtest

If you have a correct Apache syntax, you will get the output Syntax OK.

Now run the following systemctl command to restart the Apache web server and activate your changes.

sudo systemctl restart apache2

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

Your SuiteCRM installation should now be running. However, to ensure the security of your installation, set up secure HTTPS via Certbot and Letsencrypt.

Securing SuiteCRM with HTTPS via Certbot and Letsencrypt

Before you can access your SuiteCRM installation, you need to enable HTTPS. This can be done via Certbot and Letsencrypt, which provide free SSL certificates and automatically configure HTTPS in your Apache virtual host.

First, run the command below to install the Apache plugins Certbot and Certbot.

sudo apt install certbot python3-certbot-plugin

Once the installation is complete, run the command below to generate new SSL/TLS certificates from Letsencrypt. Make sure to change the detailed information of the domain name and email address with your data.

sudo certbot --apache --agree-tos --no-eff-email --redirect --hsts --staple-oscp --email [email protected] -d crm.hwdomain.io

If all goes well, your SSL/TLS certificates should be available in the /etc/letsencryp/live/yourdomain.com directory. Also, your SuiteCRM installation should be automatically configured with HTTPS.

Start your web browser and go to the domain name of your SuiteCRM installation, e.g. http://crm.hwdomain.io/. You should see the SuiteCRM login page like the one below:

Enter your admin user and password that you created during the installation and confirm with Login.

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

If your installation was successful, you should see the SuiteCRM dashboard like this:

How to Install SuiteCRM on Ubuntu 22.04 linux ubuntu

Conclusion

Congratulations! You have successfully installed SuiteCRM on the Ubuntu 22.04 server. You have installed the open source CRM solution SuiteCRM with the LAMP stack and configured secure HTTPS for SuiteCRM via Certbot and Letsencrypt.