<commit_before>=====================
Linux binary packages
=====================

* `Supported distributions`_
* `Installation and configuration`_
* `Debian installation script`_
* `Debian uninstallation script`_
* `Red Hat installation script`_

***********************
Supported distributions
***********************

Binary installation packages are available for:

* Ubuntu 18 LTS
* Red Hat Enterprise Linux 8 (Enterprise Edition only)
* CentOS 8 (Enterprise Edition only)
* Suse 15 (Enterprise Edition only)
* OpenSuse 15 (Enterprise Edition only)

Installing on other Linux distributions is also possible, but you'll first
need to build the frePPLe package from the source package as described
in a following page. The build and installation process are completely standardized
for `debian-based distributions <https://en.wikipedia.org/wiki/Category:Debian-based_distributions>`_
and `RPM-based based distributions <https://en.wikipedia.org/wiki/Category:RPM-based_Linux_distributions>`_.

******************************
Installation and configuration
******************************

The binary package installs the solver engine executables as well as the user
interface. The user interface is installed as a WSGI application deployed on
the Apache web server with the mod_wsgi module.

Here are the steps to get a fully working environment.

#. **Download the installation package**

   For installation on Linux you need a .deb (debian-based distributions) or 
   .rpm (Red Hat based distributions) package file.
   
   For the Community Edition these can be freely downloaded from 
   https://github.com/frePPLe/frepple/releases.
   
   For the Enterprise Edition you need to download these from the customer 
   portal on the frePPLe website https://frepple.com/customer-portal/downloads/
   
#. **Install and tune the PostgreSQL database**

   Install postgreSQL 9.5 or higher, the world's most advanced open source database.

   FrePPLe assumes that the database uses UTF-8 encoding.

   FrePPLe needs the following settings for its database connections. If these
   values are configured as default for the database (in the file postgresql.conf)
   or the database role (using the 'alter role' command), a small performance
   optimization is achieved:
   ::

       client_encoding: 'UTF8',
       default_transaction_isolation: 'read committed',
       timezone: 'Europe/Brussels'  # Value of TIME_ZONE in your djangosettings.py file

   FrePPLe can communicate with the PostgreSQL server using either a) Unix
   domain sockets ('local' in pg_hba.conf) or b) TCP IP4 or IP6 sockets.

   FrePPLe can authenticate on the PostgreSQL database using either a) a
   password ('<PASSWORD>' in pg_hba.conf) or b) OS username ('peer' and 'ident'
   in pg_hba.conf).

   In case of error (while creating the databases) "Postgres PG::Error: ERROR: new encoding (UTF8) is incompatible":
   ::

       UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
       DROP DATABASE template1;
       CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';
       UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
       \c template1
       VACUUM FREEZE;

