How to Install Dolibarr on Ubuntu 20.04
Introduction
Dolibarr is an open-source Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) software used to manage sales, purchases, inventories, and other daily activities of organizations of any size. Some primary features of Dolibarr are:
- Sales Management
- Commercial proposals management
- Stock Management
- Project Management
- Manufacturing resource planning
This tutorial explains how to install Dolibarr on Ubuntu 20.04.
Prerequisites
Before you begin the tutorial, you should:
- Deploy a new Ubuntu 20.04 Vultr cloud server.
- Update the server.
- Create a non-root user with sudo privileges.
- Log in to your server as a non-root user.
- Open TCP Port 80 and 443 on your Vultr firewall or your ufw.
Install PHP
Install PHP and 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
Install MariaDB
Install MariaDB server and client.
$ sudo apt install mariadb-server mariadb-client
Secure the database server.
$ sudo mysql_secure_installation
Answer all the security questions.
Log in to the MariaDB shell as the root user.
$ sudo mysql -u root -p
Create a database and user for Dolibarr. Replace 'StrongPassword' with your secure password.
CREATE USER 'dolibarr'@'localhost' IDENTIFIED BY 'StrongPassword'; CREATE DATABASE dolibarr; GRANT ALL PRIVILEGES ON dolibarr.* TO 'dolibarr'@'localhost'; FLUSH PRIVILEGES; EXIT;
Verify database creation.
$ mysql -u dolibarr -p MariaDB [(none)]> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | dolibarr | +--------------------+ 2 rows in set (0.00 sec)
Setup Dolibarr
Download Dolibarr tarball.
$ wget https://github.com/Dolibarr/dolibarr/archive/12.0.5.tar.gz
Extract the archive.
$ tar xvf 12.0.5.tar.gz
Move extracted directory to
/srv/dolibarr
and delete the tarball.$ sudo mv dolibarr-12.0.5 /srv/dolibarr $ sudo rm 12.0.5.tar.gz
Install Apache
Install the Apache server.
$ sudo apt -y install apache2
Install
libapache2-mod-php
extension.$ sudo apt install -y libapache2-mod-php
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>
Verify file syntax.
$ sudo apachectl -t
Enable Dolibarr configuration file, disable default configuration file, and enable Apache rewrite mode.
$ sudo a2ensite dolibarr $ sudo a2dissite 000-default.conf $ sudo a2enmod rewrite
Set proper directory permissions.
$ sudo chown -R www-data:www-data /srv/dolibarr
Restart the Apache server.
$ sudo systemctl restart apache2
Access Dolibarr Web Interface
To access Dolibarr, go to your browser and visit http://Server_IP/. For example:
http://192.0.2.10/
On the setup page, select the required language and click
Next Step
.Verify all installation prerequisite checks the click
Start
to begin the installation.Enter Database information. Replace 'StrongPassword' with your secure password.
Database name: dolibarr Driver type: MySQL / MariaDB Database server: localhost Login: dolibarr Password: StrongPassword
Click
Next step
to save configurations.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.
SSL Configuration
Install an SSL certificate if you plan to use Dolibarr in Production environments, as SSL ensures encrypted communication.
Prerequisites for SSL
- A fully registered domain name. This article uses
yourdomain.tld
as an example. - DNS A records for
yourdomain.tld
andwww.yourdomain.tld
, which points to your server's IP address. Follow the instructions at your domain registrar or use Vultr DNS. - SSL certificate for the domain. You can buy from SSL vendors or install a free Let's Encrypt certificate.
Edit Apache Config
Edit the virtual host file.
sudo nano /etc/apache2/sites-available/dolibarr.conf
Edit the server name parameter and save the file.
<VirtualHost *:80> ServerAdmin webmaster@example.com ServerName yourdomain.tld 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>
Restart the Apache server to apply changes.
$ sudo systemctl restart apache2
Dolibarr should now be communicating through HTTPS.
Conclusion
This completes the steps to install Dolibarr on Ubuntu 20.04. For more information, refer to the official Dolibarr documentation.