Image: iStockphoto/Lena_Datsiuk

Your business is growing and it needs more tools to keep things humming along. One such tool it could probably use is a customer resource manager/enterprise resource planning (CRM/ERP) platform. One option for this is the open source Flectra.

SEE: Pro tips: Ubuntu 20.04 (free PDF) (TechRepublic)

Flectra offers plenty of features to help your business grow with the demand, and do so with ease. Flectra has you covered for:

  • Sales

  • CMS

  • POS

  • Projects

  • Helpdesk

  • Marketing automation

  • Manufacturing

  • CRM

  • Accounting

  • Purchasing

  • Inventory

  • HR

This tool is, quite literally, a one-stop-shop for many of your backend business needs. Let’s get Flectra up and running.

SEE: Tips for choosing the best web host for your organization (TechRepublic download)

What you’ll need

  • A running (and updated) instance of Ubuntu Server 20.04

  • A user with sudo privileges

How to install the necessary dependencies and Flectra

The first thing to be done is the installation of the necessary dependencies. Log in to your Ubuntu server and issue the command:

sudo apt-get install gcc python3-venv build-essential python3-pillow python3-wheel python3-lxml python3-dev python3-pip python3-setuptools npm nodejs git gdebi libldap2-dev libsasl2-dev libxml2-dev libxslt1-dev libjpeg-dev libpq-dev -y

After that installation completes, download and install the final dependency with the commands:

cd /tmp
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb

How to install and configure the database

Now we’ll install the PostgreSQL database. To do that, issue the command:

sudo apt-get install postgresql -y

When that completes, create a new database user with the following commands:

sudo -s
su - postgres -c "createuser -s flectra"j

Next, we’re going to create a new Linux user with the command:

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

How to create a Flectra virtual environment

In order to continue, we must now create a virtual environment for Flectra. First, change to our newly-created user with the command:

su - flectra

Clone the Flectra source with the command:

git clone --depth=1 --branch=1.0 flectra

Create the virtual environment with the command:

python3 -m venv flectra-venv

Activate the new virtual environment with the command:

source flectra-venv/bin/activate

We now need to modify the Flectra requirements file to reflect a change in the Python requirements (from version 2.8.3 to 2.8.5). Open the requirements file with the command:

nano flectra/requirements.txt

Locate the following two lines:

psycopg2==; sys_platform != 'win32'
psycopg2==2.8.3; sys_platform == 'win32'

Change those two lines to:

psycopg2==2.8.5; sys_platform != 'win32'
psycopg2==2.8.5; sys_platform == 'win32'

Save and close the file.

Use Pip to install wheel with the command:

pip3 install wheel

Using Pip, install all of the required Python modules for Flectra with the command:

pip3 install -r flectra/requirements.txt

Once the above command completes, deactivate the virtual environment with the command:


Exit from the Flectra user with the command:


Exit from the root user with the command:


How to configure Flectra

It’s now time to configure Flectra. First, we need to create a few new directories with the following commands:

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

Give the newly-created directories the proper permissions with the commands:

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

Create the Flectra configuration with the command:

sudo nano /etc/flectra/flectra.conf

In that file, paste the following:

admin_passwd = PASSWORD
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

Where PASSWORD is a strong/unique password.

Save and close the file.

Now we must create a systemd startup file for Flectra. Issue the command:

sudo nano /etc/systemd/system/flectra.service

Paste the following contents into that file:

#Requires=postgresql-10.6.service postgresql-10.6.service

ExecStart=/opt/flectra/flectra-venv/bin/python3 /opt/flectra/flectra/flectra-bin -c /etc/flectra/flectra.conf


Save and close the file.

Reload the systemd daemon with the command:

sudo systemctl daemon-reload

Start and enable Flectra with the commands:

sudo systemctl start flectra
sudo systemctl enable flectra

How to install and configure NGINX

Before you do this, if you already have Apache installed on the machine, stop and disable it with the commands:

sudo systemctl stop apache2
sudo systemctl disable apache2

Install NGINX with the command:

sudo apt-get install nginx -y

Create the necessary configuration file with the command:

sudo nano /etc/nginx/sites-available/flectra.conf

In that file, paste the following:

#flectra server
upstream flectra {


server {
listen 80;
server_name FQDN;
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;

Make sure to replace FQDN with the fully qualified domain name of your server. Save and close the file. Activate the new site with the command:

sudo ln -s /etc/nginx/sites-available/flectra.conf /etc/nginx/sites-enabled/

Restart NGINX with the command:

sudo systemctl restart nginx

How to access the Flectra UI

Open a web browser and point it to http://SERVER_IP:7073 (where SERVER_IP is either the IP address or domain of your server). You will be greeted by the database configuration page (Figure A).

Figure A

The Flectra database configuration page.

Fill out the necessary items for the database and click Create Database. Once the database creation completes, the Flectra dashboard will appear so you can get to work (Figure B).

Figure B

The Flectra dashboard ready for you to install all of the modules you need.

How to get around installation issues

If, after the database installation completes, you receive an Error 500, I’m going to give you this bit of advice–don’t try to fix it. Instead, you’ll want to go a completely different route. What I did was move over to a Ubuntu 18.04 server, download the official .deb file (you have to register for this) and then issue the following command:

sudo dpkg -i flectra*.deb

The installation will error out because of dependency issues. To fix that, issue the command:

sudo apt-get install -f

That installation should complete and you can point your browser to the same address you used above. If, however, that method fails you, there’s one other option.

You can also deploy Flectra with docker using the following commands (this method will definitely work):

docker run -d -e POSTGRES_USER=flectra -e POSTGRES_PASSWORD=flectra --name db postgres:9.4
docker run -p 7073:7073 --name flectra --link db:db -t flectrahq/flectra

Note: The second docker command above does take some time to run (up to 10 minutes or so). Don’t get impatient with it–give it time to complete.

Once the container has deployed, you should then be able to access Flectra. The difference is, you won’t have to create a database. You’ll be presented with a login screen (the login credentials are admin/admin) and then you’ll find yourself within the Flectra dashboard.

One way or another, you should be able to get Flectra up and running and serving your CRM/ERP needs. This tool is powerful enough that it’s worth the time and effort.