Saturday, May 17, 2025

Installation of PostgreSQL

Install through apt:

[root@localhost ~]# apt update
[root@localhost ~]# apt upgrade
[root@localhost ~]# apt install postgresql
Configuration:

edit the file /etc/postgresql/15/main/pg_hba.conf replase the line

host    all         all         127.0.0.1/32          ident
with this one
host    all         all         127.0.0.1/32          md5

edit the file /etc/postgresql/15/main/postgresql.conf replase the line

#password_encryption = scram-sha-256    # scram-sha-256 or md5
with this one
password_encryption = md5
Enable and restart PostgreSQL server:
[root@localhost ~]# systemctl enable postgresql
[root@localhost ~]# systemctl restart postgresql
Logon into the PostgreSQL server:
[root@localhost ~]# su postgres
bash-4.2$ psql postgres
psql (15.12 (Debian 15.12-0+deb12u2))
Type "help" for help.

postgres=#
Create PostgreSQL user:
postgres=# CREATE USER vpnttg SUPERUSER;
CREATE ROLE
postgres=# ALTER USER vpnttg PASSWORD 'vpnttgpass';
ALTER ROLE
Check of PostgreSQL users:
postgres=# SELECT * FROM pg_shadow;
 usename  | usesysid | usecreatedb | usesuper | userepl | usebypassrls |               passwd                | valuntil | useconfig 
----------+----------+-------------+----------+---------+--------------+-------------------------------------+----------+-----------
 postgres |       10 | t           | t        | t       | t            |                                     |          | 
 vpnttg   |    16384 | f           | t        | f       | f            | md51e612cc18343323e2e462b39c92506aa |          | 
(2 rows)

postgres=# 
Logout from the PostgreSQL server:
postgres=# \q
bash-4.2$ exit
[root@localhost ~]#
Create of VPNTTG DB:
[root@localhost ~]# export PGPASSWORD=vpnttgpass
[root@localhost ~]# createdb vpnttgdb -h 127.0.0.1 -U vpnttg
List of PostgreSQL databases:
[root@localhost ~]# psql -l -h 127.0.0.1 -U vpnttg
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 vpnttgdb  | vpnttg   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
(4 rows)

[root@localhost ~]# 
 

Installation of VPNTTG

Download:

Download the i386.deb or amd64.deb file(s) and save it to disk.



Installation:

[root@localhost ~]# dpkg -i vpnttg_2.4-9_<architecture>.deb

optional

edit the file /stats/vpnttg/etc/vpnttg_db.conf to change vpnttg user password

don't forget to change vpnttg user password in the database too!

Initialization of vpnttgdb database:

[root@localhost ~]# export PGPASSWORD=vpnttgpass
[root@localhost ~]# psql vpnttgdb -h 127.0.0.1 -U vpnttg < /stats/vpnttg/sql/vpnttgdb_schema.sql
[root@localhost ~]# psql vpnttgdb -h 127.0.0.1 -U vpnttg < /stats/vpnttg/sql/vpnttgdb_data.sql
   

Installation of Apache Web Server

Install through apt:

[root@localhost ~]# apt update
[root@localhost ~]# apt upgrade
[root@localhost ~]# apt install apache2
Configuration:
[root@localhost ~]# /sbin/a2enmod ssl
[root@localhost ~]# /sbin/a2enmod rewrite
[root@localhost ~]# /sbin/a2enmod cgi
[root@localhost ~]# /sbin/a2ensite default-ssl
[root@localhost ~]# /sbin/a2ensite vpnttg.conf
Enable and restart the web server:
[root@localhost ~]# systemctl enable apache2
[root@localhost ~]# systemctl restart apache2
   

Change Timezone

To find list of all available time zones, run:
[root@localhost ~]# timedatectl list-timezones
The syntax is as follows to set timezone and need to run as root user:
[root@localhost ~]# timedatectl set-timezone time_zone
In this example, set timezone to America/Chicago
[root@localhost ~]# timedatectl set-timezone America/Chicago
Verify new settings by typing the following two commands:
[root@localhost ~]# date
Sun Jun 18 15:25:03 CDT 2017
[root@localhost ~]# ls -l /etc/localtime 
lrwxrwxrwx 1 root root 37 Jun 18 15:24 /etc/localtime -> ../usr/share/zoneinfo/America/Chicago
[root@localhost ~]#
Change the TimeZone setting in /etc/postgresql/15/main/postgresql.conf to the value you want:
log_timezone = 'America/Chicago'
timezone = 'America/Chicago'
After that you need to restart the service:
[root@localhost ~]# systemctl restart postgresql
   

Get a license key

use this form to request a free one month evaluation license key and install it:

  1. Click on the Upload button
  2. key_upload_1
  3. Choose license key file and then click the Open button:
  4. key_upload_2
  5. After uploading check the license status
  6. key_upload_3