Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Configure PostgreSQL Server
#1


    Configure PostgreSQL Server

   

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


   

Before proceeding, use the exit command to quit the PostgreSQL shell and return as the regular system user. Then, follow these steps:


   
           
  1. Open the configuration file using a text editor. Replace vim if you use another editor and change the directory accordingly:
  2.        
    vim /etc/postgresql/14/main/postgresql.conf
           
  3. Find the listen_addresses line.
  4.        
  5. Remove the # symbol and change the value to an asterisk. Here’s how it should look:
  6.        
    listen_addresses = '*'
           
  7. Use the :wq command to save the changes and quit vim.
  8.        
  9. Set the access policy to authenticate client connection to your PostgreSQL server. To do so, open the pg_hba.conf file in the same directory using vim. The command should look like this:
  10.        
    vim /etc/postgresql/14/main/pg_hba.conf
           
  11. Add a new policy at the bottom of the file using this syntax:
  12.        
    connection database user ip_address encryption
           
  13. For instance, we will enable all TCP/IP connections from all users to every PostgreSQL database. These users can use any IP address with an MD5-encrypted password. The rule looks as follows:
  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)