4.1 Installing and Configuring the PostgreSQL Database on a Linux Server

4.1.1 Minimum Requirements

  • Any of the following 64-bit versions of PostgreSQL with the latest service packs:

    • 9.2

    • 9.3

    • 9.4

    • 9.5

  • Any of the following 64-bit Linux server hosts with the latest support packs:

    • SUSE Linux Enterprise Server 11 SP3

    • SUSE Linux Enterprise Server 11 SP4

    • SUSE Linux Enterprise Server 12

    • SUSE Linux Enterprise Server 12 SP1

    • SUSE Linux Enterprise Server 12 SP2

    • Open Enterprise Server 11 SP2

    • Open Enterprise Server 2015

    • Open Enterprise Server 2015 SP1

    • CentOS7

    • Red Hat Linux Enterprise Sever 7

  • Minimum of 16 GB of RAM

    Depending on size and frequency of your scans, this amount might need to be significantly increased.

  • Minimum of 150 MB of disk space

    Depending on the size and frequency of your scans, this amount might need to be significantly increased.

4.1.2 Installing and Configuring the PostgreSQL Database

  1. On the Linux server host, install PostgreSQL from the distribution repository by typing:

    zypper in postgresql94-server postgresql94-contrib and press Enter.

    Accept the dependencies.

  2. Switch the user to PostgreSQL by typing:

    su - postgres and press Enter.

  3. Initialize the database by typing:

    initdb and press Enter.

  4. Start the database by typing:

    pg_ctl start and press Enter.

  5. Run the PostgreSQL command line client by typing:

    psql and press Enter.

  6. Type the following to change the PostgreSQL user password:

    alter user postgres password 'postgres'; and press Enter.

    If the password change was successful, you will see ALTER ROLE appear.

  7. Type the following to quit:

    \q and press Enter.

4.1.3 Set Up PostgreSQL to Accept Remote Database Connections

  1. Add the following line to the /var/lib/pgsql/data/pg_hba.conf file:

    host all all 0.0.0.0/0 md5

  2. In the /var/lib/pgsql/data directory, create a new file named ccpostgresql.conf.

  3. In the ccpostgresql.conf file, add the following lines:

    listen_addresses = '*'

    port = 5432

    shared_buffers = 1968MB

    effective_cache_size = 3936MB

    checkpoint_segments = 32

    Listen address should contain the IP Address of the server, or list ‘*’ for all addresses.

    The PostgreSQL daemon listens on port 5432 by default.

    Shared Buffers is calculated to one quarter (1/4) of the system memory.

    Effective Cache Size is calculated to one half (1/2) of the system memory.

    Checkpoint Segments are part of the Write-Ahead-Logging used by postgresql to one help recover in the event of a disaster, and two speed up how fast the database can be written to. With 16GB of memory you may need more than 64 segments.

  4. Include the ccpostgresql.conf file as part of the postgres configuration by typing:

    echo include \'ccpostgresql.conf\' >> postgresql.conf

  5. Restart the database by typing:

    pg_ctl restart and press Enter.

  6. Type the following to log out the postgreSQL user:

    exit