Install Dolibarr on Ubuntu or Debian

Install Dolibarr 24 on Ubuntu 24.04 or Debian 13 with Apache, MariaDB and PHP, with tested commands. Plus what the wizard does not do: install.lock, the 2 MB upload limit, the documents folder, the cron key.

Versions concerned
Dolibarr 24.0.2 (official archive) · Ubuntu 24.04 LTS (PHP 8.3, MariaDB 10.11, Apache 2.4.58) · Debian 13 (PHP 8.4, MariaDB 11.8, Apache 2.4.68)
What was checked
Fresh installs on 13/10/2026 on Ubuntu 24.04.5 and Debian 13, in Docker containers: the commands on this page run as is (sudo removed, the container running as root), web wizard followed through to the login page, install.lock and read-only permissions checked, upload of a 5 MB file before and after raising Dolibarr's limit, Scheduled jobs module enabled, job run by hand then by the system cron.

This page installs Dolibarr 24 on an Ubuntu 24.04 LTS or Debian 13 server, with the distribution’s own packages: Apache, MariaDB and PHP. Every command was run on 13 October 2026 on a fresh install of each of the two systems, with the official Dolibarr 24.0.2 archive.

Dolibarr’s install wizard completes without errors, but it leaves four settings that most tutorials do not mention, and that we found on both systems:

  • it does not create install.lock: the install pages stay open to anyone;
  • it suggests a documents folder it cannot create (/var/www/dolibarr/documents);
  • Dolibarr limits file uploads to 2 MB, even when PHP accepts more;
  • the scheduled jobs key stays empty when you enable the module: no job ever runs.

What you need

An Ubuntu 24.04 LTS or Debian 13 server, an account that can use sudo, and access to port 80. The packages install PHP 8.3 on Ubuntu 24.04 and PHP 8.4 on Debian 13: Dolibarr 24 works with both.

In the commands, Dolibarr lives in /var/www/dolibarr and the documents in /var/lib/dolibarr/documents, outside the folder Apache publishes. That is where Dolibarr stores invoices, attachments and backups: it must not be reachable from the web.

1. Install Apache, MariaDB and PHP

sudo apt update
sudo apt install -y apache2 mariadb-server php libapache2-mod-php php-mysql php-gd php-curl php-intl php-zip php-xml php-mbstring curl cron

These are all the extensions Dolibarr’s wizard asks for: on both systems, its check page is entirely green with this list.

2. Download Dolibarr

cd /tmp
curl -fL -o dolibarr-24.0.2.tgz "https://sourceforge.net/projects/dolibarr/files/Dolibarr%20ERP-CRM/24.0.2/dolibarr-24.0.2.tgz/download"
sudo tar --no-same-owner -xzf /tmp/dolibarr-24.0.2.tgz -C /var/www
sudo mv /var/www/dolibarr-24.0.2 /var/www/dolibarr
sudo mkdir -p /var/lib/dolibarr/documents
sudo touch /var/www/dolibarr/htdocs/conf/conf.php
sudo chown www-data:www-data /var/www/dolibarr/htdocs/conf/conf.php
sudo chown -R www-data:www-data /var/lib/dolibarr/documents /var/www/dolibarr/htdocs/custom

The link points to the official archive published on SourceForge. For a newer version, replace 24.0.2 in all three places.

Only three locations belong to the Apache user (www-data): conf.php, which the wizard will fill in, the documents folder, and custom, where external modules are installed. The rest of the code does not need to be writable by the web server.

3. Create the database

DBPASS=$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 24); echo "Database password: $DBPASS"
sudo mariadb -e "CREATE DATABASE dolibarr CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'dolibarr'@'localhost' IDENTIFIED BY '$DBPASS';
GRANT ALL PRIVILEGES ON dolibarr.* TO 'dolibarr'@'localhost';"

Write down the password shown: the wizard will ask for it. On Ubuntu and Debian, sudo mariadb connects as the database administrator without a password: there is no need to give Dolibarr a root account.

4. Configure Apache and PHP

sudo tee /etc/apache2/sites-available/dolibarr.conf > /dev/null <<'CONF'
<VirtualHost *:80>
    ServerName dolibarr.example.com
    DocumentRoot /var/www/dolibarr/htdocs

    <Directory /var/www/dolibarr/htdocs>
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/dolibarr_error.log
    CustomLog ${APACHE_LOG_DIR}/dolibarr_access.log combined
