{"id":168,"date":"2021-06-15T12:35:29","date_gmt":"2021-06-15T04:35:29","guid":{"rendered":"https:\/\/dasmz.com\/?p=168"},"modified":"2021-11-04T16:53:42","modified_gmt":"2021-11-04T08:53:42","slug":"%e5%9c%a8debian10%e7%b3%bb%e7%bb%9f%e4%b8%8a%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8postgresql%e6%95%b0%e6%8d%ae%e5%ba%93-2021-06-15","status":"publish","type":"post","link":"https:\/\/dasmz.com\/?p=168","title":{"rendered":"\u5728Debian10\u7cfb\u7edf\u4e0a,\u5b89\u88c5\u548c\u4f7f\u7528PostgreSQL\u6570\u636e\u5e93 2021-06-15"},"content":{"rendered":"\n<pre class=\"wp-block-preformatted\" style=\"border:1px solid black\">\n\n\u5b98\u7f51 https:\/\/www.postgresql.org\/\n\u5b89\u88c5 https:\/\/www.postgresql.org\/download\/\nDebian\u7cfb\u7edf\u7684\u5b89\u88c5 https:\/\/www.postgresql.org\/download\/linux\/debian\/\n\u82f1\u6587\u6559\u7a0b\uff0c\u591a\u7248\u672c https:\/\/www.postgresql.org\/docs\/\n\u4e2d\u6587\u6559\u7a0b\u624d\u523012\u7684\u7248\u672c http:\/\/www.postgres.cn\/docs\/12\/\n\n# Update and install the basic \nroot@debian-server:~# apt update\nroot@debian-server:~# apt install lsb-release\nroot@debian-server:~# apt install gnupg2\nroot@debian-server:~# apt install wget\nroot@debian-server:~# apt install curl\n\n# Create the file repository configuration\nroot@debian-server:~# sh -c 'echo \"deb http:\/\/apt.postgresql.org\/pub\/repos\/apt $(lsb_release -cs)-pgdg main\" > \/etc\/apt\/sources.list.d\/pgdg.list'\n\n# Import the repository signing key\nroot@debian-server:~# wget --quiet -O - https:\/\/www.postgresql.org\/media\/keys\/ACCC4CF8.asc | apt-key add -\n\n# Update the package lists\nroot@debian-server:~# apt-get update\n\n# Install the latest version of PostgreSQL\nroot@debian-server:~# apt-get -y install postgresql\n\n\nroot@pve-debian-server-02:~# su - postgres\npostgres@pve-debian-server-02:~$ psql -c \"SELECT version();\"\n                                                     version                                                      \n------------------------------------------------------------------------------------------------------------------\n PostgreSQL 14.0 (Debian 14.0-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit\n(1 row)\n\/\/ 2021-11-04 \u5b89\u88c5\u5230\u768414.0\u7684\u6700\u65b0\u7248\u672c\u7684\uff0c\u771f\u68d2\uff01\n\npostgres@pve-debian-server-02:~$ pg_isready \n\/var\/run\/postgresql:5432 - accepting connections\npostgres@pve-debian-server-02:~$ \npostgres@pve-debian-server-02:~$ psql --version\npsql (PostgreSQL) 13.3 (Debian 13.3-1.pgdg100+1)\npostgres@pve-debian-server-02:~$ \npostgres@pve-debian-server-02:~$ createdb apgdatabase\npostgres@pve-debian-server-02:~$ \npostgres@pve-debian-server-02:~$ createuser apguser\npostgres@pve-debian-server-02:~$ \npostgres@pve-debian-server-02:~$ psql\npsql (13.3 (Debian 13.3-1.pgdg100+1))\nType \"help\" for help.\n\npostgres=# alter user apguser with password 'YourPasswd';\nALTER ROLE\npostgres=# GRANT ALL PRIVILEGES ON DATABASE apgdatabase TO apguser;\nGRANT\npostgres=# \\q\npostgres@pve-debian-server-02:~$ \npostgres@pve-debian-server-02:~$ psql -d apgdatabase\npsql (13.3 (Debian 13.3-1.pgdg100+1))\nType \"help\" for help.\n\napgdatabase=# SELECT current_date;\n current_date \n--------------\n 2021-06-14\n(1 row)\n\napgdatabase=# \napgdatabase=# \napgdatabase=# \\q\npostgres@pve-debian-server-02:~$ \n\n\n2021-11-1 \u589e\u52a0\uff0c\u4f7f\u7528root\u91cd\u7f6e\u4e00\u6b21postgres\u8d26\u6237\u7684\u5bc6\u7801\uff0c\u5230\u4e00\u4e2a\u590d\u6742\u5bc6\u7801\nroot@server# passwd postgres\n<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"574\" height=\"446\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2020\/12\/DONATE.jpg\" alt=\"Donate\" class=\"wp-image-18\" style=\"border:2px solid yellow\"\/><figcaption>\u4e91\u4e5e\u8ba8<\/figcaption><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5b98\u7f51 https:\/\/www.postgresql.org\/ \u5b89\u88c5 https:\/\/www.postgresq [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/168"}],"collection":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=168"}],"version-history":[{"count":6,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions"}],"predecessor-version":[{"id":765,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions\/765"}],"wp:attachment":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}