Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Configurer le serveur PostgreSQL
#1


    Configure PostgreSQL server

   

Configure your PostgreSQL server to allow other systems to access the database remotely. To do this, let the server listen to all IP addresses by modifying the configuration file.


   

Before continuing, use the exit command to exit the PostgreSQL prompt and return as a normal system user. Then follow these steps:


   
           
  1. Open the configuration file using a text editor. Replace vim if you are using another editor and change the directory accordingly:
  2.        
    vim /etc/postgresql/14/main/postgresql.conf
           
  3. Look for the line listen_addresses.
  4.        
  5. Remove the # symbol and change the value to an asterisk. This is what it should look like:
  6.        
    listen_addresses = '*'
           
  7. Utilisez la commande :wq pour enregistrer les modifications et quitter vim.
  8.        
  9. Définissez la politique d'accès pour authentifier la connexion des clients à votre serveur PostgreSQL. Pour ce faire, ouvrez le fichier pg_hba.conf dans le même répertoire à l'aide de vim. La commande devrait ressembler à ceci :
  10.        
    vim /etc/postgresql/14/main/pg_hba.conf
           
  11. Ajoutez une nouvelle règle en bas du fichier en utilisant cette syntaxe :
  12.        
    connexion base_de_données utilisateur adresse_ip cryptage
           
  13. For example, we will allow all TCP/IP connections from all users to all PostgreSQL databases. These users can use any IP address with an MD5 encrypted password. The rule looks like this:
  14.        
    host all all 0.0.0.0/0 md5
           
  15. Restart the PostgreSQL service to apply the changes.
  16.    

   

   

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)