RHEL BasedRocky Linux

How To Install Dolibarr on Rocky Linux 9

Install Dolibarr on Rocky Linux 9

Dolibarr is a powerful and versatile open-source ERP/CRM solution that provides businesses with essential tools for resource planning and customer relationship management. Whether you’re a small business owner, a freelancer, or managing a larger organization, Dolibarr offers a comprehensive suite of modules for invoicing, inventory management, CRM, human resources, and more. This guide will walk you through the process of installing Dolibarr on Rocky Linux 9, a stable and reliable enterprise-grade Linux distribution.

Table of Contents

What is Dolibarr?

Dolibarr ERP/CRM is an open-source software solution designed specifically for small to medium-sized businesses, freelancers, foundations, and non-profit organizations. Unlike many complex enterprise solutions, Dolibarr stands out for its user-friendly interface and modular architecture, allowing users to activate only the features they need.

Key features of Dolibarr include:

  • Customer relationship management (contacts, leads, opportunities)
  • Sales management (quotes, orders, invoices)
  • Purchase management (suppliers, orders, invoices)
  • Inventory and stock management
  • Project management and task tracking
  • Human resources management
  • Accounting and financial reporting
  • Document management
  • Email campaigns and marketing tools

The modular design gives businesses the flexibility to start with basic functionality and gradually add more features as their needs evolve. Dolibarr’s web-based nature means you can access it from any device with a browser, regardless of whether you install it locally, on a server, or use it as a cloud solution.

System Requirements for Dolibarr on Rocky Linux 9

Before proceeding with the installation, it’s essential to ensure your system meets the minimum requirements to run Dolibarr efficiently. For the 2024-2025 versions of Dolibarr, these requirements include:

Hardware Requirements

  • Processor: 1.5 GHz or higher (Dual Core recommended for optimal performance)
  • RAM: Minimum 2 GB (4 GB recommended for smooth operation)
  • Disk Space: At least 2 GB for the Dolibarr installation, plus additional space for your business data

Software Requirements

  • Operating System: Rocky Linux 9 (our focus for this guide)
  • Web Server: Apache (or Nginx as an alternative)
  • PHP: Version 7.4 or higher (PHP 8.0+ recommended for best performance)
  • Database: MySQL 5.7+ or MariaDB 10.1+ or PostgreSQL 9.6+
  • Essential PHP Extensions: curl, json, mbstring, xml, zip, gd

Meeting these requirements will ensure a smooth installation process and optimal performance of your Dolibarr ERP/CRM system on Rocky Linux 9.

Preparing Your Rocky Linux 9 Environment

The first step in installing Dolibarr is to prepare your Rocky Linux 9 environment. This involves updating your system, installing necessary packages, and configuring your server for web applications.

Updating System Packages

Begin by ensuring your system is up to date:

sudo dnf update

This command refreshes your package database and updates all installed packages to their latest versions.

Installing Apache Web Server

Dolibarr requires a web server to function. Apache is a solid choice for Rocky Linux 9:

sudo dnf install httpd -y

After installation, enable and start the Apache service:

sudo systemctl enable httpd
sudo systemctl start httpd

Configuring Firewall for Web Traffic

To allow HTTP traffic through the firewall:

sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload

For secure HTTPS connections (recommended for production environments):

sudo firewall-cmd --zone=public --permanent --add-service=https
sudo firewall-cmd --reload

Verifying Apache Installation

You can verify that Apache is working correctly by accessing your server’s IP address in a web browser:

http://your_server_ip

You should see the default Apache test page, indicating that the web server is running properly.

Installing PHP and Required Extensions

Dolibarr requires PHP with several extensions. Install them with:

sudo dnf install php php-cli php-common php-json php-mbstring php-curl php-zip php-xml php-gd php-mysqlnd

Installing MariaDB Database

Install MariaDB (MySQL alternative) for database functionality:

sudo dnf install mariadb mariadb-server

Enable and start the MariaDB service:

sudo systemctl enable mariadb
sudo systemctl start mariadb

Securing the MariaDB Installation

Run the security script to set a root password and secure the installation:

sudo mysql_secure_installation

