X
    Categories: Tutorials

How to Install Dolibarr ERP CRM on a CentOS 7 VPS

This step by step tutorial will show you how to install Dolibarr ERP CRM on a CentOS 7 VPS with Apache, PHP and PostgreSQL installed on it. Dolibarr is an open source web based ERP and CRM software that can be used to manage your business operations.
This tutorial was tested and written for a CentOS 7 VPS, but it should work on any RPM based Linux distribution.


At the time of writing this tutorial, the latest stable version of Dolibarr ERP CRM is 3.8.2 and it requires:

  • PHP 5.3 or higher with enabled user sessions.
  • Apache Web Server >= 2.0 compiled with mod_rewrite module and with the following directives allowed: RewriteEngine, RewriteBase, RewriteCond and RewriteRule.;
  • PostgreSQL, MariaDB, or MySQL installed on your Linux VPS (do not use MySQL version 5.5.40 nor 5.5.51).

Let’s start with the installation. Download the latest version of Dolibarr available at http://www.dolibarr.org to the server and extract it using the following commands:

cd /var/www/html/
wget http://www.dolibarr.org/files/dolibarr.tgz
tar xvfz dolibarr.tgz
mv dolibarr-* dolibarr
chown -R apache:apache /var/www/html/dolibarr

We’ll configure Dollibar to use a PostgreSQL database, so remove MariaDB if it is already installed:

yum remove mariadb*

Install PHP, Apache web server and other prerequisite packages:

yum install php php-common php-cli php-gd php-pgsql httpd sudo openssl mod_ssl

Install PostgreSQL:

yum install postgresql postgresql-server postgresql-libs

Once PostgreSQL is installed, we have to initialize the PostgreSQL database before PostgreSQL service is started for the first time:

postgresql-setup initdb

Edit the ‘/var/lib/pgsql/data/pg_hba.conf’ configuration file

vi /var/lib/pgsql/data/pg_hba.conf

change:

local   all             all                                     peer
host    all             all             127.0.0.1/32            ident
host    all             all             ::1/128                 ident

to:

local   all             all                                     trust
host    all             all             127.0.0.1/32            trust
host    all             all             ::1/128                 trust

Start PostgreSQL and enable it to start at boot time:

systemctl start postgresql
systemctl enable postgresql

Then, run the following commands from the command line:

sudo -s -u postgres
createuser dolibarruser
psql -h localhost -d template1 -c "alter user postgres with password 'postgespAssW0Rd'"
psql -h localhost -d template1 -c "alter user dolibarruser with password 'Y0uRpAssW0Rd'"
psql
create database dolibarr encoding 'UTF8' owner dolibarruser;
exit

Do not forget to change ‘postgespAssW0Rd’ and ‘Y0uRpAssW0Rd’ and use a strong password for the ‘postgres’ and ‘dolibarruser’ PostgreSQL user accounts respectively.
Edit the ‘/var/lib/pgsql/data/pg_hba.conf’ configuration file:

vi /var/lib/pgsql/data/pg_hba.conf

Add/modify the following lines:

local   all             dolibarruser                            md5
local   all             postgres                                md5
host    all             all             127.0.0.1/32            ident
host    all             all             ::1/128                 ident

Restart PostgreSQL service for the changes to take effect:

systemctl restart postgresql.service

You can test a connection with the ‘dolibarruser’ user using the following command:

psql -d postgres -U dolibarruser -W

and type your dolibarr user password as password , then type \q to quit if connection is okay.
Start Apache and enable it to start at boot time:

systemctl start httpd
systemctl enable httpd

Create a ‘/etc/httpd/conf.d/vhosts.conf’ configuration file:

vi /etc/httpd/conf.d/vhosts.conf

Add the following line:

IncludeOptional vhosts.d/*.conf

Create a new ‘/etc/httpd/vhosts.d’ directory where we will put all virtual hosts:

mkdir /etc/httpd/vhosts.d

Create a virtual host for your domain name:

cd /etc/httpd/vhosts.d
vi your-domain.conf

and add the following content to it:

<VirtualHost *:80>
ServerAdmin webmaster@your-domain.com
DocumentRoot “/var/www/html/dolibarr”
ServerName your-domain.com
ServerAlias www.your-domain.com
ErrorLog “/var/log/httpd/your-domain.com-error_log”
CustomLog “/var/log/httpd/your-domain.com-access_log” combined

<Directory “/var/www/html/dolibarr/”>
DirectoryIndex index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Restart Apache using systemctl for the changes to take effect:

systemctl restart httpd

Open your favorite web browser, navigate to http://your-domain.com/htdocs/install/ and follow the easy instructions. Set the following information about Dolibarr database:

Database name: dolibarr
Database type: pgsql
Server: localhost
Port: 5432
Login: dolibarruser
Password: Y0uRpAssW0Rd

On the next page ‘Dolibarr install or upgrade – Administrator login creation’, create a new administrator account:

Dolibarr admin login :    admin
Password : y0urAdm1npassw0rd
Retype password a second time : y0urAdm1npassw0rd

For security reasons, you should add a file called install.lock in to the Dolibarr document root directory, in order to avoid malicious use of it:

touch /var/www/html/dolibarr/htdocs/install/install.lock
chown apache:apache /var/www/html/dolibarr/htdocs/install/install.lock

Login to the Dolibarr administration back-end at http://your-domain.com/htdocs/admin/ and configure Dolibarr according to your needs.

That is it. The Dolibarr installation is now complete.
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Dolibarr ERP CRM software for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

View Comments