#. **Tune the database**

   The default installation of PostgreSQL is not configured right for
   intensive use. We highly recommend using the pgtune utility (or its online
   version at http://pgtune.leopard.in.ua/) to optimize the configuration for your
   hardware.

#. **Create the database and database user**

   A database needs to be created for the default database, and one for each of
   the what-if scenarios you want to configure.

   The same user is normally used as the owner of these databases.

   The typical SQL statements are shown below. Replace USR, PWD, DB with the suitable
   values.
   ::

       create user USR with password '<PASSWORD>';
       create database DB encoding 'utf-8' owner USR;

#. **Install Python3 and pip3**

   You'll need to install the Python 3.4 or higher and ensure the pip3 command is available.
   Most Linux distributions provide python2 by default, and you'll need python3 in parallel
   with it.

   On RPM based distributions:
   ::

     dnf install python3 python3-pip

   On Debian based distributions:
   ::

     apt-get install python3 python3-pip

#. **Install the Python modules**
<commit_msg>doc update: make createrole permission clearer<commit_after>=====================
Linux binary packages
=====================

* `Supported distributions`_
* `Installation and configuration`_
* `Debian installation script`_
* `Debian uninstallation script`_
* `Red Hat installation script`_

***********************
Supported distributions
***********************

Binary installation packages are available for:

* Ubuntu 18 LTS
* Red Hat Enterprise Linux 8 (Enterprise Edition only)
* CentOS 8 (Enterprise Edition only)
* Suse 15 (Enterprise Edition only)
* OpenSuse 15 (Enterprise Edition only)

Installing on other Linux distributions is also possible, but you'll first
need to build the frePPLe package from the source package as described
in a following page. The build and installation process are completely standardized
for `debian-based distributions <https://en.wikipedia.org/wiki/Category:Debian-based_distributions>`_
and `RPM-based based distributions <https://en.wikipedia.org/wiki/Category:RPM-based_Linux_distributions>`_.

******************************
Installation and configuration
******************************

The binary package installs the solver engine executables as well as the user
interface. The user interface is installed as a WSGI application deployed on
the Apache web server with the mod_wsgi module.

Here are the steps to get a fully working environment.

#. **Download the installation package**

   For installation on Linux you need a .deb (debian-based distributions) or 
   .rpm (Red Hat based distributions) package file.
   
   For the Community Edition these can be freely downloaded from 
   https://github.com/frePPLe/frepple/releases.
   
   For the Enterprise Edition you need to download these from the customer 
   portal on the frePPLe website https://frepple.com/customer-portal/downloads/
   
#. **Install and tune the PostgreSQL database**

   Install postgreSQL 9.5 or higher, the world's most advanced open source database.

   FrePPLe assumes that the database uses UTF-8 encoding.

   FrePPLe needs the following settings for its database connections. If these
   values are configured as default for the database (in the file postgresql.conf)
   or the database role (using the 'alter role' command), a small performance
   optimization is achieved:
   ::

       client_encoding: 'UTF8',
       default_transaction_isolation: 'read committed',
       timezone: 'Europe/Brussels'  # Value of TIME_ZONE in your djangosettings.py file

   FrePPLe can communicate with the PostgreSQL server using either a) Unix
   domain sockets ('local' in pg_hba.conf) or b) TCP IP4 or IP6 sockets.

   FrePPLe can authenticate on the PostgreSQL database using either a) a
   password ('<PASSWORD>' in pg_hba.conf) or b) OS username ('peer' and 'ident'
   in pg_hba.conf).

   In case of error (while creating the databases) "Postgres PG::Error: ERROR: new encoding (UTF8) is incompatible":
   ::

       UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
       DROP DATABASE template1;
       CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';
       UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
       \c template1
       VACUUM FREEZE;

#. **Tune the database**

   The default installation of PostgreSQL is not configured right for
   intensive use. We highly recommend using the pgtune utility (or its online
   version at http://pgtune.leopard.in.ua/) to optimize the configuration for your
   hardware.

#. **Create the database and database user**

   A database needs to be created for the default database, and one for each of
   the what-if scenarios you want to configure.

   The same user can be used as the owner of these databases. Make sure to grant the 
   createrole permissions to the database user.

   The typical SQL statements are shown below. Replace USR, PWD, DB with the suitable
   values.
   ::

       create user USR with password '<PASSWORD>' createrole;
       create database DB0 encoding 'utf-8' owner USR;
       create database DB1 encoding 'utf-8' owner USR;
       create database DB2 encoding 'utf-8' owner USR;
       create database DB3 encoding 'utf-8' owner USR;

#. **Install Python3 and pip3**

   You'll need to install the Python 3.4 or higher and ensure the pip3 command is available.
   Most Linux distributions provide python2 by default, and you'll need python3 in parallel
   with it.

   On RPM based distributions:
   ::

     dnf install python3 python3-pip

   On Debian based distributions:
   ::

     apt-get install python3 python3-pip

#. **Install the Python modules**

{'fraction_non_alphanumeric': 0.09194638307300321, 'fraction_numerical': 0.008086850559432812, 'mean_word_length': 3.927947598253275, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3941500', 'n_tokens_mistral': 2472, 'n_tokens_neox': 2311, 'n_words': 1086}