Follow the prompts to set up a secure MariaDB installation:

  • Set a root password
  • Remove anonymous users
  • Disallow root login remotely
  • Remove the test database
  • Reload privilege tables

Creating the Database for Dolibarr

Before installing Dolibarr, you need to create a database and a database user with appropriate permissions.

Accessing MariaDB Command Line

Log in to the MariaDB command line using the root password you set earlier:

mysql -u root -p

Creating a Dedicated Database

Create a new database for Dolibarr:

CREATE DATABASE dolibarr_db CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

This creates a database named “dolibarr_db” with UTF-8 character encoding, which ensures proper support for all languages and special characters.

Creating a Database User

Create a dedicated database user with appropriate permissions:

CREATE USER 'dolibarr_user'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON dolibarr_db.* TO 'dolibarr_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace ‘your_secure_password’ with a strong, unique password. This creates a user specifically for Dolibarr and grants them full permissions on the Dolibarr database only.

Downloading and Installing Dolibarr

With the prerequisites in place, you can now download and install Dolibarr on your Rocky Linux 9 server.

Getting the Latest Dolibarr Release

You can download Dolibarr from the official website or directly from the command line:

cd /tmp
wget https://sourceforge.net/projects/dolibarr/files/latest/download -O dolibarr.zip

This downloads the latest stable version of Dolibarr.

Extracting the Files

Install unzip if you don’t have it already:

sudo dnf install unzip

Extract the downloaded archive:

unzip dolibarr.zip

Moving Files to Web Server Directory

Move the extracted files to the web server directory:

sudo mv dolibarr-*/ /var/www/html/dolibarr

Setting Appropriate File Permissions

Set appropriate ownership and permissions for the Dolibarr files:

sudo chown -R apache:apache /var/www/html/dolibarr
sudo chmod -R 755 /var/www/html/dolibarr
sudo chmod -R 775 /var/www/html/dolibarr/documents

This ensures that the web server can access and modify the necessary files.

Configuring Apache for Dolibarr

Now you need to configure Apache to serve Dolibarr.

Creating a Virtual Host Configuration

Create a virtual host configuration file for Dolibarr:

sudo nano /etc/httpd/conf.d/dolibarr.conf

Add the following configuration, adjusting as needed for your environment:

<VirtualHost *:80>
    ServerAdmin webmaster@yourdomain.com
    DocumentRoot /var/www/html/dolibarr
    ServerName dolibarr.yourdomain.com
    
    <Directory /var/www/html/dolibarr>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    
    ErrorLog /var/log/httpd/dolibarr_error.log
    CustomLog /var/log/httpd/dolibarr_access.log combined
</VirtualHost>

Replace “dolibarr.yourdomain.com” with your actual domain or server IP address.

Enabling the Virtual Host

After creating the virtual host configuration, restart Apache to apply the changes:

sudo systemctl restart httpd

SELinux Configuration for Dolibarr

Rocky Linux 9 uses SELinux by default, which may block certain operations required by Dolibarr. You need to configure SELinux to work with Dolibarr.

Setting SELinux Context for Web Content

First, install the SELinux management tools:

sudo dnf install policycoreutils-python-utils

Then, set the appropriate SELinux context for the Dolibarr directory:

sudo semanage fcontext -a -t httpd_sys_content_t "/var/www/html/dolibarr(/.*)?"
sudo restorecon -Rv /var/www/html/dolibarr

Allowing Write Access to Documents Directory

For Dolibarr to function properly, the web server needs write access to the documents directory:

sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/dolibarr/documents(/.*)?"
sudo restorecon -Rv /var/www/html/dolibarr/documents

Additional SELinux Permissions

If Dolibarr needs to send emails or connect to external services:

sudo setsebool -P httpd_can_sendmail 1
sudo setsebool -P httpd_can_network_connect 1

Running the Web-Based Installation Wizard

With all the preparations complete, you can now run the Dolibarr web-based installation wizard.

Accessing the Installer

Open a web browser and navigate to your Dolibarr installation:

http://your_server_ip/dolibarr

or

http://dolibarr.yourdomain.com

The installation wizard should automatically launch.

Install Dolibarr on Rocky Linux 9

Step 1: Selecting the Language

