{"id":2316,"date":"2024-10-30T17:19:09","date_gmt":"2024-10-30T08:19:09","guid":{"rendered":"http:\/\/blog.moramcnt.com\/?p=2316"},"modified":"2024-10-30T17:39:36","modified_gmt":"2024-10-30T08:39:36","slug":"postgis-%ec%9a%b0%eb%b6%84%ed%88%ac%ec%97%90-%ec%84%a4","status":"publish","type":"post","link":"http:\/\/blog.moramcnt.com\/?p=2316","title":{"rendered":"postgis \uc6b0\ubd84\ud22c\uc5d0 \uc124\uce58\ud558\uae30"},"content":{"rendered":"<div><strong>I. \ubaa9\ud45c<\/strong><\/div>\n<div>GIS\ub97c \uc774\uc6a9\ud558\uc5ec \uc9c0\ub3c4\uc0c1 \uac70\uc810\uc744 \uad00\ub9ac\ud558\uae30 \uc704\ud558\uc5ec POSTGRESQL\uc744 \uc124\uce58\ud55c\ub2e4.<\/div>\n<p>&nbsp;<\/p>\n<div><strong>II. \uc5f0\uad6c \ubc0f \uac1c\ubc1c\ub0b4\uc6a9<\/strong><\/div>\n<div><strong>1. \uc124\uce58<\/strong><\/div>\n<div>1) Postgresql\uc640 postgresql-contrib(Extension)\uc744 \uc124\uce58<\/div>\n<div><code>sudo apt-get install postgresql postgresql-contrib<\/code><\/div>\n<div><\/div>\n<div>\uc774\ud6c4 \uc11c\ube44\uc2a4 \uc7ac\uc2dc\uc791<\/div>\n<div><code>service postgresql restart<\/code><\/div>\n<div>2) PostGis \uc124\uce58<\/div>\n<div>\n<div>\ucd5c\uc2e0 \uc6b0\ubd84\ud22c\uc758 \uacbd\uc6b0<\/div>\n<div><code>sudo apt-get install postgis postgresql-16-postgis-3<\/code><\/div>\n<div>\ubc84\uc804\uc5d0 \ub9de\uac8c<\/div>\n<div><code>sudo apt-get install postgis postgresql-12-postgis-3<\/code><\/div>\n<\/div>\n<div><\/div>\n<div>\ucc38\uace0 : \ub2f9\uc0ac\uc758 IDC\uc5d0 \uc788\ub294 \ub9ac\uc5bc\uc11c\ubc84\uc5d0\uc11c\ub294 postgresql \uc11c\ubc84\uac00 9.5\ubc84\uc804\uc774\ubbc0\ub85c postgis 2.2\ub97c \uc124\uce58\ud574\uc57c\ud588\uc74c<\/div>\n<div><code>apt-get install postgresql-9.5-postgis-2.2<\/code><\/div>\n<p>&nbsp;<\/p>\n<div><strong>2. \uc678\ubd80\uc811\uc18d\ud5c8\uc6a9<\/strong><\/div>\n<div>1) postgresql.conf \ud30c\uc77c \ubcc0\uacbd<\/div>\n<div>vi \/etc\/postgresql\/12\/main\/postgresql.conf<\/div>\n<div>\n<table style=\"width: 99.8276%; border-collapse: collapse; border-style: solid; border-color: #000000; height: 256px;\" border=\"1\">\n<tbody>\n<tr>\n<td style=\"width: 100%;\">\n<div>#listen_addresses = &#8216;localhost&#8217;<\/div>\n<div>\uc744 \uc544\ub798\ucc98\ub7fc \ubcc0\uacbd<\/div>\n<div>listen_addresses = &#8216;*&#8217;<\/div>\n<p>&nbsp;<\/p>\n<div>\ud558\uace0 \uc11c\ube44\uc2a4 \ub9ac\uc2a4\ud0c0\ud2b8<\/div>\n<div>service postgresql restart<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>2) \uc778\uc99d<\/div>\n<div>\ub2e4\uc74c \uba85\ub839\uc744 \uc0ac\uc6a9\ud558\uc5ec \ube44\ubc00\ubc88\ud638 \uc778\uc99d\uc744 \uc9c4\ud589\ud558\uace0 \ud5c8\uc6a9\ud558\uc2ed\uc2dc\uc624.<\/div>\n<div>sudo sed -i &#8216;\/^host\/s\/ident\/md5\/&#8217; \/etc\/postgresql\/16\/main\/pg_hba.conf<\/div>\n<p>&nbsp;<\/p>\n<div>\uc774\uc81c \ub2e4\uc74c \uba85\ub839\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc2dd\ubcc4 \ubc29\ubc95\uc744 \ud53c\uc5b4\uc5d0\uc11c \uc2e0\ub8b0\ub85c \ubcc0\uacbd\ud558\uc2ed\uc2dc\uc624.<\/div>\n<div>sudo sed -i &#8216;\/^local\/s\/peer\/trust\/&#8217; \/etc\/postgresql\/16\/main\/pg_hba.conf<\/div>\n<div>\ub9c8\uc9c0\ub9c9\uc73c\ub85c \uc544\ub798 \uc904\uc744 \ud3b8\uc9d1\ud558\uc5ec PostgreSQL\uc5d0 \uc6d0\uaca9\uc73c\ub85c \uc561\uc138\uc2a4\ud560 \uc218 \uc788\ub3c4\ub85d \ud5c8\uc6a9\ud569\ub2c8\ub2e4.<\/div>\n<p>&nbsp;<\/p>\n<div>vi \/etc\/postgresql\/12\/main\/pg_hba.conf\u00a0\uc5d0 \uc544\ub798\uc640 \uac19\uc774 \ucd94\uac00<\/div>\n<div>host all all 0.0.0.0\/0 scram-sha-256<\/div>\n<div><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2320\" src=\"http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2024\/10\/postgis-\uc678\ubd80\uc811\uc18d-300x171.png\" alt=\"\" width=\"389\" height=\"222\" srcset=\"http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2024\/10\/postgis-\uc678\ubd80\uc811\uc18d-300x171.png 300w, http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2024\/10\/postgis-\uc678\ubd80\uc811\uc18d-1024x583.png 1024w, http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2024\/10\/postgis-\uc678\ubd80\uc811\uc18d-768x437.png 768w, http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2024\/10\/postgis-\uc678\ubd80\uc811\uc18d.png 1262w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/div>\n<div><\/div>\n<div>3) \ubc29\ud654\ubcbd\uc624\ud508<\/div>\n<div>ufw allow 5432\/tcp<\/div>\n<p>&nbsp;<\/p>\n<div><strong>3. \uc778\ucf54\ub529 \ubcc0\uacbd<\/strong><\/div>\n<div>su &#8211; postgres<\/div>\n<div>vi \/etc\/postgresql\/16\/main\/postgresql.conf<\/div>\n<div>\n<table style=\"width: 100%; border-collapse: collapse; border-style: solid; border-color: #000000;\" border=\"1\">\n<tbody>\n<tr>\n<td style=\"width: 100%;\">\n<div>lc_messages = &#8216;ko_KR.UTF-8&#8217;<\/div>\n<div>lc_monetary = &#8216;ko_KR.UTF-8&#8217;<\/div>\n<div>lc_numeric = &#8216;ko_KR.UTF-8&#8217;<\/div>\n<div>lc_time = &#8216;ko_KR.UTF-8&#8217;<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div><strong>4. \uacc4\uc815 \ube44\ubc00\ubc88\ud638 \ubcc0\uacbd<\/strong><\/div>\n<div>postgresql\uc744 \uc124\uce58\ud558\uba74 \uc790\ub3d9\uc73c\ub85c postgres \ub77c\ub294 \uacc4\uc815\uc774 \uc0dd\uc131\ub41c\ub2e4.<\/div>\n<div>\ud544\uc694\ud558\ub2e4\uba74 \uc258\ub85c \ub85c\uadf8\uc778\ud558\uc5ec \uacc4\uc815\uc758 \ube44\ubc00\ubc88\ud638\ub97c \ubcc0\uacbd\ud558\uba74 \ub41c\ub2e4.<\/div>\n<div>sudo passwd postgres<\/div>\n<div>\uc0c8 UNIX \uc554\ud638 \uc785\ub825 : XXX<\/div>\n<div>\uc0c8 UNIX \uc554\ud638 \uc785\ub825 : XXX<\/div>\n<div><\/div>\n<div><strong>5. postgres \uc811\uc18d<\/strong><\/div>\n<div>psql -U postgres<\/div>\n<p>&nbsp;<\/p>\n<div><strong>6. DB \uc0ac\uc6a9\uc790 \uc0dd\uc131<\/strong><\/div>\n<div>CREATE USER aaaa PASSWORD &#8216;bbbb&#8217; SUPERUSER;<\/div>\n<p>&nbsp;<\/p>\n<div><strong>7. \ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc0dd\uc131<\/strong><\/div>\n<div>CREATE DATABASE TestDB OWNER aaaa ENCODING utf8 LC_COLLATE &#8216;ko_KR.UTF-8&#8217; LC_CTYPE &#8216;ko_KR.UTF-8&#8217; TEMPLATE template0;<\/div>\n<div>&#8211; \uc8fc\uc758 : \uc778\ucf54\ub529\uc744 \ud55c\uae00\ub85c \ud558\ub824\uba74 TEMPLATE\uc744 template0\uc73c\ub85c \uc9c0\uc815\ud574\uc57c\ud568.<\/div>\n<div>\ub370\uc774\ud130\ubca0\uc774\uc2a4\ub294 \uc0dd\uc131\ub420 \ub54c \uae30\ubcf8\uc801\uc73c\ub85c template1 \ub370\uc774\ud130\ubca0\uc774\uc2a4\ub97c \ubcf5\uc81c\ud558\uc5ec \uc0dd\uc131\ud558\ub294\ub370,<\/div>\n<div>\uc774 template1\uacfc \ub0b4\uac00 \ub9cc\ub4e0 DB\uac00 \ucda9\ub3cc\ud574\uc11c \uc5d0\ub7ec\uac00 \ubc1c\uc0dd\ud558\uac8c \ub41c\ub2e4.<\/div>\n<div>\uc774\ub97c \ud574\uacb0\ud558\uae30\uc704\ud574\uc11c\ub294 template0\uc744 \uc774\uc6a9\ud558\uba74 \ub41c\ub2e4.<\/div>\n<div><\/div>\n<div><strong>8. POSTGIS \ud65c\uc131\ud654<\/strong><\/div>\n<div>psql TestDB -c &#8220;CREATE EXTENSION postgis&#8221;;<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I. \ubaa9\ud45c GIS\ub97c \uc774\uc6a9\ud558\uc5ec \uc9c0\ub3c4\uc0c1 \uac70\uc810\uc744 \uad00\ub9ac\ud558\uae30 \uc704\ud558\uc5ec POSTGRESQL\uc744 \uc124\uce58\ud55c\ub2e4. &nbsp; II. \uc5f0\uad6c \ubc0f \uac1c\ubc1c\ub0b4\uc6a9 1. \uc124\uce58 1) Postgresql\uc640 postgresql-contrib(Extension)\uc744 \uc124\uce58 sudo apt-get install postgresql postgresql-contrib \uc774\ud6c4 \uc11c\ube44\uc2a4 \uc7ac\uc2dc\uc791 service postgresql restart 2) PostGis \uc124\uce58 \ucd5c\uc2e0 \uc6b0\ubd84\ud22c\uc758 \uacbd\uc6b0 sudo apt-get install postgis postgresql-16-postgis-3 \ubc84\uc804\uc5d0 \ub9de\uac8c sudo apt-get install postgis postgresql-12-postgis-3 \ucc38\uace0 : \ub2f9\uc0ac\uc758 IDC\uc5d0 \uc788\ub294 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[5,2],"tags":[276,275,191],"class_list":["post-2316","post","type-post","status-publish","format-standard","hentry","category-gis","category-2","tag-postgis","tag-postgressql","tag-191"],"_links":{"self":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/2316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2316"}],"version-history":[{"count":7,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/2316\/revisions"}],"predecessor-version":[{"id":2324,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/2316\/revisions\/2324"}],"wp:attachment":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2316"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}