How to install Flectra HQ

,

Howto install flectra on minimal centos

The issues are with selinux, firewalld (which are not used in NethServer) and postgres.

Disable firewall. For production please keep security in mind and configure the firewall instead of disabling it.

systemctl disable firewalld --now

Disable selinux:

Edit /etc/selinux/config and set SELINUX=disabled. Reboot the system.

Install and prepare postgres:

yum -y install postgresql postgresql-server
postgresql-setup initdb

Edit /var/lib/pgsql/data/pg_hba.conf and replace the lines at the end to look like this:

# "local" is for Unix domain socket connections only
local   all         postgres                          ident
local   all         all                               md5
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host all all ::1/128 md5

Restart postgres:

systemctl restart postgresql

Go on with the rest of the installation (same except of e-smith commands):

yum -y install python36u python36u-pip python36u-devel wget unzip postgresql-devel npm nodejs git libjpeg-devel libxml2-devel libxslt-devel openldap-devel cyrus-sasl-devel
pip3.6 install --upgrade pip
ln -s /usr/bin/python3.6 /usr/bin/python3
wget -nc https://gitlab.com/flectra-hq/flectra/repository/master/archive.zip
unzip -nq archive.zip
mkdir -p /opt/flectra
mkdir -p /etc/flectra
mkdir -p /var/log/flectra
mv flectra-master* flectra
mv flectra /opt/flectra/
chown flectra:flectra /opt/flectra/ -R && chown flectra:flectra /var/log/flectra/ -R
cd /opt/flectra/flectra && pip3.6 install -r requirements.txt
npm install -g less less-plugin-clean-css -y
mkdir /opt/wkhtmltox && cd /opt/wkhtmltox && wget -nc https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
cd /opt/wkhtmltox/wkhtmltox
cp -R /opt/wkhtmltox/wkhtmltox/* /usr/local/
ln -s /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
ln -s /usr/local/bin/wkhtmltoimage /usr/bin/wkhtmltoimage
mkdir /opt/geolite && cd /opt/geolite && wget -N http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz
mkdir /usr/share/GeoIP
mv /opt/geolite/GeoLiteCity.dat /usr/share/GeoIP
postgresql-setup initdb
systemctl enable --now postgresql
su - postgres -c "createuser -s flectra"
su - postgres -c "psql -c \"alter user flectra with encrypted password 'flectra';\""
su - flectra -c "/opt/flectra/flectra/flectra-bin --addons-path=/opt/flectra/flectra/addons -s --stop-after-init"
mv /opt/flectra/.flectrarc /etc/flectra/flectra.conf
sed -i "s,^\(logfile = \).*,\1"/var/log/flectra/flectra-server.log"," /etc/flectra/flectra.conf
sed -i "s,^\(logrotate = \).*,\1"True"," /etc/flectra/flectra.conf
sed -i "s,^\(proxy_mode = \).*,\1"True"," /etc/flectra/flectra.conf
sed -i "s,^\(db_host = \).*,\1"localhost"," /etc/flectra/flectra.conf
sed -i "s,^\(db_name = \).*,\1"flectra"," /etc/flectra/flectra.conf
sed -i "s,^\(db_password = \).*,\1"flectra"," /etc/flectra/flectra.conf
sed -i "s,^\(db_template = \).*,\1"template0"," /etc/flectra/flectra.conf
sed -i "s,^\(db_user = \).*,\1"flectra"," /etc/flectra/flectra.conf
ln -s /opt/flectra/flectra/flectra-bin /usr/bin/flectra

cat << EOF > /usr/lib/systemd/system/flectra.service
[Unit]
Description=Flectra
Wants=network.target

[Service]
Type=simple
User=flectra
Group=flectra
ExecStart=/usr/bin/flectra --config /etc/flectra/flectra.conf --logfile /var/log/flectra/flectra-server.log

[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now flectra
2 Likes

Just a longshot, but if you happen to have SavaPage installed, which uses PGSQL too, would that interfere in any way? or is it just the database you use?
I’ve seen the pg_hba.conf adjustment for SavaPage too… Are they similar or mutual usable?

This is a “how to install flectra on minimal centos”. I should have pointed that out more, I’ll edit my post.

1 Like

Ah, clear, so not on NS… thnx for the info

Hi! What you have chosen instead of the electra?
Odoo?

I don’t really have a favourite erp/crm but there are some alternatives like odoo and others:

I wasn’t able to integrate Odoo 11 but I’ll give it another try…

And many more, if you like one of them we could think about integrating it to Nethserver.

https://alternativeto.net/software/openerp/

2 Likes

FYI, issue between Odoo and Flectra seem to be resolved.

3 Likes

Updated instrucctions!!!

#!/bin/bash
sudo adduser --system --shell=/bin/bash --home-dir=/opt/flectra -m flectra && sudo mkdir /etc/flectra && mkdir /var/log/flectra/
sudo yum install https://centos7.iuscommunity.org/ius-release.rpm -y && sudo yum update -y && yum upgrade -y && sudo yum groupinstall ‘Development Tools’ -y && sudo yum install python36u python36u-devel python36-pillow python36-lxml npm nodejs libxml2-devel libjpeg-devel libxml2 libxslt libxslt-devel wget libpng libjpeg openssl icu libX11 libXext libXrender xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi python3-pip python3-setuptools git openldap-devel -y
rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm && yum install postgresql10-server postgresql10 -y && /usr/pgsql-10/bin/postgresql-10-setup initdb && systemctl start postgresql-10.service && systemctl enable postgresql-10.service
sudo npm install -g less less-plugin-clean-css -y
git clone --depth=1 --branch=1.0 https://gitlab.com/flectra-hq/flectra.git /opt/flectra/flectra
sudo chown flectra:flectra /opt/flectra/ -R && sudo chown flectra:flectra /var/log/flectra/ -R && cd /opt/flectra/flectra && sudo pip3 install -r requirements.txt
cd /tmp && wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos7.x86_64.rpm && rpm -Uvh wkhtmltox-0.12.5-1.centos7.x86_64.rpm
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin/ && sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin/
sudo su - postgres -c “createuser -s flectra”
sudo su - flectra -c “/opt/flectra/flectra/flectra-bin --addons-path=/opt/flectra/flectra/addons -s --stop-after-init”
sudo mv /opt/flectra/.flectrarc /etc/flectra/flectra.conf
sudo sed -i “s,^(logfile = ).,\1"/var/log/flectra/flectra-server.log"," /etc/flectra/flectra.conf
sudo sed -i "s,^(logrotate = ).
,\1"True”," /etc/flectra/flectra.conf
sudo sed -i “s,^(proxy_mode = ).*,\1"True”," /etc/flectra/flectra.conf
sudo ln -s /opt/flectra/flectra/flectra-bin /usr/bin/flectra
sudo cp /opt/flectra/flectra/debian/flectra.service /etc/systemd/system/flectra.service && chmod +x /etc/systemd/system/flectra.service && sudo systemctl daemon-reload && sudo systemctl start flectra && sudo systemctl enable flectra && chkconfig --levels 2345 flectra on

3 Likes

Thank you for the input…

#!/bin/bash

sudo adduser --system --shell=/bin/bash --home-dir=/opt/flectra -m flectra && sudo mkdir /etc/flectra && mkdir /var/log/flectra/

sudo yum install https://centos7.iuscommunity.org/ius-release.rpm -y && sudo yum update -y && yum upgrade -y && sudo yum groupinstall ‘Development Tools’ -y && sudo yum install python36u python36u-devel python36-pillow python36-lxml npm nodejs libxml2-devel libjpeg-devel libxml2 libxslt libxslt-devel wget libpng libjpeg openssl icu libX11 libXext libXrender xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi python3-pip python3-setuptools git openldap-devel -y

rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm && yum install postgresql10-server postgresql10 -y && /usr/pgsql-10/bin/postgresql-10-setup initdb && systemctl start postgresql-10.service && systemctl enable postgresql-10.service

sudo npm install -g less less-plugin-clean-css -y

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

sudo chown flectra:flectra /opt/flectra/ -R && sudo chown flectra:flectra /var/log/flectra/ -R && cd /opt/flectra/flectra && sudo pip3 install -r requirements.txt

cd /tmp && wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos7.x86_64.rpm && rpm -Uvh wkhtmltox-0.12.5-1.centos7.x86_64.rpm

sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin/ && sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin/

sudo su - postgres -c “createuser -s flectra”

sudo su - flectra -c “/opt/flectra/flectra/flectra-bin --addons-path=/opt/flectra/flectra/addons -s --stop-after-init”

sudo mv /opt/flectra/.flectrarc /etc/flectra/flectra.conf

sudo sed -i “s,^(logfile = ).,\1"/var/log/flectra/flectra-server.log"," /etc/flectra/flectra.conf

sudo sed -i "s,^(logrotate = ).,\1"True”," /etc/flectra/flectra.conf

sudo sed -i “s,^(proxy_mode = ).*,\1"True”," /etc/flectra/flectra.conf

sudo ln -s /opt/flectra/flectra/flectra-bin /usr/bin/flectra

sudo cp /opt/flectra/flectra/debian/flectra.service /etc/systemd/system/flectra.service && chmod +x /etc/systemd/system/flectra.service && sudo systemctl daemon-reload && sudo systemctl start flectra && sudo systemctl enable flectra && chkconfig --levels 2345 flectra on
1 Like

Updated and corrected instructions

First Install PostgreSQL as root

yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum -y install epel-release yum-utils
sudo yum-config-manager --enable pgdg12
sudo yum install postgresql12-server postgresql12
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
sudo systemctl enable --now postgresql-12

Enable remote access (Optional)

Edit the file /var/lib/pgsql/12/data/postgresql.conf and set Listen address to your server IP address or “ ***** ” for all interfaces.

listen_addresses = '192.168.10.10'

Also set PostgreSQL to accept remote connections

$ sudo vim /var/lib/pgsql/12/data/pg_hba.conf

Accept from anywhere 
host all all 0.0.0.0/0 md5 
Accept from trusted subnet 
host all all 192.168.18.0/24 md5

Restart database service after committing the change.

sudo systemctl restart postgresql-12

Then install Flectra!!!

sudo adduser --system --shell=/bin/bash --home-dir=/opt/flectra -m flectra && sudo mkdir /etc/flectra && mkdir /var/log/flectra/
sudo yum install -y https://repo.ius.io/ius-release-el7.rpm
yum update
sudo yum groupinstall "Development Tools" -y && sudo yum install python36 python36-devel python36-pillow python36-pip python36-lxml npm nodejs libxml2-devel libjpeg-devel libxml2 libxslt libxslt-devel wget libpng libjpeg openssl icu libX11 libXext libXrender xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi python3-pip python3-setuptools git openldap-devel -y
sudo npm install -g less less-plugin-clean-css -y
git clone --depth=1 --branch=1.0 https://gitlab.com/flectra-hq/flectra.git /opt/flectra/flectra
sudo chown flectra:flectra /opt/flectra/ -R && sudo chown flectra:flectra /var/log/flectra/ -R && cd /opt/flectra/flectra && sudo pip3 install -r requirements.txt
cd /tmp && wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm
rpm -Uvh wkhtmltox-0.12.6-1.centos7.x86_64.rpm
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin/ && sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin/

sudo su - postgres
-bash-4.2$ createuser -s flectra
logout

sudo su - flectra
[flectra@localhost ~]$ /opt/flectra/flectra/flectra-bin --addons-path=/opt/flectra/flectra/addons -s --stop-
after-init
logout

sudo mv /opt/flectra/.flectrarc /etc/flectra/flectra.conf
sed -i "s,^\(logfile = \).*,\1"/var/log/flectra/flectra-server.log"," /etc/flectra/flectra.conf
sed -i "s,^\(logrotate = \).*,\1"True"," /etc/flectra/flectra.conf
sed -i "s,^\(proxy_mode = \).*,\1"True"," /etc/flectra/flectra.conf
sudo ln -s /opt/flectra/flectra/flectra-bin /usr/bin/flectra
sudo cp /opt/flectra/flectra/debian/flectra.service /etc/systemd/system/flectra.service && chmod +x /etc/systemd/system/flectra.service && sudo systemctl daemon-reload && sudo systemctl start flectra && sudo systemctl enable flectra && chkconfig --levels 2345 flectra on
config set fw_flectra service status enabled TCPPort 7073 access green
signal-event firewall-adjust
systemctl enable --now flectra
7 Likes

some attempts - same error

chmod: Access „etc/systemd/system/flectra.service“ not possible: File or Directory not found

[root@flectra system]# ls -al etc/systemd/system/flectra.service
ls: cannot access etc/systemd/system/flectra.service: No such file or directory
[root@flectra system]# ls -al etc/systemd/system/
ls: cannot access etc/systemd/system/: No such file or directory
[root@flectra system]# ls -al etc/systemd/
ls: cannot access etc/systemd/: No such file or directory

but the directory and file exits

Goog Evening

Can’t reproduce the error, on the virtualmachine and the company server It working normally.

Perhaps this is the error:

chmod: Access „etc/systemd/system/flectra.service“ not possible: File or Directory not found

root@flectra system]# ls -al etc/systemd/

And should be:

root@flectra system]# ls -al /etc/systemd/system/

With the slash “/” at the beggining of the “etc”

1 Like

well, thanks

# ls -al /etc/systemd/system/flectra.service
-rw-r--r-- 1 root root 284 Sep 30 21:50 /etc/systemd/system/flectra.service

But I don’t have an idea, why the command…

sudo cp /opt/flectra/flectra/debian/flectra.service /etc/systemd/system/flectra.service && chmod +x etc/systemd/system/flectra.service && sudo systemctl daemon-reload && sudo systemctl start flectra && sudo systemctl enable flectra && chkconfig --levels 2345 flectra on
…fails.

Because the / is missing after chmod +x, before etc.

Correct:

sudo cp /opt/flectra/flectra/debian/flectra.service /etc/systemd/system/flectra.service && chmod +x /etc/systemd/system/flectra.service && sudo systemctl daemon-reload && sudo systemctl start flectra && sudo systemctl enable flectra && chkconfig --levels 2345 flectra on

3 Likes

Fixed!!

3 Likes

I believe I finished the installation process.Thank you @hector

[root@flectra ~]# systemctl status flectra
● flectra.service - Flectra Open Source ERP and CRM
   Loaded: loaded (/etc/systemd/system/flectra.service; enabled; vendor preset: disabled)
   Active: active (running) since Mi 2020-09-30 22:26:18 CEST; 10min ago
 Main PID: 19521 (python3)
   CGroup: /system.slice/flectra.service
           └─19521 python3 /usr/bin/flectra --config /etc/flectra/flectra.conf --logfile /var/log/flectra/flectra-server.log

Sep 30 22:26:18 flectra.lan.home systemd[1]: Started Flectra Open Source ERP and CRM.

But it is not possible to access the server: https://192.168.3.211:7073
The server does not respond to the request.

is http!!! not https

thank you for the hint. But the result is the same.

after restart the server is accessible.

1 Like

Hi, first thanks for this detaiIed HowTo. I really appreciate this!

I had some troubles when installing flectra with your instructions and so I want to give a feedback.

  1. when installing pip3, the file “pg_config” was not found. I had to add /usr/pgsql-12/bin to $PATH and execute the command without “sudo” cause this ignores the changed path env.
  2. I had to install postgresql-devel with yum because there was another file missing: “libpq-fe.h”
  3. /opt/flectra/flectra/flectra-bin --addons-path=/opt/flectra/flectra/addons -s --stop-after-init This command should be in one line
  4. when I changed the “listen_adress” in pg_hba.conf I got an internal server error with something about client can not connect to database in log file. It was gone as I changed back to default values.

Now flectra is up and running.

Hope this helps someone.

Best wishes to all

flatspin

4 Likes