Choose your preferred language for the installation process and click “Next”.

Step 2: License Agreement

Review the GNU General Public License (GPL) terms and accept them to continue.

Step 3: Prerequisite Check

The wizard will check if your server meets all the necessary requirements. If any issues are found, resolve them before proceeding.

Step 4: Database Configuration

Enter the database details you created earlier:

  • Database Type: MySQL or MariaDB
  • Database Server: localhost (or your database server address)
  • Database Name: dolibarr_db
  • Database Username: dolibarr_user
  • Database Password: your_secure_password

Click “Next” to proceed.

Step 5: Administrator Account Creation

Create the administrator account for managing Dolibarr:

  • Admin Login: Choose a username
  • Admin Password: Set a strong password
  • Admin Email: Enter your email address

This account will have full access to all Dolibarr modules and configurations.

Step 6: Initial Configuration

Select the modules you want to activate initially. You can always activate or deactivate modules later as needed.

Click “Install” to complete the installation process.

Post-Installation Security Measures

Once Dolibarr is installed, it’s crucial to implement additional security measures to protect your business data.

Creating the install.lock File

Create an install.lock file to prevent unauthorized access to the installation directory:

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

Removing Installation Directory

For security reasons, remove or rename the installation directory:

sudo mv /var/www/html/dolibarr/install /var/www/html/dolibarr/install.bak

This prevents potential attackers from re-running the installation wizard.

Securing Configuration Files

Adjust permissions for sensitive configuration files:

sudo chmod 600 /var/www/html/dolibarr/htdocs/conf/conf.php

Implementing HTTPS

For production environments, it’s strongly recommended to use HTTPS. You can set up a free SSL certificate using Let’s Encrypt:

sudo dnf install epel-release
sudo dnf install certbot python3-certbot-apache
sudo certbot --apache -d dolibarr.yourdomain.com

Follow the prompts to configure HTTPS for your Dolibarr installation.

Configuring Essential Dolibarr Settings

After installation, you need to configure basic settings for your Dolibarr instance.

Company Information

Log in with your administrator account and navigate to Home → Setup → Company/Organization to enter your company details:

  • Name
  • Address
  • Phone number
  • Email
  • Website
  • Logo

Currency and Regional Settings

Configure your regional settings under Home → Setup → Other Setup:

  • Default currency
  • Date format
  • Language

Email Configuration

Set up email functionality under Home → Setup → Email:

  • SMTP server details
  • Authentication credentials
  • Port and encryption settings

Document Templates

Configure document templates under Home → Setup → Templates to customize the appearance of invoices, orders, and other documents.

Setting Up Cron Jobs for Automated Tasks

Dolibarr requires several scheduled tasks to run properly. Set up cron jobs to automate these tasks.

Creating Cron Jobs

Create a cron job file:

sudo nano /etc/cron.d/dolibarr

Add the following lines:

# Run Dolibarr scheduled tasks
0 * * * * apache php /var/www/html/dolibarr/scripts/cron/cron_run_jobs.php > /dev/null 2>&1

This runs the scheduled tasks hourly. Adjust the frequency based on your needs.

Verifying Cron Job Execution

You can verify that cron jobs are running by checking the logs in Dolibarr under Home → Admin tools → Logs.

Upgrading Dolibarr on Rocky Linux 9

When new versions of Dolibarr are released, you’ll need to upgrade your installation. Here’s how to do it safely.

Backing Up Your Data

Before upgrading, always back up your data:

# Back up the Dolibarr files
sudo cp -r /var/www/html/dolibarr /var/www/html/dolibarr_backup_$(date +%Y%m%d)

# Back up the database
mysqldump -u dolibarr_user -p dolibarr_db > dolibarr_db_backup_$(date +%Y%m%d).sql

Downloading and Installing the New Version

Download the new version and extract it to a temporary location:

cd /tmp
wget https://sourceforge.net/projects/dolibarr/files/latest/download -O dolibarr_new.zip
unzip dolibarr_new.zip

Replace the old files with the new ones, preserving your configuration:

sudo cp -r /tmp/dolibarr-*/* /var/www/html/dolibarr/
sudo cp /var/www/html/dolibarr_backup_*/htdocs/conf/conf.php /var/www/html/dolibarr/htdocs/conf/
sudo chown -R apache:apache /var/www/html/dolibarr

