{"id":14674,"date":"2022-02-02T06:28:15","date_gmt":"2022-02-02T06:28:15","guid":{"rendered":"https:\/\/linuxways.net\/?p=14674"},"modified":"2022-02-02T06:28:15","modified_gmt":"2022-02-02T06:28:15","slug":"how-to-install-postgresql-14-on-debian-11","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/how-to-install-postgresql-14-on-debian-11\/","title":{"rendered":"How to Install PostgreSQL 14 on Debian 11"},"content":{"rendered":"<p>PostgreSQL is also known as Postgres, an open-source and powerful objects-based relational database system that is used and combined with many features of SQL language. Using the Postgres database, you can easily store and scale the complicated data workload. Most of the mobile and web applications used the Postgres database for storing data. Postgres database can be installed on almost all operating systems including Linux.<\/p>\n<p>We will go through the installation of Postgres or PostgreSQL 14 on the Debian 11 system using the command line method.<\/p>\n<h2>Prerequisites<\/h2>\n<ul>\n<li>Debian 11 Linux operating system with enough space should be running properly on your system.<\/li>\n<li>You should have sudo privileges or must be login as a root user for installing the Postgres database on Debian 11 through the command line.<\/li>\n<\/ul>\n<h2>Installation of PostgreSQL on Debian 11<\/h2>\n<p>Follow the below-mentioned steps to install the Postgres or <a href=\"https:\/\/www.postgresql.org\/\">PostgreSQL14<\/a> on the Debian 11 system:<\/p>\n<h3>Step 1: Install Prerequisites<\/h3>\n<p>First, update the system repositories list using the \u2018apt\u2019 command.<\/p>\n<pre>$ sudo apt update<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"725\" height=\"366\" class=\"wp-image-14675\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image.png 725w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-300x151.png 300w\" sizes=\"auto, (max-width: 725px) 100vw, 725px\" \/><\/p>\n<p>Now, install the recommended HTTPS support packages by executing the below-mentioned command:<\/p>\n<pre>$ sudo apt install -y curl apt-transport-https<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"724\" height=\"335\" class=\"wp-image-14676\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-1.png 724w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-1-300x139.png 300w\" sizes=\"auto, (max-width: 724px) 100vw, 724px\" \/><\/p>\n<h3>Step 2: Add repository of PostgreSQL<\/h3>\n<p>By default, the PostgreSQL packages are not included in the Debian 11 repository. However, you can install the required packages by adding the PostgreSQL repository to your Debian system. So, download or import the signing key of the PostgreSQL repository by using the following command:<\/p>\n<pre>$ curl -fsSL https:\/\/www.postgresql.org\/media\/keys\/ACCC4CF8.asc | sudo gpg --dearmor -o \/usr\/share\/keyrings\/postgresql-keyring.gpg<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"793\" height=\"76\" class=\"wp-image-14677\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-2.png 793w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-2-300x29.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-2-768x74.png 768w\" sizes=\"auto, (max-width: 793px) 100vw, 793px\" \/><\/p>\n<p>Add the PostgreSQL repository to your Debian 11 system by executing the below-mentioned command:<\/p>\n<pre>$ echo \"deb [signed-by=\/usr\/share\/keyrings\/postgresql-keyring.gpg] http:\/\/apt.postgresql.org\/pub\/repos\/apt\/ bullseye-pgdg main\" | sudo tee \/etc\/apt\/sources.list.d\/postgresql.list<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"791\" height=\"112\" class=\"wp-image-14678\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-3.png 791w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-3-300x42.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-3-768x109.png 768w\" sizes=\"auto, (max-width: 791px) 100vw, 791px\" \/><\/p>\n<h3>Step 3: Install PostgreSQL on Debian 11<\/h3>\n<p>Once the repository is included, install the PostgreSQL on Debian 11 system. The following syntax will help you to install the desired PostgreSQL version on your system:<\/p>\n<pre>$ sudo apt update<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"796\" height=\"419\" class=\"wp-image-14679\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-4.png 796w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-4-300x158.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-4-768x404.png 768w\" sizes=\"auto, (max-width: 796px) 100vw, 796px\" \/><\/p>\n<pre>$ sudo apt install -y postgresql-version<\/pre>\n<p>Here, we are installing the latest PostgreSQL-14 on this system. Therefore, this command will be changed into the following order:<\/p>\n<pre>$ sudo apt install -y postgresql-14<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"501\" class=\"wp-image-14680\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-5.png 789w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-5-300x190.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-5-768x488.png 768w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/p>\n<p>The \u2018-y\u2019 option will allow you to ignore the confirmation prompt on your terminal window.<\/p>\n<p>Once the Postgres installation is completed, the service of PostgreSQL will automatically start on your system.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"505\" class=\"wp-image-14681\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-6.png 789w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-6-300x192.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-6-768x492.png 768w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/p>\n<p>Verify the \u2018Active\u2019 or excited status of Postgres service by running the below-mentioned command:<\/p>\n<pre>$ sudo systemctl status postgresql<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"791\" height=\"200\" class=\"wp-image-14682\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-7.png 791w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-7-300x76.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-7-768x194.png 768w\" sizes=\"auto, (max-width: 791px) 100vw, 791px\" \/><\/p>\n<p>If you did not receive the \u2018Active\u2019 status of the PostgreSQL service then, you can enable and start the PostgreSQL services by running the following command:<\/p>\n<pre>$ sudo systemctl enable postgresql<\/pre>\n<pre>$ sudo systemctl start postgresql<\/pre>\n<p>Once the postgreSQL installation is completed on your system, it creates by default a\u00a0user with the name \u2018Postgres\u2019 that you can find in the \/etc\/passwd file.<\/p>\n<pre>$ cat \/etc\/passwd | grep -i postgres<\/pre>\n<h3>Step 4: PostgreSQL server configurations<\/h3>\n<p>The postgreSQL listens at the localhost port \u2018127.0.0.1\u2019 by default. but, you change it with your system IP address.<\/p>\n<pre>$ sudo nano \/etc\/postgresql\/14\/main\/postgresql.conf<\/pre>\n<p>Change the <strong>listen_addresses<\/strong> to your <strong>&lt;IPAddress&gt;<\/strong> or <strong>*<\/strong> symbol.<\/p>\n<pre>listen_addresses = 'IP-Address'<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"791\" height=\"254\" class=\"wp-image-14683\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/c-users-dell-onedrive-desktop-qqq-png.png\" alt=\"C:\\Users\\DELL\\OneDrive\\Desktop\\qqq.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/c-users-dell-onedrive-desktop-qqq-png.png 791w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/c-users-dell-onedrive-desktop-qqq-png-300x96.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/c-users-dell-onedrive-desktop-qqq-png-768x247.png 768w\" sizes=\"auto, (max-width: 791px) 100vw, 791px\" \/><\/p>\n<p>Now, restart the postgreSQL service on your system.<\/p>\n<pre>$ sudo systemctl restart postgresql<\/pre>\n<h3>Step 5: Login into the PostgreSQL database<\/h3>\n<p>Login as a \u2018postgres\u2019 user to the postgres database by using the below-mentioned command:<\/p>\n<pre>$ sudo -u postgres psql<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"92\" class=\"wp-image-14684\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-8.png 789w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-8-300x35.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-8-768x90.png 768w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/p>\n<p>Now, we can use the PostgreSQL database through the psql commands.<\/p>\n<pre>$ psql<\/pre>\n<p>Congratulations! We have successfully installed PostgreSQL 14 on the Debian 11 system. Now, you can easily create the postgreSQL databases on your system.<\/p>\n<h2>Conclusion<\/h2>\n<p>We installed PostgreSQL 14 database on the Debian 11 system. We have seen how to execute various commands to run the PostgreSQL-14 database on the Debian 11 system. The same installation steps you can follow to install the<a href=\"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-postgresql-on-ubuntu-20-4\/\"> PostgreSQL on Ubuntu<\/a> and its derivatives. You can also download the latest release notes for the installation of PostgreSQL 14 from its <a href=\"https:\/\/www.postgresql.org\/download\/\">official PostgreSQL website<\/a>. Thanks!<\/p>","protected":false},"excerpt":{"rendered":"<p>PostgreSQL is also known as Postgres, an open-source and powerful objects-based relational database system that is used and combined with many features of SQL language. Using the Postgres&hellip;<\/p>","protected":false},"author":1,"featured_media":14793,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[521,887],"class_list":["post-14674","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian","tag-debian-11","tag-postgresql-14"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/14674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=14674"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/14674\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/14793"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=14674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=14674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=14674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}