There are mutliple ways to install Flectra, or not install it at all, depending on the intended use case.
This documents attempts to describe most of the installation options.
- Packaged installers
- Suitable for testing Flectra, developing modules and can be used for long-term production use with additional deployment and maintenance work.
- Source Install
- Provides greater flexibility: e.g. allow multiple running Flectra versions on the same system. Good for developing modules, can be used as base for production deployment.
- If you usually use docker for development or deployment, an official docker base image is available.
Flectra provides packaged installers for Windows, deb-based distributions (Debian, Ubuntu, …) and RPM-based distributions (Fedora, CentOS, RHEL, …) for the Community versions.
These packages automatically set up all dependencies,but may be difficult to keep up-to-date.
- Download the installer from our Community only or the Windows installer from the Download page (any edition)
Run the downloaded file
on Windows 8, you may see a warning titled “Windows protected your PC”. Click More Info then Run anyway
- Accept the UAC prompt
- Go through the various installation steps
Flectra will automatically be started at the end of the installation.
Flectra needs a PostgreSQL server to run properly. The default configuration for the Flectra ‘deb’ package is to use the PostgreSQL server on the same host as your Flectra instance. Execute the following command as root in order to install PostgreSQL server :
# apt-get install postgresql -y
In order to print PDF reports, you must install wkhtmltopdf yourself: the version of wkhtmltopdf available in debian repositories does not support headers and footers so it can not be installed automatically. The recommended version is 0.12.5 and is available on the wkhtmltopdf download page, in the archive section.
Flectra provides a repository that can be used with Debian and Ubuntu distributions. It can be used to install Flectra by executing the following commands as root:
# wget -O - https://download.flectrahq.com/flectra.key | apt-key add - # echo "deb https://download.flectrahq.com/1.0/pub/deb/ ./" >> /etc/apt/sources.list.d/flectra.list # apt-get update && apt-get install flectra
You can then use the usual
apt-get upgrade command to keep your installation up-to-date.
Instead of using the repository as described above, the ‘deb’ package can be downloaded here:
- Community Edition: flectrahq
You can then use
# gdebi <path_to_installation_package>
dpkg (handles less dependencies automatically):
# dpkg -i <path_to_installation_package> # this probably fails with missing dependencies # apt-get install -f # should install the missing dependencies # dpkg -i <path_to_installation_package>
This will install Flectra as a service, create the necessary PostgreSQL user and automatically start the server.
The 3 following python packages are only suggested by the Debian package. Those packages are not available in Ubuntu Xenial (16.04).
- python3-vobject: Used in calendars to produce ical files.
- python3-pyldap: Used to authenticat users with LDAP.
- python3-qrcode: Used by the hardware driver for ESC/POS
If you need one or all of the packages mentioned in the above warning, you can install them manually. One way to do it, is simply using pip3 like this:
$ sudo pip3 install vobject qrcode $ sudo apt install libldap2-dev libsasl2-dev $ sudo pip3 install pyldap
Debian 9 and Ubuntu do not provide a package for the python module num2words. Textual amounts will not be rendered by Flectra and this could cause problems with the “l10n_mx_edi” module.
If you need this feature, you can install the python module like this:
$ sudo pip3 install num2words
FlectraHQ ‘rpm’ package supports Fedora 26. As of 2017, CentOS does not have the minimum Python requirements (3.5) for Flectra 1.0.
Flectra needs a PostgreSQL server to run properly. Assuming that the ‘sudo’ command is available and configured properly, run the following commands :
$ sudo dnf install -y postgresql-server $ sudo postgresql-setup --initdb --unit postgresql $ sudo systemctl enable postgresql $ sudo systemctl start postgresql
In order to print PDF reports, you must install wkhtmltopdf yourself: the version of wkhtmltopdf available in debian repositories does not support headers and footers so it can not be installed automatically. The recommended version is 0.12.1 and is available on the wkhtmltopdf download page, in the archive section.
Flectra provides a repository that can be used with the Fedora distibutions. It can be used to install Flectra Community Edition by executing the following commands:
$ sudo dnf config-manager --add-repo=https://download.flectrahq.com/1.0/pub/rpm/flectra_1.0.latest.noarch.rpm $ sudo dnf install -y flectra $ sudo systemctl enable flectra $ sudo systemctl start flectra
Instead of using the repository as described above, the ‘rpm’ package can be downloaded here:
- Community Edition: flectrahq_rpm
Once downloaded, the package can be installed using the ‘dnf’ package manager:
$ sudo dnf localinstall flectra_1.0.latest.noarch.rpm $ sudo systemctl enable flectra $ sudo systemctl start flectra
The source “installation” really is about not installing Flectra, and running it directly from source instead.
This can be more convenient for module developers as the Flectra source is more easily accessible than using packaged installation (for information or to build this documentation and have it available offline).
It also makes starting and stopping Flectra more flexible and explicit than the services set up by the packaged installations, and allows overriding settings using command-line parameters without needing to edit a configuration file.
Finally it provides greater control over the system’s set up, and allows more easily keeping (and running) multiple versions of Flectra side-by-side.
Source installation requires manually installing dependencies:
on Linux and OS X, using your package manager if not installed by default
on some system,
pythoncommand refers to Python 2 (outdated) or to Python 3 (supported). Make sure you are using the right version and that the alias
python3is present in your
on Windows, use the official Python 3 installer.
select “add python.exe to Path” during installation, and reboot afterwards to ensure the
if Python is already installed, make sure it is 3.5 or above, previous versions are not compatible with Flectra.
PostgreSQL, to use a local database
After installation you will need to create a postgres user: by default the only user is
postgres, and Flectra forbids connecting as
on Linux, use your distribution’s package, then create a postgres user named like your login:
$ sudo su - postgres -c "createuser -s $USER"
Because the role login is the same as your unix login unix sockets can be use without a password.
- on OS X, postgres.app is the simplest way to get started, then create a postgres user as on Linux
on Windows, use PostgreSQL for windows then
- add PostgreSQL’s
C:\Program Files\PostgreSQL\9.4\bin) to your
create a postgres user with a password using the pg admin gui: open pgAdminIII, double-click the server to create a connection, select Role Name field (e.g., enter the usename in the
flectra), then open the Definition tab and enter the password (e.g.
flectra), then click OK.
- add PostgreSQL’s
Python dependencies listed in the
on Linux, python dependencies may be installable with the system’s package manager or using pip.
For libraries using native code (Pillow, lxml, greenlet, gevent, psycopg2, ldap) it may be necessary to install development tools and native dependencies before pip is able to install the dependencies themselves. These are available in
-develpackages for Python, Postgres, libxml2, libxslt, libevent, libsasl2 and libldap2. Then the Python dependecies can themselves be installed:
$ pip3 install -r requirements.txt
on OS X, you will need to install the Command Line Tools (
xcode-select --install) then download and install a package manager of your choice (homebrew, macports) to install non-Python dependencies. pip can then be used to install the Python dependencies as on Linux:
$ pip3 install -r requirements.txt
on Windows you need to install some of the dependencies manually, tweak the requirements.txt file, then run pip to install the remaning ones.
psycopgusing the installer here http://www.stickpeople.com/projects/python/win-psycopg/
Then use pip to install the dependencies using the following command from a cmd.exe prompt (replace
\YourFlectraPathby the actual path where you downloaded Flectra):
C:\> cd \YourFlectraPath C:\YourFlectraPath> C:\Python35\Scripts\pip.exe install -r requirements.txt
Less CSS via nodejs
on Linux, use your distribution’s package manager to install nodejs and npm.
In debian wheezy and Ubuntu 13.10 and before you need to install nodejs manually:
$ wget -qO- https://deb.nodesource.com/setup | bash - $ apt-get install -y nodejs
In later debian (>jessie) and ubuntu (>14.04) you may need to add a symlink as npm packages call
nodebut debian calls the binary
$ apt-get install -y npm $ sudo ln -s /usr/bin/nodejs /usr/bin/node
Once npm is installed, use it to install less:
$ sudo npm install -g less
$ sudo npm install -g less
on Windows, install nodejs, reboot (to update the
PATH) and install less:
C:\> npm install -g less
Fetch the sources
There are two ways to obtain the Flectra source code: zip or git.
- Flectra zip can be downloaded from our flectrahq server or our flectrahq_zip page, the zip file then needs to be uncompressed to use its content
- gitlab allows simpler update and easier switching between different versions of Flectra. It also simplifies maintaining non-module patches and contributions. The primary drawback of git is that it is significantly larger than a tarball as it contains the entire history of the Flectra project.
Once all dependencies are set up, Flectra can be launched by running
Common necessary configurations are:
PostgreSQL host, port, user and password.
Flectra has no defaults beyond psycopg2’s defaults: connects over a UNIX socket on port 5432 with the current user and no password. By default this should work on Linux and OS X, but it will not work on windows as it does not support UNIX sockets.
- Custom addons path beyond the defaults, to load your own modules
Under Windows a typical way to execute flectra would be:
C:\YourFlectraPath> python3 flectra-bin -w flectra -r flectra --addons-path=addons,../mymodules --db-filter=mydb$
flectra are the postgresql login and password,
../mymodules a directory with additional addons and
mydb the default
db to serve on localhost:7073
Under Unix a typical way to execute flectra would be:
$ ./flectra-bin --addons-path=addons,../mymodules --db-filter=mydb$
../mymodules is a directory with additional addons and
default db to serve on localhost:7073
Virtualenv is a tool to create Python isolated environments because it’s sometimes preferable to not mix your distribution python modules packages with globally installed python modules with pip.
This section will explain how to run Flectra in a such isolated Python environment.
Here we are going to use virtualenvwrapper which is a set of shell scripts that makes the use of virtualenv easier.
This section assumes that you obtained the Flectra sources from the zip file or the git repository as explained above. The same apply for postgresql installation and configuration.
$ sudo apt install virtualenvwrapper $ source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
This will install virtualenvwrapper and activate it immediately. Now, let’s install the tools required to build Flectra dependencies if needed:
$ sudo apt install build-essential python3-dev libxslt-dev libzip-dev libldap2-dev libsasl2-dev
Create an isolated environment
Now we can create a virtual environment for Flectra like this:
$ mkvirtualenv -p /usr/bin/python3 flectra-venv
With this command, we ask for an isolated Python3 environment that will be named “flectra-env”. If the command works as expected, your shell is now using this environment. Your prompt should have changed to remind you that you are using an isolated environment. You can verify with this command:
$ which python3
This command should show you the path to the Python interpreter located in the isolated environment directory.
Now let’s install the Flectra required python packages:
$ cd your_flectra_sources_path $ pip install -r requirements.txt
After a little while, you should be ready to run flectra from the command line as explained above.
When you you want to leave the virtual environment, just issue this command:
Whenever you want to work again with your ‘flectra-venv’ environment:
$ workon flectra-venv
The full documentation on how to use Flectra with Docker can be found on the offcial Flectra docker image page.