10.2. Configurare il sistema¶
Contenuti
10.2.1. Configurazione del Database (PostgreSQL)¶
10.2.1.1. Creare il database¶
Creare un utente (role) sanet e un database sanet3 con encoding 'utf8':
CREATE ROLE sanet LOGIN PASSWORD 'sanet'; CREATE DATABASE sanet3 OWNER sanet ENCODING 'utf8'; GRANT ALL ON DATABASE sanet3 to sanet;
10.2.1.1.1. Debian 9¶
# su postgres # psql -U postgres CREATE ROLE sanet LOGIN PASSWORD 'sanet'; CREATE DATABASE sanet3 OWNER sanet ENCODING 'utf8'; GRANT ALL ON DATABASE sanet3 to sanet;
10.2.1.2. Permessi e autorizzazioni di accesso al database (opzionale)¶
Assicurarsi che le Postgres accetti connessioni dai processi con le opportune autorizazioni modificando il file di postgres:
pg_hba.conf
Importante: per rendere effettive le modifiche riavviare postgres:
/etc/init.d/postgres restart
10.2.1.2.1. Debian 9¶
Modificare e':
/etc/postgresql/<versione>/main/pg_hba.conf
Per garantire accesso a tutte le applicazioni locali accertarsi che il file contenga questa riga:
local all all trust
10.2.2. Configurare Redis Server¶
Le impostazioni di default di Redis non richiedono variazioni.
10.2.3. Configurare gli RRDTOOLS¶
Il pacchetto base di rrdtool non richiede configurazioni particolari.
Se e' stato installato RRDCACHED si rimanda alla sezione in appendice rrdcached.
10.2.4. Variabili d'ambiente globali (opzionale)¶
10.2.4.1. BIN tools¶
Assicurarsi che la directory "bin" sia nel vostro PATH:
export PATH=$PATH:{{SANET_INSTALL_DIR}}/bin
10.2.4.2. Configure Sanet server configuration¶
Create a new configuration file:
cd {{SANET_INSTALL_DIR}}
./install/post_install_create_settings.sh conf/settings.py
Or manually edit:
cd conf
cp settings.py.dist settings.py
You MUST set database connection settings propertly in conf/settings.py :
from conf.default_settings import * # Django settings for netsentry_webui project. DEBUG = False TEMPLATE_DEBUG = DEBUG DATABASES = { 'default': { 'ENGINE' : DEFAULT_DATABASE_BACKEND, 'HOST' : 'localhost', 'PORT' : '5432', 'NAME' : 'sanet3', 'USER' : 'sanet', 'PASSWORD': 'sanet', } }
10.2.4.3. Init Sanet Server database and files¶
Initialize sanet internal database configuration:
sanet-manage sanetdata
Or:
cd /opt/sanet
python manage.py sanetdata