Debian Tutorials

Debian Tutorials


Step by step tutorials showing you how to install and configure various applications and services on Debian based Linux distros.

March 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Categories


Setup PostgreSQL database system

adminadmin

PostgreSQL is a powerful, open source object-relational database system. It has more than 15 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 (pico /etc/postgresql/7.4/main/postgresql.conf):

tcpip_socket = true

If managing on Windows I recommend using the EMS SQL Manager

4. Allow connections from you IP address or a range (pico /etc/postgresql/7.4/main/pg_hba.conf)

host all all 85.234.0.0 255.255.0.0 trust

Using this code I enabled the 85.234.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.

Comments 0
There are currently no comments.