How to Install Dolibarr on CentOS 7

In this tutorial let’s check how to install Dolibarr on CentOS 7. Dolibarr is written in PHP. It uses MySQL, MariaDB or PostgreSQL databases. Dolibarr ERP CRM is an open source, a free software package for small and medium companies, foundations or freelancers. It includes different features for enterprise resource planning and customer relationship management.

Requirements:

1) Database (Mysql 5.0.3+, MariaDB 5.0.3+, PostgresSQL 8.1.4+)

2) PHP 5.3.0 OR above

3) Web Server (Apache, Nginx)

1) Install PHP

First, we have to install the PHP. Enter the below command to install the php and its modules.

yum install -y php71w php71w-cli php71w-fpm php71w-mysql php71w-common php71w-xml php71w-zip php71w-sqlite3 php71w-gd php71w-mbstring php71w-mcrypt php71w-soap php71w-mysqlnd php71w-pgsql php71w-curl

2) Install MariaDB and Create Database

The second step is to download and install MariaDB.

Copy/paste the following to the file /etc/yum.repos.d/MariaDB.repo

[mariadb]

name = MariaDB

baseurl = https://yum.mariadb.org/10.2/centos7-amd64

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1

Then save the file and enter the following command.

 yum install -y MariaDB-server MariaDB-client

Then restart the MariaDB service using the following command.

systemctl start mariadb.service

Run the mysql_secure_installation script to improve the security of your MariaDB installation.

mysql_secure_installation

Log into MariaDB as the root user.

mysql -u root -p

Enter password:

Create a new MariaDB database and user, and remember the credentials.

CREATE DATABASE dbname CHARACTER SET utf8;

GRANT ALL ON dbname.* TO ‘username’ IDENTIFIED BY ‘password’;

FLUSH PRIVILEGES;

 

Then Exit the MariaDB using the command.

exit

3) Install and configure Nginx

Next step is Install Nginx.

yum install -y nginx

Start and enable Nginx.

systemctl start nginx.service

systemctl enable nginx.service

After enabling, we have to configure Nginx. Open the file /etc/nginx/conf.d/dolibarr.conf and copy paste the following.

server {

listen [::]:80;

listen 80;

server_name example.com; # Check this

root /var/www/dolibarr/htdocs; # Check this

index index.php index.html index.htm;

charset utf-8;

location / {

try_files $uri $uri/ /index.php;

}

location ~ [^/]\.php(/|$) {

try_files $uri =404;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_read_timeout 600;

include fastcgi_params;

fastcgi_pass 127.0.0.1:9000;

}

}

 

Run the following command to test the configuration.

nginx -t

Reload Nginx using the following command.

systemctl reload nginx.service

4) Install Composer

To install Dolibarr, we need to install Composer.

php -r “copy(‘https://getcomposer.org/installer‘, ‘composer-setup.php’);”

php -r “if (hash_file(‘SHA384’, ‘composer-setup.php’) === ‘544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”

php composer-setup.php

php -r “unlink(‘composer-setup.php’);”

mv composer.phar /usr/local/bin/composer

5) Install Dolibarr

Create a document root for Dolibarr directory.

mkdir -p /var/www/dolibarr

Download the latest stable release of Dolibarr from the command line.

cd /var/www/dolibarr

composer create-project dolibarr/dolibarr .

Change ownership of the /var/www/dolibarr directory to nginx.

chown -R nginx:nginx /var/www/dolibarr

Open /etc/php-fpm.d/www.conf and set the user and group to nginx. Initially, it will be set to user and group apache.

# user = nginx

# group = nginx

Restart php-fpm.service using the following command.

systemctl restart php-fpm.service

Using your preferred web browser, open http://example.com/install/ page and follow the Dolibarr installer. After following the installation wizard, you will have Dolibarr ERP/CRM up and running.

Was this answer helpful? 0 Users Found This Useful (0 Votes)