meta données pour cette page
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| postgresql:installation_postgresql16 [16/01/2026 14:30] – mdl | postgresql:installation_postgresql16 [22/01/2026 13:17] (Version actuelle) – mdl | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | ====== Installation PostGreSQL 16 ====== | + | ====== |
| == Environnement: | == Environnement: | ||
| Ligne 9: | Ligne 9: | ||
| * Datafiles: /u02 => 15GB | * Datafiles: /u02 => 15GB | ||
| * WAL: /u07 => 5GB | * WAL: /u07 => 5GB | ||
| + | |||
| + | == Prerequis == | ||
| + | |||
| + | <code bash> | ||
| + | [root@postgre1 ~]# dnf install cifs-utils | ||
| + | </ | ||
| == Préparation des FS == | == Préparation des FS == | ||
| Ligne 40: | Ligne 46: | ||
| [root@postgre1 ~]# mount -a | [root@postgre1 ~]# mount -a | ||
| + | |||
| + | [root@postgre1 ~]# chown postgres: | ||
| </ | </ | ||
| Ligne 91: | Ligne 99: | ||
| postgresql16-server.x86_64 | postgresql16-server.x86_64 | ||
| + | </ | ||
| + | * création user postgres | ||
| + | <code bash> | ||
| + | [root@postgre1 ~]# groupadd postgres | ||
| + | [root@postgre1 ~]# useradd -g postgres -G postgres -d / | ||
| + | [root@postgre1 ~]# chown postgres: | ||
| </ | </ | ||
| + | |||
| + | * ajout variables environnement custom | ||
| + | <code bash> | ||
| + | [root@postgre1 ~]# vi / | ||
| + | |||
| + | # .bashrc | ||
| + | |||
| + | # Source global definitions | ||
| + | if [ -f /etc/bashrc ]; then | ||
| + | . /etc/bashrc | ||
| + | fi | ||
| + | |||
| + | # User specific environment | ||
| + | if ! [[ " | ||
| + | then | ||
| + | PATH=" | ||
| + | fi | ||
| + | export PATH | ||
| + | |||
| + | # Uncomment the following line if you don't like systemctl' | ||
| + | # export SYSTEMD_PAGER= | ||
| + | |||
| + | # User specific aliases and functions | ||
| + | if [ -d ~/.bashrc.d ]; then | ||
| + | for rc in ~/ | ||
| + | if [ -f " | ||
| + | . " | ||
| + | fi | ||
| + | done | ||
| + | fi | ||
| + | |||
| + | |||
| + | unset rc | ||
| + | |||
| + | # Postgres ENV Variables | ||
| + | export PGDATA=/ | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| * installation du moteur | * installation du moteur | ||
| Ligne 154: | Ligne 208: | ||
| - | * personnalisation user postgres | + | |
| - | <code bash> | + | |
| - | [root@postgre1 ~]# mkdir / | + | |
| - | [root@postgre1 ~]# chown postgres: | + | |
| - | </ | + | |
| == Initialisation du moteur dans un répertoire custom == | == Initialisation du moteur dans un répertoire custom == | ||
| Ce script permet de générer le dictionnaire et les vues système | Ce script permet de générer le dictionnaire et les vues système | ||
| <code BASH> | <code BASH> | ||
| + | [postgres@postgre1 ~]$ mkdir -p / | ||
| + | [postgres@postgre1 ~]$ mkdir -p / | ||
| [postgres@postgre1 ~]$ / | [postgres@postgre1 ~]$ / | ||
| </ | </ | ||
| Ligne 219: | Ligne 271: | ||
| [root@postgre1 ~]# systemctl start postgresql | [root@postgre1 ~]# systemctl start postgresql | ||
| </ | </ | ||
| + | |||
| + | |||
| + | == Paramétrage du moteur == | ||
| + | |||
| + | * personnalisation conf | ||
| + | <code bash> | ||
| + | [root@postgre1 ~]# vi / | ||
| + | | ||
| + | [...] | ||
| + | # - Connection Settings - | ||
| + | |||
| + | listen_addresses = ' | ||
| + | # comma-separated list of addresses; | ||
| + | # defaults to ' | ||
| + | # (change requires restart) | ||
| + | port = 5432 # (change requires restart) | ||
| + | |||
| + | |||
| + | [root@postgre1 ~]# systemctl restart postgresql | ||
| + | [root@postgre1 ~]# ll / | ||
| + | total 8 | ||
| + | -rw-------. 1 postgres postgres | ||
| + | -rw-------. 1 postgres postgres 1957 16 janv. 16:27 postgresql-Fri.log | ||
| + | |||
| + | </ | ||
| + | |||
| + | == Ouverture port 5432 sur le firewall == | ||
| + | |||
| + | <code bash> | ||
| + | [root@postgre1 ~]# firewall-cmd --add-port=5432/ | ||
| + | success | ||
| + | [root@postgre1 ~]# firewall-cmd --reload | ||
| + | success | ||
| + | [root@postgre1 ~]# firewall-cmd --list-all | ||
| + | public (active) | ||
| + | target: default | ||
| + | icmp-block-inversion: | ||
| + | interfaces: enX0 | ||
| + | sources: | ||
| + | services: cockpit dhcpv6-client ssh | ||
| + | ports: 5432/tcp | ||
| + | protocols: | ||
| + | forward: yes | ||
| + | masquerade: no | ||
| + | forward-ports: | ||
| + | source-ports: | ||
| + | icmp-blocks: | ||
| + | rich rules: | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | == Ouverture accès au client sur le moteur == | ||
| + | Pour qu'un client accède à l' | ||
| + | |||