Install Dolibarr ERP on Ubuntu 22.04

Dolibarr is an open-source ERP and CRM system written in PHP. It is designed for small and medium businesses to manage customers, invoices, orders, products, inventories, etc. It provides a simple, and easy-to-use web interface that allows you to manage your ERP application via a web browser. If you are looking for open-source ERP and CRM solutions for your organization, then Dolibarr is the best choice for you.

In this tutorial, we will learn how to install Dolibarr on Ubuntu 22.04 server.

Requirements

  • A server running Ubuntu 22.04.
  • A root password is configured on your server.
  • A valid domain name is pointed with your server.

Install LAMP Stack

Before starting, you must install Apache, MariaDB, PHP, and other PHP modules to your system. First, add a PHP repository to your system using the following command:

apt-get install software-properties-common -y
add-apt-repository ppa:ondrej/php -y

Next, update the repository and install Apache, PHP and MariaDB server with the following command:

apt-get install apache2 mariadb-server php7.4 libapache2-mod-php7.4 php7.4-common php7.4-curl php7.4-intl php7.4-mbstring php7.4-mcrypt php7.4-json php7.4-xmlrpc php7.4-soap php7.4-mysql php7.4-gd php7.4-xml php7.4-cli php7.4-zip wget unzip git -y

Once the installation has been completed, edit the php.ini file and change some default settings:

nano /etc/php/7.4/apache2/php.ini

Change the following settings:

memory_limit = 512M
upload_max_filesize = 150M
max_execution_time = 360
date.timezone = UTC

Save and close the file. Then, start Apache and MariaDB services and enable them to start on boot time with the following command:

systemctl start apache2
systemctl enable apache2
systemctl start mariadb
systemctl enable mariadb

Once you are finished, you can proceed to the next step.

Configure MariaDB

By default, MariaDB is not secured. So, you will need to secure it first. You can secure it by running the following script:

mysql_secure_installation

Answer all the questions as shown below:

    Enter current password for root (enter for none):
    Set root password? [Y/n]: N
    Remove anonymous users? [Y/n]: Y
    Disallow root login remotely? [Y/n]: Y
    Remove test database and access to it? [Y/n]:  Y
    Reload privilege tables now? [Y/n]:  Y

Once the MariaDB is secured, log in to the MariaDB shell:

mysql -u root -p

Enter your root password, then create a database and user for Dolibarr:

MariaDB [(none)]> CREATE DATABASE dolibarrdb;
MariaDB [(none)]> CREATE USER dolibarr;

Next, grant privileges to the Dolibarr database with the following command:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON dolibarrdb.* TO 'dolibarr'@'localhost' IDENTIFIED BY 'password';

Next, you will need to run the FLUSH PRIVILEGES command so that the privileges table will be reloaded by MySQL and we can use new credentia$

MariaDB [(none)]> FLUSH PRIVILEGES;

Next, exit from the MariaDB console with the following command:

MariaDB [(none)]> EXIT

Once you are finished, you can proceed to the next step.

Download and Install Dolibarr

First, download the latest version of Dolibarr from the Git repository using the following command:

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

Once the download is completed, extract the downloaded file with the following command:

tar -xvzf 15.0.2.tar.gz

Next, copy the extracted directory to the Apache web root and set proper permissions:

cp -r dolibarr-15.0.2 /var/www/html/dolibarr
chown -R www-data:www-data /var/www/html/dolibarr/
chmod -R 775 /var/www/html/dolibarr/

Once you are finished, you can proceed to the next step.

Configure Apache for Dolibarr

Next, create an Apache virtual host file with the following command:

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

Add the following lines:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/dolibarr/htdocs
     ServerName dolibarr.example.com

     <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>

Save the file, then enable the apache virtual host file with the following command:

a2ensite dolibarr

Next, enable the Apache rewrite module and reload the apache service with the following command:

a2enmod rewrite
systemctl restart apache2

You can now check the status of Dolibarr with the following command:

systemctl status apache2

You will get the following output:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-07-02 08:14:00 UTC; 6s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 21317 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 21321 (apache2)
      Tasks: 6 (limit: 4579)
     Memory: 13.6M
        CPU: 119ms
     CGroup: /system.slice/apache2.service
             ??21321 /usr/sbin/apache2 -k start
             ??21322 /usr/sbin/apache2 -k start
             ??21323 /usr/sbin/apache2 -k start
             ??21324 /usr/sbin/apache2 -k start
             ??21325 /usr/sbin/apache2 -k start
             ??21326 /usr/sbin/apache2 -k start

Jul 02 08:14:00 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

Once you are finished, you can proceed to the next step.

Access Dolibarr

Now, open your web browser and type the URL http://dolibarr.example.com. You will be redirected to the following page:

Here, select your language and click on the Next step button. You should see the following page:

Here, validate the PHP checks and click on the Start button. You should see the following page:

Now, provide your database details, web server configuration details and click on the Next step button. You should see the following page:

Here, click on the Next step button. You should see the following page:

Click on the Next step button. You should see the following page:

Here, provide your admin username and password. Then, click on the Next step button. Once the user has created it successfully, You should see the following page:

Now, click on the Go to Dolibarr button. You will be redirected to the Dolibarr login page:

Now, provide your admin username and password. Then, click on the Connect button. You should see the Dolibarr dashboard on the following page:

Conclusion

Congratulations! you have successfully installed and configured Dolibarr ERP and CRM with Apache on Ubuntu 22.04 server. You can now start managing your ERP and CRM from the central location. Feel free to ask me if you have any questions.

Share this page:

0 Comment(s)