11.) Now that we've updated the authorization settings for the pg_hba.conf file we need to update PostgreSQL to enable remote connections to the database.
This is done through the postgresql.conf file.
At the command line enter command below:
$ sudo vim/var/lib/psql9/data/postgresql.conf
12.) We will need to change a couple of settings by uncommenting them and changing some of the values.
We will need to uncomment and edit a few lines:
Look for #listen_addresses = 'localhost'
It should be at around line 58 to 60 depending on your installation.
After you find it change it.
from: #listen_addresses = 'localhost'
to: listen_addresses=' * '
Now look for #port = 5432
It should be at around line 63 to 65 depending on your installation.
After you find it change it.
from: #port = 5432
to: port = 5432
13.) You will now need to start the PostgreSQL service.
Run the command below to start the service:
$ sudo service postgresql start
14.) You will now need to log into the server:
At the command prompt enter these commands in the following order:
$ sudo su - postgres - [This will place you at the bash shell]
-bash-4.2$
At the bash shell enter the command:
-bash-4.2$ psql -U postgres
If you are successful you will be at the PostgreSQL shell.
postgres=#
15.) Now that you are logging as the user 'postgres'
for the first time you will need to change your password.
Enter the command below at the 'postgres=#' shell to change the password:
ALTER USER user_name WITH PASSWORD 'new_password';