So… After the first part (Link) where we talk about the installation,
the next step would be to create root user and to change postgres and root password.
[root@XTdata init.d]# su postgres bash-3.2$ createuser -s root bash-3.2$ createdb root --owner=root exit [root@XTdata data]# psql psql (9.2.4) Type "help" for help. root=# ALTER USER postgres WITH PASSWORD 'SomePAASWDe348'; ALTER ROLE root=# ALTER USER root WITH PASSWORD 'SomePAASWDe3489898'; ALTER ROLE root=# \q |
Now, the next step would be to allow remote connections.
postgresql.conf is the main PostgreSQL config file. To be able to reach the server remotely, find the commented line
#listen_addresses = 'localhost' # what IP address(es) to listen on; |
uncomment the line and replace the localhost with the servers IP address. (or replace it with * which means – listen on all interfaces)
listen_addresses = '*' # what IP address(es) to listen on; |
PostgreSQL, by default, refuses all connections it receives from any remote host. The remote hosts can be controled via pg_hba.conf file (located in the same dir like postgresql.conf).
Add the next line
host all all 192.168.10.57/32 md5 |
where 192.168.10.57 is the remote host IP address.
Also, you can allow any host by replacing the 192.168.10.57/32 with 0.0.0.0/0.
The line syntax is
local DATABASE USER METHOD [OPTIONS] host DATABASE USER ADDRESS METHOD [OPTIONS] hostssl DATABASE USER ADDRESS METHOD [OPTIONS] hostnossl DATABASE USER ADDRESS METHOD [OPTIONS] |
which is documented inside the pg_hba.conf. Save the file and restart the server.
I prefer the pgAdmin III tool which can be used for remote management. Fire it up, select File, Add Server… Enter name, host, Username and password.
This should be enough for now…