Here’s a step-by-step guide to set up EspoCRM on a Linux server (using Ubuntu 20.04 as an example). This setup will include Apache, PHP, and MySQL (LAMP stack).
First, ensure your system is up to date by running the following commands:
sudo apt update && sudo apt upgrade -y
Apache will serve the EspoCRM web application. Install Apache with:
sudo apt install apache2 -y
After installation, start and enable Apache to start on boot:
sudo systemctl start apache2
sudo systemctl enable apache2
MySQL will be the database for EspoCRM. Install MySQL with:
sudo apt install mysql-server -y
Secure the MySQL installation:
sudo mysql_secure_installation
Then, log in to MySQL to create the database and user for EspoCRM:
sudo mysql -u root -p
Inside the MySQL prompt, run:
CREATE DATABASE espocrm;
CREATE USER 'espocrmuser'@'localhost' IDENTIFIED BY 'your_password_here';
GRANT ALL PRIVILEGES ON espocrm.* TO 'espocrmuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
EspoCRM requires PHP 7.4 or later, along with certain extensions. Install them with:
sudo apt install php libapache2-mod-php php-mysql php-curl php-imap php-xml php-mbstring php-zip php-bcmath php-gd -y
Create a new virtual host file for EspoCRM:
sudo nano /etc/apache2/sites-available/espocrm.conf
Add the following content to the file (replace your_domain_or_ip with your server’s domain or IP):
<VirtualHost *:80>
ServerAdmin admin@your_domain_or_ip
DocumentRoot /var/www/html/espocrm
ServerName your_domain_or_ip
<Directory /var/www/html/espocrm>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the new virtual host and rewrite module:
sudo a2ensite espocrm.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Navigate to the web root directory and download the latest version of EspoCRM:
cd /var/www/html
sudo wget https://www.espocrm.com/downloads/EspoCRM-<version>.zip
sudo unzip EspoCRM-<version>.zip -d espocrm
sudo chown -R www-data:www-data /var/www/html/espocrm
sudo chmod -R 755 /var/www/html/espocrm
Open your web browser and navigate to http://your_domain_or_ip. Follow the on-screen instructions to complete the EspoCRM installation.