Running the Upgrade Script

Access the upgrade script in your web browser:

http://your_server_ip/dolibarr/install/

Follow the upgrade instructions to complete the process.

Troubleshooting Common Installation Problems

Even with careful preparation, you may encounter issues during installation. Here are solutions to common problems.

Database Connection Issues

If Dolibarr cannot connect to the database:

  • Verify that MariaDB is running: sudo systemctl status mariadb
  • Check database credentials in conf.php
  • Ensure the database user has proper permissions

Blank Screen After Installation

If you see a blank screen after installation:

  • Check PHP error logs: sudo tail -f /var/log/php-fpm/www-error.log
  • Verify PHP version and extensions
  • Check file permissions on Dolibarr directories

File Permission Errors

If Dolibarr reports permission errors:

  • Verify ownership: sudo chown -R apache:apache /var/www/html/dolibarr
  • Set correct permissions: sudo chmod -R 755 /var/www/html/dolibarr
  • Give write access to the documents directory: sudo chmod -R 775 /var/www/html/dolibarr/documents

SELinux-Related Access Denials

If SELinux blocks Dolibarr functions:

  • Check SELinux logs: sudo ausearch -c 'httpd' --raw | audit2allow -M dolibarr
  • Apply custom policy if needed: sudo semodule -i dolibarr.pp

Performance Optimization for Dolibarr

To ensure optimal performance of your Dolibarr installation, consider these optimization techniques.

PHP Optimization

Edit the PHP configuration file:

sudo nano /etc/php.ini

Adjust these settings:

  • memory_limit = 256M
  • max_execution_time = 300
  • upload_max_filesize = 20M
  • post_max_size = 20M

Database Performance Tuning

Optimize MySQL/MariaDB for better performance:

sudo nano /etc/my.cnf.d/mariadb-server.cnf

Add or modify these settings:

[mysqld]
query_cache_size = 16M
key_buffer_size = 32M
innodb_buffer_pool_size = 256M

Restart MariaDB after making changes:

sudo systemctl restart mariadb

Web Server Caching

Configure Apache caching to improve performance:

sudo nano /etc/httpd/conf.d/dolibarr.conf

Add these directives:

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 week"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
</IfModule>

Securing Dolibarr for Production Use

For production environments, implementing robust security measures is essential.

Implementing HTTPS with Let’s Encrypt

If you haven’t already set up HTTPS, do so now:

sudo certbot --apache -d dolibarr.yourdomain.com

Regular Security Updates

Keep your system and Dolibarr up to date:

# Update Rocky Linux packages
sudo dnf update

# Set up a reminder to check for Dolibarr updates
echo "0 0 1 * * root echo 'Check for Dolibarr updates at https://www.dolibarr.org'" | sudo tee -a /etc/cron.d/dolibarr_update_reminder

User Authentication Best Practices

In Dolibarr, navigate to Home → Setup → Security to:

  • Enable password complexity requirements
  • Set password expiration policies
  • Configure two-factor authentication if available

Network Security Considerations

Restrict access to your Dolibarr server by configuring the firewall:

sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="trusted_ip_address" service name="http" accept'
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="trusted_ip_address" service name="https" accept'
sudo firewall-cmd --reload

Replace “trusted_ip_address” with the IP addresses that should have access.

Integration with Other Business Systems

Dolibarr can integrate with various business systems to enhance functionality.

Email Server Integration

Configure Dolibarr to work with your email server under Home → Setup → Email.

Payment Gateway Connections

Set up payment gateways under Home → Setup → Modules → Payment modules.

Third-Party Module Installation

To extend Dolibarr’s functionality:

  1. Download third-party modules from DoliStore
  2. Extract the module files to /var/www/html/dolibarr/htdocs/custom/
  3. Set appropriate permissions: sudo chown -R apache:apache /var/www/html/dolibarr/htdocs/custom/
  4. Activate the module in Dolibarr under Home → Setup → Modules

Congratulations! You have successfully installed Dolibar. Thanks for using this tutorial for installing Dolibar on Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Dolibar website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button