.. _sanet-system-configuration: ########################################################################################## System configuration ########################################################################################## .. contents:: :depth: 2 .. _configuration-postgres: Database configuration (PostgreSQL) ================================================================================================ Create database ------------------------------------------- Create a role *sanet* and a database *sanet3* with encoding 'utf8': :: CREATE ROLE sanet LOGIN PASSWORD 'sanet'; CREATE DATABASE sanet3 OWNER sanet ENCODING 'utf8'; GRANT ALL ON DATABASE sanet3 to sanet; Debian 9 ~~~~~~~~~~~~~~~~~~~~~~~~ Lauch Postgres's shell as *postgres* user: :: # su postgres # psql -U postgres Enter: :: CREATE ROLE sanet LOGIN PASSWORD 'sanet'; CREATE DATABASE sanet3 OWNER sanet ENCODING 'utf8'; GRANT ALL ON DATABASE sanet3 to sanet; .. # # 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 # # # Debian 9 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Modificare e': # # :: # # /etc/postgresql//main/pg_hba.conf # # Per garantire accesso a tutte le applicazioni locali accertarsi che il file contenga questa riga: # # :: # # local all all trust .. _configuration-redis: Configure Redis Server =============================================================================================== Redis Server does not require any change to default settings. .. _configuration-rrdtools: Configure RRD Tools =============================================================================================== RRD Tools not require special configurations. .. #If you installed the RRDCached daemon, read :ref:`rrdcached`. Optional configurations ========================================================================================== .. # Environment Variables (optional) # -------------------------------------------------- # # You can define in your environemnt the variable SANET_HOME. # # SANET will search for files and data inside this directory: # # :: # # {{SANET_INSTALL_DIR}}/var # # # .. warning:: be sure your SANET_HOME is valid and define for every execution context you need (Apache, Crontab, Shell, ecc.) BIN tools ----------------------------------------- Be sure to include the "bin" directory in your PATH: :: export PATH=$PATH:{{SANET_INSTALL_DIR}}/bin Configure Sanet's server ======================================================================== Create config file ------------------------------------------ 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', } } Init Sanet Server database and files -------------------------------------------------------------------------------------------------------------------------------------------- Initialize Sanet's internal database configuration: :: sanet-manage sanetdata Or: :: cd {{SANET_INSTALL_DIR}} python manage.py sanetdata