{"id":2174,"date":"2024-06-20T11:14:55","date_gmt":"2024-06-20T02:14:55","guid":{"rendered":"https:\/\/www.kwonline.org\/memo2\/?p=2174"},"modified":"2024-06-20T11:14:55","modified_gmt":"2024-06-20T02:14:55","slug":"install-postgresql-14-on-rhel-9","status":"publish","type":"post","link":"https:\/\/www.kwonline.org\/memo2\/2024\/06\/20\/install-postgresql-14-on-rhel-9\/","title":{"rendered":"RHEL 9: PostgreSQL 14 \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b"},"content":{"rendered":"<p>&nbsp;<br \/>\n\u4ed5\u4e8b\u3067 RHEL \u4f7f\u3044\u59cb\u3081\u305f\u306e\u3067\u30e1\u30e2<\/p>\n<p>\u307e\u305a\u306f Postgres \u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u6709\u52b9\u5316\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo dnf install -y https:\/\/download.postgresql.org\/pub\/repos\/yum\/reporpms\/EL-9-x86_64\/pgdg-redhat-repo-latest.noarch.rpm\r\nsudo dnf -qy module disable postgresql\r\nsudo dnf install -y postgresql14-server postgresql14\r\nsudo \/usr\/pgsql-14\/bin\/postgresql-14-setup initdb\r\nsudo systemctl enable --now postgresql-14\r\n<\/pre>\n<p>\u305d\u3057\u3066 peer \u8a8d\u8a3c\u3058\u3083\u306a\u304f\u3066\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u306b\u3059\u308b\u305f\u3081\u306b pg_hba.conf \u3092\u4fee\u6b63<br \/>\n\u30ea\u30e2\u30fc\u30c8\u30a2\u30af\u30bb\u30b9\u3082\u8a31\u53ef\u3057\u305f\u3044\u306e\u3067\u30db\u30b9\u30c8\u3092\u8ffd\u52a0<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# sudo vim \/var\/lib\/pgsql\/14\/data\/pg_hba.conf\r\nlocal   all             all                                     md5\r\nhost    all             all             10.0.0.0\/16             md5\r\n<\/pre>\n<p>postgresql.conf \u3082\u4fee\u6b63<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# sudo vim \/var\/lib\/pgsql\/14\/data\/postgresql.conf\r\nlisten_addresses = '*' #\u8ffd\u52a0\r\n<\/pre>\n<p>\u518d\u8d77\u52d5\u3057\u3066\u3001 postgres \u30e6\u30fc\u30b6\u30fc\u306b\u306a\u3063\u3066\u4f5c\u696d\u7d99\u7d9a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart postgresql-14\r\nsudo -i -u postgres\r\n<\/pre>\n<p>\u305d\u308c\u304b\u3089\u30e6\u30fc\u30b6\u30fc\u8ffd\u52a0\u306a\u3069<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\n-- psql\r\nALTER USER username WITH ENCRYPTED PASSWORD 'password';\r\n<\/pre>\n<p>DB\u8ffd\u52a0<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncreatedb dbname\r\n<\/pre>\n<p>\u518d\u5ea6\u306b psql \u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u6642\u306b\u30d1\u30b9\u30ef\u30fc\u30c9\u3044\u308c\u308b\u306e\u30e1\u30f3\u30c9\u30af\u30b5\u30a4\u306e\u3067 .pgpass \u4f5c\u6210<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# vim ~\/.pgpass\r\n10.0.0.1:5432:mydb:myuser:mypassword\r\n<\/pre>\n<p>\u305d\u308c\u304b\u3089 permission \u5909\u66f4<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nchmod 600 ~\/.pgpass\r\n<\/pre>\n<p>\u305d\u3057\u3066\u63a5\u7d9a\u3078<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npsql -h 10.0.0.1 -U myuser -d mydb\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; \u4ed5\u4e8b\u3067 RHEL \u4f7f\u3044\u59cb\u3081\u305f\u306e\u3067\u30e1\u30e2 \u307e\u305a\u306f Postgres \u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u6709\u52b9\u5316\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002 sudo dnf install -y https:\/\/download.postgresql.o [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,26],"tags":[],"class_list":["post-2174","post","type-post","status-publish","format-standard","hentry","category-linux","category-postgresql"],"_links":{"self":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts\/2174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/comments?post=2174"}],"version-history":[{"count":3,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts\/2174\/revisions"}],"predecessor-version":[{"id":2177,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/posts\/2174\/revisions\/2177"}],"wp:attachment":[{"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/media?parent=2174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/categories?post=2174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kwonline.org\/memo2\/wp-json\/wp\/v2\/tags?post=2174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}