[go: up one dir, main page]

0% found this document useful (0 votes)
83 views7 pages

How To Install PostgreSQL 11 On Debian 9

This document provides steps to install PostgreSQL 11 on Debian 9 or Debian 8. It describes adding the PostgreSQL APT repository, installing PostgreSQL 11, enabling remote access by configuring the listen address, setting passwords for the default postgres admin user and a test database user, creating and accessing a test database and table, and confirming basic database functionality. The steps allow for installation of the latest version of the PostgreSQL open-source database on Debian systems.

Uploaded by

Albeiro Rojas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views7 pages

How To Install PostgreSQL 11 On Debian 9

This document provides steps to install PostgreSQL 11 on Debian 9 or Debian 8. It describes adding the PostgreSQL APT repository, installing PostgreSQL 11, enabling remote access by configuring the listen address, setting passwords for the default postgres admin user and a test database user, creating and accessing a test database and table, and confirming basic database functionality. The steps allow for installation of the latest version of the PostgreSQL open-source database on Debian systems.

Uploaded by

Albeiro Rojas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

11/8/2020 How to Install PostgreSQL 11 on Debian 9 / Debian 8 | ComputingForGeeks

How to Install PostgreSQL 11 on Debian 9 /


Debian 8
By Josphat Mutai - November 24, 2018

You can support us by downloading this article as PDF from the Link below.

 Download the guide as PDF

In this tutorial, we will cover how to Install PostgreSQL 11 on Debian 9 / Debian


8. PostgreSQL is a powerful, highly-extensible database server written in C. The
development of PostgreSQL is under PostgreSQL Global Development Group.

PostgreSQL provides an object-relational database system that allows you to manage


extensive datasets. PostgreSQL Server comes with features that guarantee fault-
tolerance and data integrity hence ready for heavy production use. Check PostgreSQL 11
release page for new features.

For  the installation of PostgreSQL 11 on CentOS / Fedora,  use the following links:

How to install PostgreSQL 11 on CentOS 7

How to install PostgreSQL 11 on Fedora 29 / Fedora 28

Below are the steps to install PostgreSQL 11 on Debian 9 / Debian 8.


Thank you for visiting. Support my
hard work with just a cup of coffee!
Step 1: Add PostgreSQL 11 APT repository
https://computingforgeeks.com/how-to-install-postgresql-11-on-debian-9-debian-8/ 1/7
11/8/2020 How to Install PostgreSQL 11 on Debian 9 / Debian 8 | ComputingForGeeks

Import the repository signing key:

sudo apt install -y vim wget


wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc

Then add the actual repository contents to your Debian 9 / Debian 8 system:

release -cs)
://apt.postgresql.org/pub/repos/apt/ ${RELEASE}"-pgdg main | sudo tee

The repository le contents should look like below

$ cat /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main

Step 2:  Install PostgreSQL 11 on Debian 9 / Debian 8

After adding the repository, proceed to install PostgreSQL 11 on Debian 9 / Debian 8.

sudo apt update


sudo apt -y install postgresql-11

Step 3: Enable remote access

By default, access to PostgreSQL database server is only from localhost.

$ sudo ss -tunelp | grep 5432


tcp LISTEN 0 128 127.0.0.1:5432 0.0.0.0:* users:((
Thank you for visiting. Support my
hard work with just a cup of coffee!
Edit PostgreSQL 11 con guration le to change listening address:

https://computingforgeeks.com/how-to-install-postgresql-11-on-debian-9-debian-8/ 2/7
11/8/2020 How to Install PostgreSQL 11 on Debian 9 / Debian 8 | ComputingForGeeks

sudo vim /etc/postgresql/11/main/postgresql.conf

Add below line under CONNECTIONS AND AUTHENTICATION section.

listen_addresses = '*'

You can also specify server IP Address

listen_addresses = '10.10.1.6'

See below screenshot.

Restart postgresql  after making a change

sudo systemctl restart postgresql


Thank you for visiting. Support my
Con rm the new PostgreSQL bind address: hard work with just a cup of coffee!

https://computingforgeeks.com/how-to-install-postgresql-11-on-debian-9-debian-8/ 3/7
11/8/2020 How to Install PostgreSQL 11 on Debian 9 / Debian 8 | ComputingForGeeks

$ sudo ss -tunelp | grep 5432


tcp LISTEN 0 128 0.0.0.0:5432 0.0.0.0:* use
tcp LISTEN 0 128 [::]:5432 [::]:* users:

If you have an active UFW rewall, allow port 5432

sudo ufw allow 5432/tcp

Step 4:  Set PostgreSQL admin user Password

Set a password for the default postgres admin user

$ sudo su - postgres
postgres@os1:~$ psql -c "alter user postgres with password 'StrongPa
ALTER ROLE

Step 5:  Test PostgreSQL 11 database functionality

Add a test database user:

createuser test_user1

Add the test database and grant ownership to test_user1 :

postgres@ubuntu-01:~$ createdb test_db -O test_user1

Login to test_db database:

~$ psql -l | grep test_db


test_db | test_user1 | LATIN1 | en_US | en_US |
~$ psql test_db

Set user password:

testdb=# alter user test_user1 with password 'MyDBpassword';


ALTER ROLE

Create a table and add some dummy data:

testdb=# create table test_table ( id int,first_name text, last_name


Thank you for visiting. Support my
CREATE TABLE hard work with just a cup of coffee!

testdb=# insert into test table (id,first name,last name) values (1,
https://computingforgeeks.com/how-to-install-postgresql-11-on-debian-9-debian-8/ 4/7
11/8/2020 How to Install PostgreSQL 11 on Debian 9 / Debian 8 | ComputingForGeeks
_ ( , _ , _ ) ( ,
INSERT 0 1

Show table data

testdb=# select * from test_table;


id | first_name | last_name
----+------------+-----------
1 | John | Doe
(1 row)

Drop the test table

testdb=# DROP TABLE test_table;


DROP TABLE
testdb=# \q

Drop the test database

postgres@ubuntu-01:~$ dropdb test_db;

That’s it. You now have PostgreSQL 11 database server installed on Debian 9 / Debian 8.
If you are set for more reading, visit PostgreSQL o cial Documentation page.

You can support us by downloading this article as PDF from the Link below.

 Download the guide as PDF

We really appreciate you supporting our efforts by buying us Coffee:

Thank you for visiting. Support my


hard work with just a cup of coffee!

https://computingforgeeks.com/how-to-install-postgresql-11-on-debian-9-debian-8/ 5/7
11/8/2020 How to Install PostgreSQL 11 on Debian 9 / Debian 8 | ComputingForGeeks

Coming up with fresh, high quality content takes time. Sometimes working late
at night building labs and then doing the writing. We appreciate if you consider
supporting our e orts with a cup of co ee to keep us awake and always deliver.

No contribution is small. We are greatful for any amount you support us with. Thank you!

Josphat Mutai
https://computingforgeeks.com/

Founder of Computingforgeeks. Expertise in Virtualization, Cloud, Linux/UNIX Administration, Automation,Storage


Systems, Containers, Server Clustering e.t.c.

Thank you for visiting. Support my


hard work with just a cup of coffee!

https://computingforgeeks.com/how-to-install-postgresql-11-on-debian-9-debian-8/ 6/7
11/8/2020 How to Install PostgreSQL 11 on Debian 9 / Debian 8 | ComputingForGeeks

Thank you for visiting. Support my


hard work with just a cup of coffee!

https://computingforgeeks.com/how-to-install-postgresql-11-on-debian-9-debian-8/ 7/7

You might also like