How to Install Dollibar ERP on Debian 11
Dolibarr is a free and open-source ERP and CRM system for managing customers, invoices, orders, products, stocks, agendas, and inventories. It is designed for SMEs, freelancers, or large companies to manage a professional or foundation activity. It offers a user-friendly web interface where you can manage your ERP application via a web browser. The Dolibarr is the right choice for you if you are looking for open-source ERP and CRM solutions.
This post will show you how to install Dolibarr on a Debian 11 server.
Requirements
- A server running Debian 11.
- A root password is configured on your server.
- A valid domain name is pointed to your server.
Install Apache, MariaDB, and PHP
Dolibarr is written in PHP and uses MariaDB as a database backend. So, you will need to install Apache, MariaDB, PHP and other PHP modules to your system. You can install all of them with the following command:
apt-get install apache2 mariadb-server php libapache2-mod-php php-common php-curl php-intl php-mbstring php-json php-xmlrpc php-soap php-mysql php-gd php-xml php-cli php-zip wget unzip git curl -y
Next, edit the php.ini file and change some default settings:
nano /etc/php/7.4/apache2/php.ini
Change the following settings:
memory_limit = 256M upload_max_filesize = 64M max_execution_time = 300 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
Create a Database for Dolibarr
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 dolibarr;
MariaDB [(none)]> CREATE USER dolibarr;
Next, grant privileges to the Dolibarr database with the following command:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON dolibarr.* TO 'dolibarr'@'localhost' IDENTIFIED BY 'password';
Next, flush the privileges using the following command.
MariaDB [(none)]> FLUSH PRIVILEGES;
Next, exit from the MariaDB console with the following command:
MariaDB [(none)]> EXIT
Install Dolibarr Debian 11
First, run the following command to download the latest version of Dolibarr:
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 16.0.3.tar.gz
Next, copy the extracted directory to the Apache web root and set the proper permissions:
cp -r dolibarr-16.0.3 /var/www/html/dolibarr
chown -R www-data:www-data /var/www/html/dolibarr/
chmod -R 775 /var/www/html/dolibarr/
Configure Apache for Dolibarr
Next, create an Apache virtual host file for Dolibarr 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 Fri 2022-12-30 04:44:52 UTC; 14min ago Docs: https://httpd.apache.org/docs/2.4/ Process: 17472 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Process: 19177 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS) Main PID: 17476 (apache2) Tasks: 6 (limit: 4675) Memory: 20.6M CPU: 5.708s CGroup: /system.slice/apache2.service ??17476 /usr/sbin/apache2 -k start ??19182 /usr/sbin/apache2 -k start ??19183 /usr/sbin/apache2 -k start ??19184 /usr/sbin/apache2 -k start ??19185 /usr/sbin/apache2 -k start ??19186 /usr/sbin/apache2 -k start Dec 30 04:44:52 debian11 systemd[1]: Starting The Apache HTTP Server...
Access Dolibarr Web Interface
At this point, Dolibarr is installed and configured. Now, open your web browser and type the URL http://dolibarr.example.com. You will be redirected to the following page:
Select your language and click on the Next step button. You should see the following page:
Validate the PHP checks and click on the Start button. You should see the following page:
Define your database settings and click on the Next step button. You should see the following page:
Next, click on the Next step button. You should see the following page:
Next, click on the Next step button. You should see the following page:
Set your admin username and password. Then, click on the Next step button. Once the user created 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:
Secure Dolibarr with Let's Encrypt SSL
To secure Dolibarr with SSL, you will need to install the Certbot client on your server.
First, install the Snap package manager with the following command:
apt install snapd
Next, update Snap package to the latest version:
snap install core
snap refresh core
Next, install the certbot package using the following command:
snap install --classic certbot
Next, create a symbolic link for the Certbot binary to the system location:
ln -s /snap/bin/certbot /usr/bin/certbot
Next, run the following command to download and install Let's Encrypt SSL certificates:
certbot --apache -d dolibarr.example.com
You will be asked to provide your email and accept the term of service as shown below:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [email protected] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must agree in order to register with the ACME server. Do you agree? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing, once your first certificate is successfully issued, to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y
Type Y and press the Enter key to download and install the SSL certificates for your domain:
Account registered. Requesting a certificate for dolibarr.example.com Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/dolibarr.example.com/fullchain.pem Key is saved at: /etc/letsencrypt/live/dolibarr.example.com/privkey.pem This certificate expires on 2023-03-29. These files will be updated when the certificate renews. Certbot has set up a scheduled task to automatically renew this certificate in the background. Deploying certificate Successfully deployed certificate for dolibarr.example.com to /etc/apache2/sites-available/dolibarr.conf Congratulations! You have successfully enabled HTTPS on https://dolibarr.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If you like Certbot, please consider supporting our work by: * Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate * Donating to EFF: https://eff.org/donate-le - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Conclusion
Congratulations! you have successfully installed and configured Dolibarr ERP and CRM with Apache on Debian 11 server. Now, explore the Dolibarr features and implement it in your organization to manage your ERP and CRM. Feel free to ask me if you have any questions.