PostgreSQL
Required packages
apt-get install postgresql postgresql-doc
Configuration
Edit the server configuration file
vim /etc/postgresql/xxx/main/
Adjust the access rights, at the end:
########
# USER access
########
# Allow postgresql super administrator login, using password
local all postgres md5
# Allow other users connection
local all all trust
########
# IP@ filtering
#######
### No password required
# Enable localhost
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
# Enable specific host(s)
host all all 172.16.100.62/32 trust
### Forbid remote connection for non-trusted locations
host all pgdba 0.0.0.0/0 reject
### Password required
# Local network
host all all 172.16.100.0/24 md5
# Specific host(s)
host all all 5.39.81.23/32 trust
### Reject other incoming connections
host all all 0.0.0.0/0 reject
References
- Very good explanation of access restrictions and configuration: http://www.depesz.com/2007/10/04/ident/
- Setup example: http://technobytz.com/install-postgresql-9-3-ubuntu.html