Categories: Software Engineering

A Comprehensive Guide to Installing Dolibarr on Ubuntu Server

Introduction:

Setting up Dolibarr, a popular open-source ERP and CRM software, on an Ubuntu Server can be a rewarding experience for businesses looking to streamline their operations. While the installation process is generally straightforward, I encountered some challenges that others might experience as well. This guide is born out of a desire to share insights gained from overcoming these difficulties, providing you with a smoother installation process.

Prerequisites:

Before delving into the installation, make sure you have the following prerequisites:

1. Ubuntu Server: A clean installation of Ubuntu Server (18.04 LTS or later).

2. Terminal Access: Familiarity with basic command-line operations.

3. Non-root User: Create a non-root user with sudo privileges.

4. Login: Ensure you are logged in to your server as a non-root user.

Step 1: Update and Upgrade:

To kick things off, open the terminal and update the package list for the latest software versions:

$sudo apt update && sudo apt upgrade

Step 2: Install Apache:

Install Apache using this command:

$ sudo apt -y install apache2

You will be prompted to confirm Apache’s installation. Confirm by pressing Y, then ENTER.

Step 3: Install PHP:

Install PHP and its required extensions:

$ sudo apt install -y 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
$ sudo apt install -y libapache2-mod-php

Step 4: Install MariaDB and Create Database:

1. Install MariaDB server and client.

$ sudo apt install mariadb-server mariadb-client

2. Secure the database server.

$ sudo mysql_secure_installation

(Answer all security questions.)

3. Log in to the MariaDB shell as the root user.

$ sudo mysql -u root -p

4. Create a database and user for Dolibarr. Replace ‘YourPassWord’ with your secure password.

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

5. Verify database creation.

$ mysql -u dolibarr -p
MariaDB [(none)]> SHOW DATABASES;

The databases will be displayed on the terminal, and it will look like this;

+--------------------+
| Database |
+--------------------+
| information_schema |
| dolibarr |
+--------------------+
2 rows in set (0.00 sec)

Step 5: Setup Dolibarr:

  1. Visit the Dolibarr official website to get the latest stable version, download, and extract the package:
$ wget https://github.com/Dolibarr/dolibarr/archive/18.0.4.tar.gz

Replace 18.0.4 with the stable latest version.

2. Extract the archive.

$ tar xvf 18.0.4.tar.gz

3. Move the extracted directory to a directory of your choice. In my case, I will use /home/. Bear in mind that the default Ubuntu directory is var/www/html. This is where the IP address is pointed to on a freshly installed Ubuntu server.

In the subsequent steps, you will learn how to point the IP address to a different directory of your choice of which you prefer to host your application.

Move the extracted directory to /home/dolibarr and delete the tarball.

$ sudo mv dolibarr-18.0.4 /home/dolibarr
$ sudo rm 18.0.4.tar.gz

Step 6: Create a virtual host file:

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

Add the following lines and save the file. Replace <http://Server_IP/> with your Server IP.

<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName <http://Server_IP/>
DocumentRoot /srv/dolibarr/htdocs/

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

ErrorLog /var/log/apache2/dolibarr_error.log
CustomLog /var/log/apache2/dolibarr_access.log combined
</VirtualHost>

Step 7: Verify File Syntax:

Verify the syntax of the Dolibarr configuration file:

$ sudo apachectl -t

Step 8: Enable Dolibarr Configuration:

Enable the Dolibarr configuration file, disable the default configuration, and enable Apache rewrite mode:

$ sudo a2ensite dolibarr
$ sudo a2dissite 000-default.conf
$ sudo a2enmod rewrite

Step 9: Set Directory Permissions:

Set proper directory permissions:

$ sudo chown -R www-data:www-data /home/dolibarr

Step 10: Restart Apache Server:

Restart the Apache server:

$ sudo systemctl restart apache2

Step 11: Access Dolibarr Web Interface:

  1. Open a web browser and navigate to your server’s IP address or domain name (http://your_domain.com/ OR http://Server_IP/). Follow the on-screen instructions to complete the Dolibarr installation.
  2. On the setup page, select the required language and click Next Step.
  3. Verify all installation prerequisite checks the click Start to begin the installation.
  4. Enter Database information. Replace ‘YourPassword’ with your secure password.

Database name: dolibarr

Driver type: MySQL / MariaDB

Database server: localhost

Login: dolibarr

Password: YourPassword

5. Click Next step to save configurations.

6. On the last page, create administration credentials for Dolibarr Web UI and click Next Step to finish the installation. Dolibarr redirects to the Login page post successful installation.

Step 12: Create the install.lock File:

After installation, create an install.lock file:

$ sudo nano /home/dolibarr/documents/install.lock

This will create an install.lock file, you can add a comment in the file and then save by using Ctrl X, then select Y and Press Enter.

Confirm that the install.lock file has been successfully created in the “Documents” directory.

Step 13: Modify Permission on the conf.php file

Modifying permissions on the conf.php file is necessary for enhancing security as the conf file (htdocs/conf/conf.php) can be overwritten by the web server.

After installing and configuring Dolibarr, you might see a notification like this regarding the conf.php file:

! Warning, your config file (htdocs/conf/conf.php) can be overwritten by the web server. This is a serious security hole. Modify permissions on file to be in read only mode for operating system user used by Web server. If you use Windows and FAT format for your disk, you must know that this file system does not allow to add permissions on file, so can’t be completely safe. All security warnings (visible by admin users only) will remain active as long as the vulnerability is present (or that constant MAIN_REMOVE_INSTALL_WARNING is added in Setup->Other Setup).

To get rid of this message, you must alter the conf.php file permissions. The file is probably 0644 (meaning the owner can write to it). You want to set it to 0444 (meaning no one can write to it). You can change the file permission via your File Manager in your control panel (DirectAdmin, cPanel etc). You can also use the chmod utility if you have command-line access:

chmod 0444 conf.php

With this change, the Dolibarr warning message should be gone.

Conclusion:

Installing Dolibarr on Ubuntu Server might present challenges, but this step-by-step guide, born out of my encounters, ensures you can navigate through potential roadblocks with ease. As you embark on streamlining your business processes with Dolibarr, this comprehensive installation guide ensures a smoother experience from start to finish. Happy installing!

theglorybenson

Share
Published by
theglorybenson

Recent Posts

Web development Strategies 102: Server and Database replication

Server and database replication occurs by creating a cluster of servers or databases that provide…

7 months ago

Streamlining Grant Management: An Agile Project Plan for Salesforce Implementation

https://youtu.be/Q4uZOvUMPGA?si=_2xA5qhxoiLT1ULz Join me as I delve into a real-world scenario of working with the World…

7 months ago

Web Development Strategies 101: Domain Registration and Hosting Options

Several critical factors contribute to the success of your website, and making the right choice…

1 year ago