How To Install Flectra on CentOS 8

Install Flectra on CentOS 8

In this tutorial, we will show you how to install Flectra on CentOS 8. For those of you who didn’t know, Flectra is a free and open-source, CRM (customer relationship management) and ERP (enterprise resource planning) software system that provides a lot of flexibility and customization that lets you meet the unique needs of your business. In simple terms, Flectra gives you a comprehensive platform so that you can easily modify or configure it as per your requirements. Flectra provides a lot of features such as Accounting, E-Commerce, Inventory Management, Marketing, Project Management, CRM, Reporting, Leave Management, and many more.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step install of the Flectra open source ERP and CRM software on CentOS 8.

Install Flectra on CentOS 8

Step 1. First, let’s start by ensuring your system is up-to-date.

sudo dnf clean all
sudo dnf update

Step 2. Configure SELinux on the CentOS system.

We recommended disabling the SELinux in your system. You can disable it by editing the file /etc/selinux/config:

nano /etc/selinux/config

Change the following line:

SELINUX=disabled

Step 3. Installing Require Dependencies.

Now we install Flectra dependencies on your system. You can install all of them in one go by running the following command:

sudo dnf install python36 python36-devel git gcc wget nodejs libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel

Next, run the following command to install the Node.js module:

npm install -g less

Also need to install the wkhtmltopdf package in your system:

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos8.x86_64.rpm
sudo dnf localinstall wkhtmltox-0.12.6-1.centos7.x86_64.rpm

Step 4. Installing PostgreSQL.

Now we install the PostgreSQL database using the following commands:

sudo dnf install postgresql-server

Once installing the PostgreSQL server, initialize the database with the following command:

postgresql-setup --initdb --unit postgresql

Next, start the PostgreSQL service and enable it to start at system reboot with the following command:

sudo systemctl start postgresql
sudo systemctl enable postgresql

Step 5. Installing Install Flectra on CentOS 8.

First, create a separate user for Flectra. You can create it using the following command:

useradd -m -U -r -d /opt/flectra -s /bin/bash flectra

Once done, log in with the Flectra user and download Flectra from the Git repository:

su - flectra
git clone --depth=1 --branch=1.0 https://gitlab.com/flectra-hq/flectra.git flectra

Then, create a virtual environment for Flectra:

python3 -m venv my-flectra

Next, activate the virtual environment using the following command:

source my-flectra/bin/activate

Afterward, install all Python modules by running the following command below:

pip3 install -r flectra/requirements.txt

When all required modules are installed, deactivate the virtual environment and exit by using the following command:

deactivate
exit

Step 6. Configuring Flectra.

Now we create directories for Flectra configuration, executables, and log files:

mkdir /opt/flectra/flectra-custom-addons
mkdir /var/log/flectra
mkdir /etc/flectra
touch /var/log/flectra/flectra.log

Change the owner of the newly created directories to Flectra user:

chown -R flectra:flectra /opt/flectra/flectra-custom-addons
chown -R flectra:flectra /var/log/flectra/
chown -R flectra:flectra /etc/flectra

Next, we edit Flectra configuration file:

nano /etc/flectra/flectra.conf

Add the following lines:

[options]
admin_passwd = your-strong-password-flectra
db_host = False
db_port = False
db_user = flectra
db_password = False
logfile = /var/log/flectra/flectra.log
logrotate = True
proxy_mode = True
addons_path = /opt/flectra/flectra/addons, /opt/flectra/flectra-custom-addons

Step 7. Create a Systemd Service for Flectra.

To enable autostart of Flectra at Linux startup, we need to create a systemd service for Flectra:

nano /etc/systemd/system/flectra.service

Add the following lines:

[Unit]
Description=flectra
#Requires=postgresql-10.6.service
#After=network.target postgresql-10.6.service

[Service]
Type=simple
SyslogIdentifier=flectra
PermissionsStartOnly=true
User=flectra
Group=flectra
ExecStart=/opt/flectra/my-flectra/bin/python3 /opt/flectra/flectra/flectra-bin -c /etc/flectra/flectra.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target

Save and close, reload the systemd daemon and after reload start and enable the Flectra service:

sudo systemctl daemon-reload
sudo systemctl start flectra
sudo systemctl enable flectra

Step 8. Configure Nginx for Flectra.

First, install the Nginx web server using the following command:

sudo dnf install nginx

Once installed, start the Nginx service and enable it to start at system reboot:

sudo systemctl start nginx 
sudo systemctl enable nginx

Next, create a new Nginx virtual host configuration file for Flectra:

nano /etc/nginx/conf.d/flectra.conf

Add the following lines:

#flectra server
upstream flectra {
server 127.0.0.1:7073;
}

server {
listen 80;
server_name flectra.idroot.us;

proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;

# Add Headers for flectra proxy mode
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;

# log
access_log /var/log/nginx/flectra.access.log;
error_log /var/log/nginx/flectra.error.log;

# Redirect requests to flectra backend server
location / {
proxy_redirect off;
proxy_pass http://flectra;
}

# common gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}

Save and close the file when you are finished. Then, restart the Nginx service to apply the changes:

sudo systemctl restart nginx

Step 9. Accessing the Flectra Web Interface.

To access the Flectra web interface, open your favorite web browser and search for the URL http://flectra.idroot.us, You will be greeted by the database configuration page:

Install Flectra on CentOS 8

Congratulations! You have successfully installed Flectra. Thanks for using this tutorial for installing the Flectra open source ERP and CRM software on CentOS 8 systems. For additional help or useful information, we recommend you check the official Flectra 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!