How to install EspoCRM on Ubuntu Server

EspoCRM is an open source Customer Relationship Management software that can help you manage your customer relationships and increase your sales. In this tutorial, we will show you how to install EspoCRM on your Ubuntu Server.

Prerequisites

Step 1: Download EspoCRM

First, you need to download the latest version of EspoCRM from the official website or run the following command:

wget https://www.espocrm.com/downloads/EspoCRM-latest.zip

Step 2: Extract EspoCRM

Once the download is complete, extract the EspoCRM zip file to /var/www/html directory as follows:

sudo unzip EspoCRM-latest.zip -d /var/www/html

Step 3: Create EspoCRM MySQL Database

Next, you need to create a new MySQL database and user for EspoCRM. Log in to the MySQL server with the following command:

sudo mysql -u root -p

Then, create the EspoCRM database and user with the following commands:

CREATE DATABASE espocrm;
CREATE USER 'espouser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON espocrm.* TO 'espouser'@'localhost';
FLUSH PRIVILEGES;

Replace the password with a secure password of your choice.

Step 4: Configure EspoCRM

In this step, we will configure EspoCRM to communicate with the MySQL database. Go to the EspoCRM installation directory:

cd /var/www/html/EspoCRM

Copy the configuration file:

sudo cp data/config.php.sample data/config.php

Open the configuration file and modify the following lines:

'host' => 'localhost',
'database' => 'espocrm',
'username' => 'espouser',
'password' => 'password',

Save and close the file.

Step 5: Set Permissions

Set the proper permissions for the EspoCRM directory and files with the following command:

sudo chgrp -R www-data /var/www/html/EspoCRM
sudo chmod -R 775 /var/www/html/EspoCRM

Step 6: Install Required Modules

EspoCRM requires some PHP modules to be installed. Run the following command to install the required PHP modules:

sudo apt install php-{mbstring,zip,gd,mysql}

Step 7: Configure the Web Server

In this step, we will configure the web server to serve EspoCRM. For example, if you are using Apache as your web server, create a new virtual host file:

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

Add the following lines to the file:

<VirtualHost *:80>
    ServerName espocrm.example.com
    DocumentRoot /var/www/html/EspoCRM
    <Directory /var/www/html/EspoCRM>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Save and close the file. Then, enable the virtual host and restart the Apache service:

sudo a2ensite espocrm.conf
sudo systemctl restart apache2

If you are using Nginx as your web server, create a new server block file:

sudo nano /etc/nginx/sites-available/espocrm.conf

Add the following lines to the file:

server {
    listen 80;
    server_name espocrm.example.com;
    root /var/www/html/EspoCRM;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
    }
}

Save and close the file. Then, enable the server block and restart the Nginx service:

sudo ln -s /etc/nginx/sites-available/espocrm.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Step 8: Access EspoCRM

Congratulations! You have successfully installed EspoCRM on your Ubuntu Server. You can now access EspoCRM by navigating to the following URL from your web browser:

http://espocrm.example.com

Replace espocrm.example.com with your server's domain name or IP address.

Conclusion

In this tutorial, you learned how to install EspoCRM on your Ubuntu Server. You can now start using EspoCRM to manage your customer relationships and grow your business.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!