Base install and setup PostgreSQL - Debian/Ubuntu
PostgreSQL is a powerful, open source object-relational database system. It has more than 16 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness.
1. Install packages
apt-get install postgresql postgresql-client
2. Create a user
// Change to the postgres linux user and create the actual user su postgres createuser user1
Using the default template allow the user and set password
psql template1
alter user aip password ‘password’
That’s actually all you need to install and create the firt user. Follow the remaining steps to allow remote access to the PostgreSQL server.3. Enable TCP/IP connections to the server to be able to manage by a remote client. Edit this line in the main PostgreSQL config file (nano /etc/postgresql/7.4/main/postgresql.conf):
tcpip_socket = true
4. Allow connections from you IP address or a range (pico /etc/postgresql/7.4/main/pg_hba.conf)
host all all 46.36.0.0 255.255.0.0 trust
Using this code I enabled the 46.36.0.0/255.255.0.0 IP range to connect to the server. Make sure you allow as few IP addresses as possible.
You’re all set. Make sure the port 5432 is open in all firewalls to be able to remote manage the server.