Install EspoCRM on Ubuntu 20.04
Introduction
EspoCRM is a free and open-source Customer Relationship Management (CRM) software. It's used to evaluate and manage all the company relationships with other companies, people, projects and so on. Some important features are:
- Sales automation to improve productivity.
- Email account management.
- Social networks integration.
- Customer support.
- Inventory management.
- Process workflow management.
This article explains how to install EspoCRM on Ubuntu 20.04 server.
Prerequisites
- Deploy a fully updated Vultr Ubuntu 20.04 Server.
- Create a non-root user with sudo access.
1. Install LAMP Server
Update system package list.
$ sudo apt update
Install PHP 7.4, Apache, MySQL, and more modules.
$ sudo apt install apache2 mysql-server php7.4 libapache2-mod-php7.4 php7.4-json php7.4-common php7.4-curl php7.4-mysql php7.4-opcache php7.4-intl php7.4-fpm php7.4-xmlrpc php7.4-bcmath php7.4-zip php7.4-mbstring php7.4-gd php7.4-cli php7.4-xml php7.4-zip wget unzip curl -y
Edit the PHP configuration file.
$ sudo nano /etc/php/7.4/apache2/php.ini
To search for a specific line, use Control + W, enter search phrase then press Enter.
memory_limit = 256M
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 180
max_input_time = 180
Enable the web server to start automatically on a reboot.
$ sudo systemctl enable apache2
Restart web server for changes to take effect.
$ sudo systemctl restart apache2
2. Create Database for EspoCRM
Enable the database server to start automatically on a reboot.
$ sudo mysql_secure_installation
When prompted, answer the questions as shown below:
- Setup VALIDATE PASSWORD plugin? Press N, then Enter.
- Remove anonymous users? Press Y, then Enter.
- Disallow root login remotely? Press Y, then Enter.
- Remove test database and access to it? Press Y, then Enter.
- Reload privilege tables now? Press Y, then Enter.
Log in to MySQL shell. At the password prompt, enter your password to continue.
$ sudo mysql -u root -p
Create a MySQL database named espocrm
.
CREATE DATABASE espocrm;
Create a database user named espocrmuser
with a password. Change the value of StrongPassword
with your own secure password.
CREATE USER 'espocrmuser'@'localhost' IDENTIFIED BY 'StrongPassword';
Grant the user full access to the database.
GRANT ALL ON espocrm.* TO 'espocrmuser'@'localhost' WITH GRANT OPTION;
Save the changes.
FLUSH PRIVILEGES;
Exit the shell.
exit;
3. Install EspoCRM
Download the latest version of EspoCRM. To find the latest version of the installation files, please visit official download page.
$ wget https://www.espocrm.com/downloads/EspoCRM-7.0.9.zip
Extract the downloaded installation files.
$ sudo unzip EspoCRM-7.0.9.zip
Rename the extracted files' directory.
$ sudo mv EspoCRM-7.0.9 espocrm
Move the renamed directory to the web root.
$ sudo mv espocrm /var/www/
Delete the downloaded files.
$ sudo rm EspoCRM-7.0.9.zip
Change ownership of the installation directory.
$ sudo chown -R www-data:www-data /var/www/espocrm
Change access permissions for the directory.
$ sudo chmod -R 755 /var/www/espocrm
4. Configure Apache2
Allow port 80
through the firewall.
$ sudo ufw allow 80
Create a new Apache configuration file, espocrm.conf
.
$ sudo nano /etc/apache2/sites-available/espocrm.conf
Add the following content below into the file. Save and close the file:
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/espocrm
ServerName example.com
ServerAlias www.example.com
<Directory /var/www/espocrm/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Disable Apache default configuration file.
$ sudo a2dissite 000-default.conf
Enable EspoCRM Apache configuration file.
$ sudo a2ensite espocrm.conf
Enable Apache rewrite mode.
$ sudo a2enmod rewrite
Restart Apache service.
$ sudo systemctl restart apache2
5. Access EspoCRM
To access the EspoCRM web interface, go to your browser and visit http://Server_IP/
. For example:
http://192.0.2.10/
Conclusion
You have installed EspoCRM on your Ubuntu 20.04 server. Access the installation wizard and complete the installation steps by connecting to your database and creating an administrator account.
Edit crontab to enable automation of EspoCRM tasks using Crontab.
$ sudo crontab -e -u www-data
Add the following line at the bottom of the file. Save and close the file.
* * * * * cd /var/www/espocrm; /usr/bin/php -f cron.php > /dev/null 2>&1
More Information
To learn more about how to use EspoCRM, go to the official documentation page.