How to install Flectra HQ

,

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

I bash installed Flectra, when running localhost:7073 it works and give the screen to create a database.

How create also a db + custom pasw/login at bash bootstrapping?
I loaded this flectra.service

[Unit]
Description=flectra

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

[Install]
WantedBy=multi-user.target

Afterwards I set this run this default.py in the python venv:

from flectra.service.db import exp_create_database
from flectra import api, SUPERUSER_ID
import flectra

DB_NAME = "default"
IS_DEMO = True
ADMIN_USER = "newuser"
ADMIN_PASS = "newuser"
MODULES = ["project"]

exp_create_database(db_name=DB_NAME, demo=IS_DEMO, lang="en_US", login=ADMIN_USER, user_password=ADMIN_PASS)
db = flectra.sql_db.db_connect(DB_NAME)
with api.Environment.manage(), db.cursor() as cr:
    env = api.Environment(cr, SUPERUSER_ID, {})

    module_ids = env['ir.module.module'].search([('name', 'in', MODULES)])
    module_ids.button_immediate_install()

But this gives me this error
2021-01-08 12:01:42,954 2390 INFO ? flectra: Flectra version 1.7
2021-01-08 12:01:42,955 2390 INFO ? flectra: addons paths: [’/root/.local/share/Flectra/addons/1.7’, ‘/opt/flectra/flectra/flectra/addons’, ‘/opt/flectra/flectra/addons’]
2021-01-08 12:01:42,955 2390 INFO ? flectra: database: default@default:default
2021-01-08 12:01:42,996 2390 INFO ? flectra.service.server: Initiating shutdown
2021-01-08 12:01:42,997 2390 INFO ? flectra.service.server: Hit CTRL-C again or send a second signal to force the shutdown.
2021-01-08 12:01:43,000 2390 INFO ? flectra.service.db: Create database default.
2021-01-08 12:01:43,012 2390 INFO ? flectra.sql_db: Connection to the database failed
Traceback (most recent call last):
File “./flectra/flectra-bin”, line 8, in
flectra.cli.main()
File “/opt/flectra/flectra/flectra/cli/command.py”, line 60, in main
o.run(args)
File “/opt/flectra/flectra/flectra/cli/shell.py”, line 125, in run
self.shell(config[‘db_name’])
File “/opt/flectra/flectra/flectra/cli/shell.py”, line 121, in shell
self.console(local_vars)
File “/opt/flectra/flectra/flectra/cli/shell.py”, line 67, in console
exec(sys.stdin.read(), local_vars)
File “”, line 11, in
File “”, line 2, in exp_create_database
File “/opt/flectra/flectra/flectra/service/db.py”, line 40, in if_db_mgt_enabled
return method(self, *args, **kwargs)
File “/opt/flectra/flectra/flectra/service/db.py”, line 109, in exp_create_database
_create_empty_database(db_name)
File “/opt/flectra/flectra/flectra/service/db.py”, line 95, in _create_empty_database
with closing(db.cursor()) as cr:
File “/opt/flectra/flectra/flectra/sql_db.py”, line 643, in cursor
return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized)
File “/opt/flectra/flectra/flectra/sql_db.py”, line 179, in init
self._cnx = pool.borrow(dsn)
File “/opt/flectra/flectra/flectra/sql_db.py”, line 526, in _locked
return fun(self, *args, **kwargs)
File “/opt/flectra/flectra/flectra/sql_db.py”, line 594, in borrow
**connection_info)
File “/opt/flectra/flectra-venv/lib/python3.7/site-packages/psycopg2/init.py”, line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL: role “root” does not exist

Hi @ssstofff,
welcome to the community and sorry for the very late response,
I hope @mrmarkuz can help here.

1 Like

Which howto did you use? There are more in this thread…

Did you allow flectra to connect to the database without password or did you set the right db_user and db_password in /etc/flectra/flectra.conf ?

I’m going to update the howto as soon as I find time.

3 Likes