Install / Update Dolibarr ERP/CRM on Linux

Dolibarr stands as a robust open-source Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) solution, perfectly suited for deployment on Linux-based systems. Its feature set is extensive, covering crucial business operations like accounting, invoicing, project oversight, and inventory control. This guide provides a detailed, step-by-step walkthrough on how to install / update Dolibarr ERP/CRM on Linux.
Prerequisites
Before starting the installation process, ensure your system meets these prerequisites:
- A Linux server (e.g., Ubuntu, Debian, CentOS) with root or sudo privileges.
- A stable internet connection.
- Basic familiarity with the Linux command line.
Step 1: Install the Required Packages
This stage involves installing the necessary software components to support Dolibarr.
Update the Package Index:
This command refreshes the package list, ensuring you have the latest versions available.
$ sudo apt-get update
Install Apache Web Server:
Apache will serve as the web server for Dolibarr.
$ sudo apt-get install apache2 -y
Install MariaDB Database Server:
MariaDB will store Dolibarr’s data.
$ sudo apt-get install mariadb-server mariadb-client -y
Install PHP and Required Modules:
PHP is the scripting language Dolibarr is built on. The modules provide extra functionality.
$ sudo apt-get install php libapache2-mod-php php-mysql php-gd php-curl php-zip php-mbstring php-xml php-intl -y
Restart Apache:
Apply the changes made by the PHP module installation.
$ sudo systemctl restart apache2
Step 2: Secure the MariaDB Database
Securing the database is critical for protecting your data.
Run the MySQL Secure Installation Script:
This interactive script guides you through setting a root password and removing insecure defaults.
$ sudo mysql_secure_installation
Follow the prompts to set a strong root password and answer the security questions.
Log in to the MariaDB Console:
Use the root password you just set to access the MariaDB console.
$ sudo mysql -u root -p
Create the Dolibarr Database and User:
Create a dedicated database and user for Dolibarr, granting it the necessary privileges.
CREATE DATABASE dolibarr;
CREATE USER 'dolibarr'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON dolibarr.* TO 'dolibarr'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Remember to replace 'your_password'
with a strong, unique password.
Step 3: Download and Extract Dolibarr
Now, download the Dolibarr package and extract its contents.
Download the Latest Dolibarr Release:
Download the latest stable version from the Dolibarr GitHub repository.
$ wget https://github.com/Dolibarr/dolibarr/archive/refs/tags/19.0.0.tar.gz
This downloads version 19.0.0. Check the Dolibarr website for the newest version and update the command accordingly.
$ sudo tar -xzf 19.0.0.tar.gz -C /var/www/html/
Extract the downloaded archive to the /var/www/html/
directory.
$ sudo mv /var/www/html/dolibarr-19.0.0 /var/www/html/dolibarr
Rename the extracted directory to "dolibarr" for easier access.
Set the Correct Permissions:
Set the appropriate ownership and permissions for the Dolibarr files.
$ sudo chown -R www-data:www-data /var/www/html/dolibarr
$ sudo chmod -R 755 /var/www/html/dolibarr
These commands ensure the web server user (www-data
) can access and modify the necessary files.
Step 4: Configure the Apache Web Server
Create a virtual host configuration for Dolibarr within Apache.
Create a Virtual Host Configuration File:
Create a new configuration file for Dolibarr in the Apache sites-available directory.
$ sudo nano /etc/apache2/sites-available/dolibarr.conf
Add the following content to the file, replacing dolibarr.example.com
with your desired domain name:
<VirtualHost *:80>
ServerName dolibarr.example.com
DocumentRoot /var/www/html/dolibarr/htdocs
<Directory /var/www/html/dolibarr/htdocs>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/dolibarr-error.log
CustomLog ${APACHE_LOG_DIR}/dolibarr-access.log combined
</VirtualHost>
Enable the Virtual Host:
Enable the newly created virtual host.
$ sudo a2ensite dolibarr.conf
Restart Apache:
Restart Apache to apply the virtual host configuration.
$ sudo systemctl restart apache2
Step 5: Complete the Dolibarr Installation
Finish the installation through the web browser.
Open the Dolibarr Installation Page:
Open your web browser and navigate to http://dolibarr.example.com/install/
.
Follow the Dolibarr Installation Wizard:
The wizard will guide you through the remaining steps, including setting up the database connection and creating an administrator account.
Secure the Installation:
Prevent further access to the installation wizard by creating a lock file.
$ sudo touch /var/www/html/dolibarr/documents/install.lock
Congratulations! You have successfully completed the install / update Dolibarr ERP/CRM on Linux.
Updating Dolibarr
To update Dolibarr to a newer version, follow these steps:
Backup Your Dolibarr Data:
Before updating, create a backup of your Dolibarr data, including the database and any custom configurations or files.
Download the Latest Dolibarr Release:
$ wget https://github.com/Dolibarr/dolibarr/archive/refs/tags/19.0.1.tar.gz
Replace the version number with the latest stable release.
$ sudo tar -xzf 19.0.1.tar.gz -C /var/www/html/
$ sudo mv /var/www/html/dolibarr-19.0.1 /var/www/html/dolibarr
Set the Correct Permissions:
$ sudo chown -R www-data:www-data /var/www/html/dolibarr
$ sudo chmod -R 755 /var/www/html/dolibarr
Clear the Cache and Logs:
$ sudo rm -rf /var/www/html/dolibarr/documents/cache/*
$ sudo rm -rf /var/www/html/dolibarr/documents/logs/*
Restart Apache:
$ sudo systemctl restart apache2
Troubleshooting
If you encounter issues during the installation or update process, here are some common troubleshooting steps:
Check the Apache Error Logs:
$ sudo tail -n 50 /var/log/apache2/error.log
Check the Dolibarr Logs:
$ sudo tail -n 50 /var/www/html/dolibarr/documents/logs/dolibarr.log
Verify the Database Connection:
$ sudo mysql -u dolibarr -p
Check the Dolibarr Configuration File:
$ sudo nano /var/www/html/dolibarr/htdocs/conf/conf.php
Alternative Solutions for Install / Update Dolibarr ERP/CRM on Linux
While the above method describes a manual installation, here are two alternative approaches for install / update Dolibarr ERP/CRM on Linux:
1. Using Docker:
Docker provides a containerized environment, simplifying the installation and management of Dolibarr and its dependencies. This method isolates Dolibarr from the host system, preventing potential conflicts.
-
Explanation: Docker allows you to run Dolibarr within a container, which includes all the necessary components (Apache, PHP, MariaDB) in a pre-configured environment. This eliminates the need to manually install and configure each component, significantly reducing the risk of errors. Docker also makes upgrades easier, as you can simply replace the old container with a new one.
-
Steps:
- Install Docker and Docker Compose: Follow the official Docker documentation for your Linux distribution.
-
Create a Docker Compose file (docker-compose.yml):
version: "3.8" services: db: image: mariadb:10.6 restart: always environment: MYSQL_ROOT_PASSWORD: your_root_password MYSQL_DATABASE: dolibarr MYSQL_USER: dolibarr MYSQL_PASSWORD: your_dolibarr_password volumes: - db_data:/var/lib/mysql dolibarr: image: dolibarr/dolibarr:latest restart: always ports: - "80:80" environment: DB_HOST: db DB_NAME: dolibarr DB_USER: dolibarr DB_PASS: your_dolibarr_password depends_on: - db volumes: - dolibarr_data:/var/www/html/dolibarr/documents volumes: db_data: dolibarr_data:
Replace
your_root_password
andyour_dolibarr_password
with secure passwords. -
Run Docker Compose: Navigate to the directory containing the
docker-compose.yml
file and run:docker-compose up -d
This command will download the necessary images and start the Dolibarr container.
- Access Dolibarr: Open your web browser and navigate to
http://localhost
.
2. Using a Pre-built Virtual Machine (VM):
Several providers offer pre-built VMs with Dolibarr already installed and configured. This is the easiest and fastest way to get Dolibarr up and running.
-
Explanation: A pre-built VM contains a complete operating system and all the software necessary to run Dolibarr. It’s like downloading a ready-to-use appliance. This eliminates almost all manual configuration and is ideal for users who want a hassle-free installation.
-
Steps:
- Choose a VM provider: Popular options include Bitnami, TurnKey Linux, and cloud providers like AWS, Google Cloud, and Azure.
- Download the VM image: Download the pre-built Dolibarr VM image from the provider’s website. These are often in formats like
.ova
(for VirtualBox or VMware). - Import the VM into a virtualization platform: Use a virtualization platform like VirtualBox or VMware to import the downloaded VM image.
- Start the VM: Power on the VM.
- Access Dolibarr: Follow the provider’s instructions to access Dolibarr. This usually involves finding the IP address of the VM and accessing it through a web browser. The provider will also supply default login credentials.
These alternative methods offer different trade-offs in terms of complexity, control, and speed. Docker is a good choice for users who want a more isolated and manageable environment, while a pre-built VM is ideal for those who prioritize ease of installation. Whichever method you choose, remember to back up your data regularly and keep your system secure. This guide thoroughly covers how to install / update Dolibarr ERP/CRM on Linux.