How to install the Dolibarr ERP/CRM on Ubuntu 18.04

If you're looking for an in-house ERP/CRM solution, Jack Wallen shows you how to set one up with the open source Dolibarr solution and Ubuntu Server 18.04.

Image: Jack Wallen

If you're looking for an all-in-one ERP/CRM to run from your on-site data center, and you happen to have a Ubuntu 18.04 Linux server waiting to serve, you're in luck. Dolibarr is a very capable one-stop shop for your ERP/CRM needs that can handle the likes of:

  • Customers
  • Invoices
  • Orders
  • Products
  • Stocks
  • Agenda
  • E-mailings
  • Shipments

I'm going to walk you through the installation of this open source tool that can help empower your workflow. I'll assume only two things: That you have your Ubuntu 18.04 Server up and running, and that you have access to an account with sudo privileges.

With that said, let's install.

SEE: IT pro's guide to working smarter with Linux (Tech Pro Research)


The first thing we must do is take care of a few dependencies. Let's take care of the Apache web server first, which can be done with the following command:

sudo apt-get install apache2

Once Apache is installed, start and enable it with the following command:

sudo systemctl start apache2
sudo systemctl enable apache2

Next we need a database. Since we're working with Ubuntu 18.04, we'll go with MariaDB. To install this service, run the following command:

sudo apt-get install mariadb-server mariadb-client

Start and enable the database server with the commands:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Secure the database with the command:

sudo mysql_secure_installation

You will be asked a few simple questions. Out of the box, there is no password set. So when prompted, simply hit Enter.

It's now time to install the necessary PHP modules. Since we're working with Ubuntu 18.04, we'll use PHP 7.2. To install these dependencies, issue the following command:

sudo apt install php7.2 libapache2-mod-php7.2 php7.1-common php7.2-curl php7.2-intl php7.2-mbstring php7.2-json php7.2-xmlrpc php7.2-soap php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-zip

We also need mcrypt installed. To take care of that dependency, issue the following commands:

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install php7.2-dev
sudo apt-get -y install libmcrypt-dev
sudo pecl install mcrypt-1.0.1

Finally, PHP must be configured. Open the configuration file with the command:

sudo nano /etc/php/7.2/apache/php.ini

Within that file, you'll want to make the following changes:

file_uploads = On
allow_url_fopen = On
memory_limit = 512M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = YOUR/TIME/ZONE

where YOUR/TIME/ZONE is your time zone.

Save and close that file, and then restart Apache with the command:

sudo systemctl restart apache2

Create the database

Dolibarr requires a database. To create the database and a valid user, issue the following commands:

sudo mysql -u root -p
CREATE USER 'dolibarruser'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL ON dolibarr.* TO 'dolibarruser'@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

where PASSWORD is a unique, strong password.

Download and unpack Dolibarr

We now need to download, unpack, move, and give the Dolibarr directory the proper permissions. This can all be done with the following commands:

sudo apt-get install unzip
cd /tmp && wget
sudo mv dolibarr-7.0.3 /var/www/html/dolibarr
sudo chown -R www-data:www-data /var/www/html/dolibarr/
sudo chmod -R 755 /var/www/html/dolibarr/

Configure Apache

We're ready to configure Apache. Create the new configuration file with the command:

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

Within that new file, add the following contents:

<VirtualHost *:80>
     DocumentRoot /var/www/html/dolibarr/htdocs

     <Directory /var/www/html/dolibarr/htdocs/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined


Where and are the actual domains for your server. If you'll only be using an IP, you can leave those as-is.

Save and close that file.

Enable the new site and the rewrite module with the commands:

sudo a2ensite dolibarr.conf
sudo a2enmod rewrite

Restart Apache with the command:

sudo systemctl restart apache2

Finish installation

Point your browser to the address http://SERVER_IP/dolibarr/htdocs/install/. At this point, you will be greeted by the graphical installer (Figure A).

Figure A

Figure A

The Dolibarr installer.


From this point on, everything is self-explanatory. You will eventually create an admin user/password, which will allow you to log into the Dolibarr instance. You are then ready to configure Dolibarr to perfectly meet your company's needs. Congratulations, you now have a one-stop-ERP/CRM shop for your business.

Also see