You will need to install Ubuntu on your virtual host, I used VMware Workstation Player and ubuntu-17.10.1-server-amd64.iso
I called my instance ‘Ubuntu PSQL’ and used carl/carl username and password for authentication. Once the VM is running you can install postgresql:
1 | sudo apt-get update |
You can then putty to the server, this is easier as you can paste commands.
To check the PostgreSQL server is running you can query it with psql –version
All of my examples below were on version 9.6
1 | #Check the PSQL version |
Configuration updates
The following configuration updates will be needed, I used nano to edit the files but you can use any other editor such as vi
pg_hba.conf
Set the METHOD to ‘trust’ under ‘# Database administrative login by Unix domain socket’
1 | sudo nano /etc/postgresql/9.6/main/pg_hba.conf |
You can also restrict access by IP or IP range:
Example:
1 | 192.168.0.254/32 = ip address of 192.168.0.254 |
Also see Subnet mask
Allow all connections:
1 | -- allow the lot |
postgresql.conf
Set the the following:
1 | sudo nano /etc/postgresql/9.6/main/postgresql.conf |
Update password
You can update the root password
1 | #set password |
Tail logs
1 | tail -f /var/log/postgresql/postgresql-9.6-main.log |
Backup & Restore
See putty if you need to copy a dump file to the server from your windows PC.
1 | //Create the dump file |