Installation¶
Note
As a reminder, switching to root on Debian machines must be done with the following command:
1 | |
The instructions provided on this page should be followed for the installation of all nodes in the PostgreSQL cluster.
Systems settings¶
Connection to the machine¶
By default, there are two accounts on virtual appliances: a user account and a super-user account.
- User account
- Login :
systancia - Password:
systnci
- Login :
- Super-user account
- Login :
root - Password:
systnci
- Login :
Connect to the machine in console mode.
Note
The default keyboard layout is QWERTY.
Modification of the keyboard layout¶
You can change the keyboard layout with the following command line:
1 | |
A menu appears to allow you to choose another keyboard layout.
Then use the following command line to apply and save the settings:
1 | |
The settings will take effect immediately after this command is executed.
Configuration of the network¶
The virtual appliance may not receive a network configuration when it starts up for the following reasons:
- The network interface name is not
ens192: the appliance is configured for DHCP only on theens192interface - No DHCP server is available
To check the network interface name, its status, and the assigned IP addresses, run the following command as root:
1 | |
Example
After executing the command, the following response is displayed:
1 | |
The name of the network interface in the example is ens192, the interface is active and has the IP address 10.100.0.51/24.
If the name is different from ens192 or if the command does not return any network settings, you will need to configure the network manually using the following commands:
1 2 | |
Replace:
IP_ADDRESSby the machine's IP addressSUBNETby the subnetworkDEV_NAMEname of the previously retrieved network interfaceGATEWAYby the network gateway
Example
To configure the PostgreSQL node with the following information:
- IP address:
10.100.0.51 - Sub-network:
/24or255.255.255.0 - Network interface name:
eth0 - Network gateway:
10.100.0.254
The commands are as follows:
1 2 | |
Note
This network configuration is temporary, therefore any server restart will reset the manual settings made with the ip address and ip route commands.
Permanent configuration will be performed by the PostgreSQL cluster configuration utility.
However, thanks to this network configuration, you can now access the PostgreSQL node via SSH.
Modification of the time zone¶
By default, the virtual appliance is set to the Europe/Paris time zone.
To change this time zone, first use the following command to retrieve the syntax of available time zones:
1 | |
Then use the following command line:
1 | |
Example
To set the time zone to London, the following command must be executed:
1 | |
Check the server's time zone using the following command line:
1 | |
Configuration of an NTP time server¶
Danger
It is strongly recommended that you configure a time server to keep the system clock up to date: any time difference between PostgreSQL nodes may cause instability or even cause the cluster to stop working.
The necessary steps are described on the NTP configuration page (the configuration is equivalent to that of cyberelements Cleanroom Mediation Controller servers).
Creating a PKI to generate PostgreSQL node certificates¶
Information
This section is optional if you already have a PKI from which you have been able to generate the certificates indicated in the prerequisites.
This section will present the various steps for creating a PKI and the certificates required for the PostgreSQL cluster. Note that it will not be indicated how to renew them, as the renewal of a certificate involves its re-creation.
Attention!
The procedure described has been validated on a Debian 12 machine with the openssl package. However, any machine with a recent version of OpenSSL (the validated version being 3.0.17) will be able to complete the procedure. Except for Windows or MacOS where the system commands will have to be adapted.
Definition of variables and customizations¶
This section provides various commands and configuration files that use variables that can be modified.
The table below summarizes all the values and allows you to define them so that you can modify them directly in the commands displayed on this page.
| Value | Variable | Definition |
|---|---|---|
PSQL_IP |
Virtual IP address of the PostgreSQL cluster. | |
PSQL_NAME |
Short name (not the FQDN) associated with the virtual IP address of the PostgreSQL cluster. | |
PSQL_1_IP |
IP address of the PostgreSQL cluster node n°1. | |
PSQL_1_NAME |
Short name (not the FQDN) of the PostgreSQL cluster node n°1. | |
PSQL_2_IP |
IP address of the PostgreSQL cluster node n°2. | |
PSQL_2_NAME |
Short name (not the FQDN) of the PostgreSQL cluster node n°2. | |
PSQL_3_IP |
IP address of the PostgreSQL cluster node n°3. | |
PSQL_3_NAME |
Short name (not the FQDN) of the PostgreSQL cluster node n°3. | |
CA_ROOT_NAME |
Name assigned to the root certification authority (CA) of the PKI. |
Preparation¶
The following actions will be performed in a new directory in order to gather all the new files in a single directory. Any directory can be used, but its access must be limited as much as possible. *Log in to PostgreSQL node n°1 as root and run the following commands:
1 2 3 | |
Creation of the root certification authority¶
Run the following command to create a new root CA. You will be prompted for a password to protect the CA:
1 | |
Replace CA_ROOT_NAME with the name of the root CA if you haven't customized it here.
Creation of certificates¶
The commands required to generate certificates for PostgreSQL nodes are as follows:
1 2 3 | |
Replace CA_ROOT_NAME, PSQL_IP, PSQL_NAME, PSQL_1_IP and PSQL_1_NAME if you haven't customized it here.
1 2 3 | |
Replace CA_ROOT_NAME, PSQL_IP, PSQL_NAME, PSQL_2_IP and PSQL_2_NAME if you haven't customized it here.
1 2 3 | |
Replace CA_ROOT_NAME, PSQL_IP, PSQL_NAME, PSQL_3_IP and PSQL_3_NAME if you haven't customized it here.
The first command creates a new key, the second generates a certificate signing request CSR file, and the third creates the certificate itself.
The certificate still needs to be converted to P12, which will require you to set a password:
1 | |
1 | |
1 | |
The files required to install the PostgreSQL cluster can be found here (please replace the variables CA_ROOT_NAME, PSQL_1_NAME, PSQL_2_NAME, and PSQL_3_NAME with the values you selected earlier):
/root/psql-certificates/CA_ROOT_NAME.crt: certificate of the root CA/root/psql-certificates/PSQL_1_NAME.p12: certificate for the PostgreSQL node n°1/root/psql-certificates/PSQL_2_NAME.p12: certificate for the PostgreSQL node n°2/root/psql-certificates/PSQL_3_NAME.p12: certificate for the PostgreSQL node n°3
Installation of a PostgreSQL cluster¶
Information
The following steps must be performed on all three PostgreSQL nodes.
Preparation for the configuration of the PostgreSQL cluster¶
It is necessary to establish an SFTP or SCP connection in order to send to the appliance:
- The certificate from the certification authority that signed the certificates for the PostgreSQL nodes
- The PostgreSQL node certificate in
P12format
Please note that SFTP or SCP connections cannot be initialized using the root account. In addition, files can simply be placed in /home/systancia/.
It is necessary to move these files to a new directory:
1 2 3 | |
Replace:
PSQL_?_NAMEwith the name of the certificate intended for the PostgreSQL node being installedROOT_CA_NAMEwith the name of the root certificate authority's certificate
1 2 3 | |
The commands above must have been customized according to the customization settings.
1 2 3 | |
The commands above must have been customized according to the customization settings.
1 2 3 | |
The commands above must have been customized according to the customization settings.
Configuration of the PostgreSQL node¶
To start initializing the node configuration, the following commands must be executed:
1 2 | |
The second command will launch a utility that will require the following information:
- New passwords for the
rootandsystancialocal users - Name of the PostgreSQL node (not the FQDN)
- The IP address of the PostgreSQL node, the name of its network interface, the default network gateway to use, as well as the DNS servers and DNS suffix
- The version of PostgreSQL; we recommend using version
15 - The access port to the PostgreSQL cluster; we recommend using port
5432 - Password for the PostgreSQL account used for replication and for
pg_rewind - Name and IP address of a second PostgreSQL node
- Name and IP address of the last PostgreSQL node
- Virtual IP address of the PostgreSQL cluster
- The IP addresses (separated by commas) of the cyberelements Cleanroom Edge Gateways or any other machines that need to connect to the cluster
- Name and password of the PostgreSQL user account
- The IP addresses or networks (separated by commas) authorized to connect via SSH to PostgreSQL nodes
- Certificate information for the PostgreSQL node (node certificate in P12 format + root CA certificate)
After entering this information, a summary of all your entries will be provided before validation.
After confirming the information provided, a message will appear regarding changes to the /etc/ssh/sshd_config file. Please select the default option, keep the local version currently installed.
In order to apply the configuration, a restart is required:
1 | |
Tip for speeding up the installation of PostgreSQL nodes n°2 and n°3
After installing PostgreSQL node n°1, you can retrieve the configuration settings used to set it up from the /etc/cleanroom-vault.ini file.
Example of the /etc/cleanroom-vault.ini file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
Simply modify the highlighted lines with the values of the PostgreSQL node being installed, based on the file you retrieved from PostgreSQL node n°1.
Danger
If you reuse the example file, you will need to modify all of the following highlighted values according to your environment:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
Additional configurations for patronictl¶
To enable the use of PostgreSQL cluster management commands with patronictl, there are still a few commands that need to be run as root on the PostgreSQL node:
1 2 3 4 | |
Creation of the default database required for installing cyberelements Cleanroom¶
When installing cyberelements Cleanroom, you must first create a database named default.
To do this, fill out the following table to customize the command you will need to run from any single node in the PostgreSQL cluster:
| Value | Variable | Definition |
|---|---|---|
PSQL_VIP |
Virtual IP address of the PostgreSQL cluster. | |
DB_USER |
The database username specified during PostgreSQL node configuration |
Command to be executed from any of the nodes in the PostgreSQL cluster:
1 | |