How To install and setup PostgreSQL 9.6 on Debian Linux 9

ht‮/:spt‬/www.lautturi.com
How To install and setup PostgreSQL 9.6 on Debian Linux 9

To install and set up PostgreSQL 9.6, a popular open-source object-relational database management system, on Debian Linux 9, follow these steps:

  1. Add the PostgreSQL package repository to your system's package sources by running the following command:
echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
  1. Import the repository signing key by running the following command:
wget --quiet -O - https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
  1. Update the package manager's package list:
sudo apt update
  1. Install PostgreSQL 9.6 by running the following command:
sudo apt install postgresql-9.6

This will install PostgreSQL 9.6 and any dependencies required.

  1. To verify that the installation was successful, run the following command:
psql --version

This will display the version of PostgreSQL that was installed.

  1. To create a new PostgreSQL database cluster, run the following command:
sudo pg_createcluster 9.6 main --start

This will create a new database cluster using PostgreSQL 9.6 and start it.

  1. To access the PostgreSQL command-line interface, run the following command:
sudo -u postgres psql

This will open the PostgreSQL interactive terminal, allowing you to run SQL commands and interact with the database.

Created Time:2017-10-16 14:38:44  Author:lautturi