Install PostgreSQL
1 |
sudo apt-get install postgresql postgresql-contrib |
Server Setup
Set Password
1 2 3 4 |
sudo -u postgres psql postgres \password postgres \q exit |
Create DB
1 |
sudo -u postgres createdb avinton |
Allow Remote Access to DB
Edit the hba.conf file for allowing remote access – located in the folder:
1 |
/etc/postgresql//main |
Lets allow access to our database from same network hosts only:
1 |
sudo vi /etc/postgresql/9.5/main/pg_hba.conf |
Lets enable the posgresql server to listen for incoming connections:
1 |
sudo vi /etc/postgresql/9.5/main/postgresql.conf |
Restart PostgreSQL Server
1 2 |
service postgresql stop service postgresql start |
Check if service is running:
1 |
service postgresql status |
Connect to DB from PGAdmin on host
Install PGAdmin on your host machine (PC or Mac)
https://www.pgadmin.org/download/
Add new connection:
Enter connection details: (Password is what you set earlier)
If you get some error double check you followed the steps <Allow Remote Access to DB>
Also make sure if you are using a VM that your VM network is set to “Bridged” in VirtualBox or VMWare.