Web directory

How to install Dolibarr ERP/CRM platform on Ubuntu Server 22.04

If your business has grown to the point where you need help planning and organizing details like contacts, vendors, invoices, orders, inventory, and schedules, you need an ERP tool. You can either turn to a third-party platform or deploy an in-house solution in your data center or a third-party cloud host.

Follow this step-by-step process of installing the Dolibarr ERP/CRM solution, perfectly suited to organizations of all sizes as well as freelancers.

What you will need to install Dolibarr

I will demonstrate deployment on Ubuntu Server 22.04, but Dolibarr can be installed on just about any Linux distribution. If you are using a server distro other than Ubuntu, you will need to modify some of the installation commands. You will also need a user with sudo privileges.

SEE: 9 must-know tips for securing Ubuntu Server (TechRepublic Premium)

How to install dependencies

The first thing we are going to do is install the necessary dependencies, starting with the web and database servers.

Connect to your Ubuntu Server instance and install the Apache web server with the command:
sudo apt-get install apache2 -y
Once the installation is complete, start and activate the server with:

sudo systemctl enable --now apache2

Activate the rewrite module with:

sudo a2enmod rewrite

Next, let’s install the necessary PHP dependencies with:

sudo apt-get install php php-cli php-mysql php-common php-zip php-mbstring php-xmlrpc php-curl php-soap php-gd php-xml php-intl php-ldap libapache2-mod-php -y

Once PHP is installed, you will need to do a quick setup. Open the PHP configuration file with the command:

sudo nano /etc/php/*/apache2/php.ini

In this file, find the following and replace them with the values ​​shown, where TIMEZONE is your particular time zone:

  • date.timezone = TIMEZONE
  • memory_limit = 256M
  • upload_max_filesize = 64M
  • display_errors=Enabled
  • log_errors=Disabled

We will install the MariaDB database with the command:

sudo apt-get install mariadb-server mariadb-client -y

Once the installation is complete, you need to secure the MariaDB database server with the command:

sudo mysql_secure_installation

Make sure to set a strong/unique password for the admin user.

How to create the database

Connect to the database console with:

sudo mysql -u root -p

Create the Dolibarr database and user with the following commands, where PASSWORD is a strong/unique password:

CREATE USER 'dolibarr'@'localhost' IDENTIFIED BY 'PASSWORD';
CREATE DATABASE dolibarr;
GRANT ALL PRIVILEGES ON dolibarr.* TO 'dolibarr'@'localhost';
FLUSH PRIVILEGES;
exit

How to Configure Apache

Let’s create an Apache virtual host file with:

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

In this file, paste the following:


  ServerAdmin [email protected]
  ServerName erp.example.com
  ServerAlias www.erp.example.com
  DocumentRoot /var/www/html//dolibarr/htdocs/

  Directory /srv/dolibarr/htdocs>
  Options +FollowSymlinks
  AllowOverride All
  Require all granted
  

  ErrorLog /var/log/apache2/dolibarr_error.log
  CustomLog /var/log/apache2/dolibarr_access.log combined



Save and close the file. Restart Apache with:

sudo systemctl restart apache2

How to download and unzip Dolibarr

We will set a variable on the latest version available for Dolibarr with the command:

release_tag=$(curl -s https://api.github.com/repos/Dolibarr/dolibarr/releases/latest | grep tag_name | cut -d '"' -f 4)

We can now use release_tag to ensure that we obtain and use the latest version. Download Dolibarr with:

wget https://github.com/Dolibarr/dolibarr/archive/${release_tag}.tar.gz

Unzip Dolibarr with:

sudo mv dolibarr-${release_tag} /var/www/html/dolibarr

Give the new directory the appropriate permissions with:

sudo chown -R /var/www/html/dolibarr

How to complete the installation

Open a web browser and point it to http://SERVER/dolibarr/htdocs where SERVER is the IP address of the hosting server, and you will be greeted by the Dolibarr web installer (Figure A).

Figure A

Dolibarr ERP/CRM web installer.
The Dolibarr web installer.

Click Next and then, in the resulting window, click Start (Figure B).

Figure B

The Dolibarr ERP/CRM prerequisite check was successful and is ready to work.
The prerequisite check was successful and is ready to start.

On the setup page (Figure C), you need to configure the database options. In our installation, the database name is dolibarr, the user is dolibarr and the password is the one you defined in the MariaDB console. You’ll also want to scroll to the bottom of this page, create a Super User account, and then click Next Step.

Figure C

Dolibarr web-based configuration page.
The Dolibarr configuration web page.

When prompted, click Next Step again to start the installation. This step will take some time as it needs to populate the database and save the configuration options you have selected. Once this operation is completed, you can connect to Dolibarr with your superuser account and start using your new ERP/CRM solutions.

Before completing the Dolibarr installation process, make sure to add an installation lock file to prevent anyone from maliciously using the installation tools. To do this, issue the command:

sudo touch /var/www/html/dolibarr/documents/install.lock

Congratulations, you’ve taken your business to the next level of efficiency.

Subscribe to TechRepublic How to make technology work on YouTube for all the latest tech tips for professionals from Jack Wallen.