How To Install EspoCRM on Ubuntu 16.04/18.04 Using Apache Web Server

EspoCRM is an open source web application that allows you to see, enter and evaluate all your company relationships regardless of the type. EspoCRM is fast and uses very little server resources.

Use Cases: Manufacturing, Industrial, B2B (can also be converted to B2C), other purposes such as sales, support, customer service and general CRM use.

1. Install necessary PHP libraries

$ sudo apt-get update
$ sudo apt-get install php-mysql php-json php-gd php-zip php-imap php-mbstring php-curl unzip
$ sudo phpenmod imap mbstring
$ sudo service apache2 restart

2. Download and extract/unzip the latest version of EspoCRM (v5.5.6 as of this writing)

EDIT: Current version as of Oct 18, 2019 is v5.7.5

check for the latest version here: https://www.espocrm.com/download/

$ cd /var/www/html
$ wget https://www.espocrm.com/downloads/EspoCRM-5.5.6.zip
$ unzip EspoCRM-5.5.6.zip

3. Change PHP settings

$ sudo nano /etc/php/7.2/apache2/php.ini

Ctrl+w to search for each setting. php.ini settings:

max_execution_time = 180
max_input_time = 180
memory_limit = 256M
post_max_size = 50M
upload_max_filesize = 50M

Ctrl+x, then ‘y' to save and exit. Restart php:

$ sudo service php7.2 restart

4. Set file permissions

Optionally, change the name of the directory:

$ cd /var/www/html
$ sudo mv EspoCRM-5.5.6 espocrm

Change into the EspoCRM directory and change file permissions:

$ cd espocrm
$ sudo find . -type d -exec chmod 755 {} + && find . -type f -exec chmod 644 {} +;
find data custom client/custom -type d -exec chmod 775 {} + && find data custom client/custom -type f -exec chmod 664 {} +;
chmod 775 application/Espo/Modules client/modules;

Set the owner and group-owner (include the ‘.;' at the end):

$ cd /var/www/html/espocrm
$ sudo chown -R www-data:www-data .;

5. Create a new database

If using phpMyAdmin or Adminer, just login and create a new database.

6. Complete the install from the web interface

6.1. Go to yourdomain.com/espocrm (if using a subdomain) or 127.0.0.1/espocrm (if using a local dev) or yourdomain.com (if installing in the server root).

6.2. Follow the onscreen installation process.

6.3. Enter the database name that you created above in step 5 along with the database username and password. Click the ‘Test Connection' button to verify the settings are correct.

6.4. If everything is set up correctly, you should see ‘Success' listed down all rows on the System Requirements page.

6.5. Next, click ‘Install'. Wait until the arrows stop spinning (this may take a minute or two).

6.6. Create your administrator user name and password and continue following the rest of the installation process. You will see on the ‘Installation is complete' page the code to add to the crontab file to run Espo scheduled jobs. You don't have to copy it yet as you will see it again for the final step below:

* * * * * cd /var/www/html/espocrm; /usr/bin/php -f cron.php > /dev/null 2>&1

Note: Each time I start a new session (no browser cache), by going to the EspoCRM url, there appears to be a blank page with only the footer showing. There is no splash screen to show that the page is loading so it appears as if nothing is working. The login screen takes about 5-10 seconds or so to load (this delay also happens on any page reload). It appears to be associated with loading the espo.min.js file located in the ‘clients' directory. Otherwise, after the login fields finally appear, everything works great.

7. Setup a crontab

7.1. Login as administrator into your EspoCRM instance.

7.2. Go to the Scheduled Jobs section in the administrator panel (Menu > Administration > Scheduled Jobs) and copy the string for the crontab. It looks like this one:

* * * * * /usr/bin/php -f /var/www/html/espocrm/cron.php > /dev/null 2>&1

In your terminal, run this command:

$ sudo crontab -e -u www-data

Paste the copied string to the bottom and Ctrl+X, then ‘y' to save and exit.

DONE.

To upgrade EspoCRM, go here: https://www.espocrm.com/download/upgrades/
While upgrades can be done automatically thru the Administration settings, when I tried I got an Error: Null message. An alternative method to upgrade is thru the CLI:

the preferred way – https://www.espocrm.com/documentation/administration/upgrading/

$ php command.php upgrade

or an alternative way:
https://forum.espocrm.com/forum/installation-and-upgrade-help/47530-upgrade-5-5-6-to-5-6-0-error-406

$ php upgrade.php /path/to/upgrade/package.zip

example:

$ php upgrade.php /var/www/html/EspoCRM-upgrade-X.X.X-to-X.X.X.zip

The upgrade can take a while, even with little data.

 

REFERENCES

https://www.espocrm.com/documentation/administration/server-configuration/
https://www.espocrm.com/documentation/administration/apache-server-configuration/
https://www.espocrm.com/documentation/administration/nginx-server-configuration/
https://github.com/espocrm/espocrm

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.