Installing SpiceCRM 2019.001.01 – a short tutorial

adminSpiceCRM News

Unless you consume SpiceCRM as a cloud offer the first step is to set up the system. In the following post I want to highlight the steps necessary. The post is split in two parts. The first part is focused on setting up a debian based server so we can install, while the second part focuses on the setup of the application itself.

You will find links to youtube videos in this post and you can also download our detailed installation guide.

Part I: Starting up the engine

For the example we will set up the system on a fresh Linux Debian 9 installation.

To install SpiceCRM you will need the following elements set up:

  • MySQL
  • PHP
  • Apache
  • Elasticsearch

Let start with Mysql. TO install MySQL siply use the package manager on Linux

apt install mysql-server mysql-client

This installs MySQL and will allow you to log on to the MySQL Database

mysql -u root -p

The login shoudl take you to the MySQL command line. We will use this to create a user for SpiceCRM with the following commands

CREATE USER 'spicecrm'@'localhost' IDENTIFIED BY 'spicecrm';
GRANT ALL PRIVILEGES ON *.* to 'spicecrm'@'localhost';
FLUSH PRIVILEGES;
quit

In the next step lets install apache

apt install apache2

One of the key elements we need is to enable the rewrite engine on apache. Otherwise the REST interface will not work.

a2enmod rewrite

Furthermore edit the defautl configuration setting a servername and the setting for the rewite rules for the directory.

nano /etc/apache2/sites-enabled/000-default.conf

set the servername in the file and add the follwing

<Directory /var/www>
        Options Indexes FollowSymLinks Includes
        AllowOverride All
        Require all granted
        Allow from all
</Directory>

It is always wise to not use only http but https. Thus we will use Let’s encrypt to iussue a free trusted certificate for our server.

apt install python-certbot-apache -t stretch-backports

When the installation is finished run the certbot and follow the instructions

certbot --apache

You should now be able to display the web page on your server.

in the next step install php and a set of extensions

apt install php7.0 libapache2-mod-
apt install zip php7.0-mysql php7.0-curl php7.0-zip php7.0-mbstring php7.0-imap php7.0-gd php7.0-xml

To ensure SpiceCRM runs edit the default timezone in php.ini

nano /etc/php/7.0/apache2/php.ini

Find the entry for date.timezone and set the value to UTC (or your timezone) and save the file.

restart apache

/etc/init.d/apache2 restart

Last but not least we want to install Elasticsearch using the following commands

apt install openjdk-8-jdk
apt install apt-transport-https
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
apt update
apt install elasticsearch

This installs the jdk, adds the elastic repository and installs elastic. Start Eleasticsearch on your server

/etc/init.d/elasticsearch start

Once elastic search is fired up you can also test the installation calling CURL locally

curl -X GET http://localhost:9200

If all is OK you should see a response from your local elastic server.

You can also see the complete procedure described above in the following youtube Video

Part II: let’s Rock n Roll

If the server is running we want to next install git and clone the two repositories

cd /var/ww/html
apt install git
git clone https://github.com/spicecrm/spicecrm_be_release_core backend
git clone https://github.com/spicecrm/spicecrm_fe_release_core frontend

Navigate to the backend

Click next to start the installation process. Click through the following steps and accept the license until you get to the main settings page

Define the database credentials, the eleastic search settings and click next

Define credentials for the admin user and start the installation. Once the installation is finished log on to the backend and log in to the system. Navigate to the admin section and load the “UI Configuration” for the core package.

Also load the default lanuage for at least english from the admin section

edit file config_override and ensure the source for the language data is pulled from the database:

nano /var/www/html/backend/config_override.php

Navigate to the frontend

Since no configuration is defined the frontend will navigate to the config section.

Fill in the details and the url for the backend and click “check & save” which shoudl take you to the logon

Logon with the credentials you created during the installation process. Then navigate to the package loader int he UI and in a first step reload the core package to ensure to have the latest and up to date configuration.

Additonally you might want to load further configuration packages. We will do a separate tutorial on the packages and the package loader.

SpiceCRM builds heavily on elasticsearch as searchengine. In order to use elastic search you will need to load the configuiration and intialize the elastic engine as well. Navigate to the content packages section in the package manager and load the default fts configuration package.

Once the package is loaded navigate to the fts setup and initialize the fts engine.

In the next steps either set up the cron job to index if there is data already or index the modules manually.

You can also watch the following YouTube video for the complete process as well: