Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Databases»PostgreSQL»How to Install PostgreSQL 11 on Debian 9 (Stretch)

    How to Install PostgreSQL 11 on Debian 9 (Stretch)

    RahulBy RahulNovember 12, 20182 Mins ReadUpdated:November 13, 2018

    PostgreSQL is an open source object-relational database system. It is one of leading database server used for production servers. This tutorial will help you to install the PostgreSQL database server on Debian 9 Stretch systems.

    • How to Install pgAdmin4 on Debian 9

    Step 1 – Enable Apt Repository

    First, you need to import PostgreSQL packages signing key on your system. Use the below command to import the key.

    wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
    

    Now add PostgreSQL apt repository in your system as per your operating system. These are suggested on official PostgreSQL website using following command.

    sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    

    Step 2 – Install PostgreSQL on Debian 9

    At this stage, you have successfully added PostgreSQL official repository in your system. Now update the repository list. After that install Latest PostgreSQL Server in our Ubuntu system using following commands.

    sudo apt-get update
    sudo apt-get install postgresql postgresql-contrib
    

    Step 3 – Connect to PostgreSQL

    After installing the PostgreSQL database server by default, it creates a user ‘postgres’ with role ‘postgres’. It also creates a system account with the same name ‘postgres’. So to connect to postgres server, login to your system as user postgres and connect database.

    sudo su - postgres
    psql
    

    Now you are logged in to PostgreSQL database server. To check login info use following command from database command prompt.

    postgres-# \conninfo
    

    To disconnect from PostgreSQL database command prompt just type below command and press enter. It will return you back to Debian command prompt.

    postgres-# \q
    

    Step 4 – Conclusion

    Your PostgreSQL installation has been completed successfully on your Debian 9 system.

    Let’s move to pgAdmin4 installation on Debian 9 systems.

    pgadmin4 phpPgAdmin PostgreSQL
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Install pgAdmin4 on Debian 10/9
    Next Article How To Install MariaDB on Debian 9 (Stretch)

    Related Posts

    How To Configure PostgreSQL to Allow Remote Connections

    3 Mins Read

    How to Check the PostgreSQL Version

    Updated:August 6, 20212 Mins Read

    How to Install pgAdmin4 on Ubuntu 20.04

    Updated:April 9, 20214 Mins Read

    How to Install PostgreSQL and pgAdmin4 in Ubuntu 20.04

    Updated:July 1, 20215 Mins Read

    How To Install PostgreSQL Server on CentOS 8

    Updated:April 20, 20224 Mins Read

    How to Install PostgreSQL 11 on Debian 10 (Buster)

    Updated:July 25, 20192 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.