</VirtualHost>
CONF
sudo a2ensite dolibarr
sudo a2dissite 000-default
PHPV=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')
sudo tee /etc/php/$PHPV/apache2/conf.d/99-dolibarr.ini /etc/php/$PHPV/cli/conf.d/99-dolibarr.ini > /dev/null <<'INI'
upload_max_filesize = 20M
post_max_size = 22M
date.timezone = Europe/Paris
INI
sudo systemctl reload apache2

Replace dolibarr.example.com with your server name, and Europe/Paris with your time zone. Apache’s default site is disabled, so Dolibarr also answers on the server’s IP address.

The 99-dolibarr.ini file is written twice: for Apache and for command-line PHP. Without the second copy, the scheduled jobs of step 8 run on UTC time, while the interface uses your time zone.

5. The install wizard

Open http://your-server/install/ (the site root only shows a message pointing to that address). Pick the language, then Start on the “Fresh install” line. On the configuration page, change three things:

  • Directory to store uploaded and generated documents: replace the suggested value, /var/www/dolibarr/documents, with /var/lib/dolibarr/documents. The suggested folder does not exist and Apache is not allowed to create it: the wizard would stop with an error saying the directory does not exist.
  • Database Login and Password: dolibarr and the password you wrote down in step 3.
  • Leave Create database and Create user account unticked: that is already done.

The wizard then creates the tables. Before you continue, one box is ticked by default: “Make an anonymous Ping ‘+1’ to the Dolibarr foundation server”. It sends a single signal to the foundation so it can count installations; untick it if you do not want that. Last step: the login and password of the first administrator.

6. Close the installation

The wizard’s last page says so, but does not do it: you need to create install.lock. Without it, anyone can open /install/ and run the installation again on your database.

sudo touch /var/lib/dolibarr/documents/install.lock
sudo chmod 400 /var/www/dolibarr/htdocs/conf/conf.php
sudo find /var/www/dolibarr/htdocs -path /var/www/dolibarr/htdocs/custom -prune -o -exec chmod a-w {} +

After these three commands, /install/ replies that the installation is locked, conf.php can only be read by Apache, and Apache can no longer change any file of the code, except in custom. We checked all three points, and that Apache can still write to custom.

install.lock goes in the documents folder, not in htdocs: the details, and how to upgrade with it in place, are in install.lock: where to put it.

7. Raise the 2 MB upload limit

PHP now accepts 20 MB, but Dolibarr applies its own limit, set to 2,048 KB at install time. In our test, a 5 MB file is rejected with “File size is too large or file not provided”. Open Home › Setup › Security, Files tab, and set “Maximum size for uploaded files” to 20480 (the value is in KB). The same file then goes through without problems.

8. Scheduled jobs

Email reminders, purging temporary files, automatic backups: these jobs need the Scheduled jobs module and a regular run from the system cron.

  1. Open Home › Setup › Modules/Applications and enable Scheduled jobs.
  2. Open its setup. The Security key for URL to launch cron jobs field is empty: click the icon next to the field to generate one, then Save. Copy the key shown; it is encrypted in the database, so there is no point looking for it in MariaDB.
  3. Add the job to the system cron, replacing YOUR_KEY with the key, and admin with the login of the user the jobs should run as:
echo "*/5 * * * * www-data /usr/bin/php /var/www/dolibarr/scripts/cron/cron_run_jobs.php YOUR_KEY admin > /dev/null 2>&1" | sudo tee /etc/cron.d/dolibarr

To check without waiting five minutes:

sudo -u www-data /usr/bin/php /var/www/dolibarr/scripts/cron/cron_run_jobs.php YOUR_KEY admin

The output must show “TZ server = Europe/Paris” (or your time zone), then “Result of run_jobs OK” for each job that is due (right after enabling the module, there are three). If it ends with “securitykey provided … does not match securitykey in setup”, the key was not saved or was copied wrongly. In our test, the system cron then ran a due job on its own, at the next pass.

Before opening access from the Internet

This installation answers over HTTP. Before making it reachable from the Internet, install a certificate (Certbot does it for Apache), then change the address to https:// in the $dolibarr_main_url_root line of conf.php. This step needs a real domain name: we did not test it here.

Next

If you would rather have us handle it, the Installation and setup package starts from this configuration.

See also

DolibarrinstallationUbuntuDebianApacheMariaDBPHPinstall.lockcron