{"id":19605,"date":"2017-06-21T06:55:58","date_gmt":"2017-06-20T22:55:58","guid":{"rendered":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/06\/21\/%e5%9c%a8-centos-7-x-%e4%b8%8a%e5%ae%89%e8%a3%9d-postgresql-server\/"},"modified":"2017-06-21T06:55:58","modified_gmt":"2017-06-20T22:55:58","slug":"%e5%9c%a8-centos-7-x-%e4%b8%8a%e5%ae%89%e8%a3%9d-postgresql-server","status":"publish","type":"post","link":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/06\/21\/%e5%9c%a8-centos-7-x-%e4%b8%8a%e5%ae%89%e8%a3%9d-postgresql-server\/","title":{"rendered":"\u5728 CentOS 7.x \u4e0a\u5b89\u88dd PostgreSQL Server"},"content":{"rendered":"<p>\u5f9e\u525b\u958b\u59cb\u5b78 GNU\/Linux \u7528\u7684\u5c31\u662f MySQL\uff0c\u4e00\u76f4\u5230\u5f8c\u4f86\u7684 MariaDB\uff0c\u5f88\u5c11\u4f7f\u7528\u7684 PostgreSQL\uff0c\u5370\u8c61\u4e2d\u53ea\u6709 OpenNMS \u624d\u6709\u7279\u5225\u4f7f\u7528\u5230\u3002<\/p>\n<p>1. \u5b89\u88dd PostgreSQL Server<br \/># <span style=\"color: #ff0000;\">yum install postgresql-server postgresql-contrib<\/span><\/p>\n<p>2. \u521d\u59cb\u5316 PostgreSQL \u8cc7\u6599\u5eab<br \/># <span style=\"color: #ff0000;\">\/usr\/bin\/postgresql-setup initdb<\/span><br \/><span style=\"color: #0000ff;\">Initializing database &#8230; OK[@more@]<\/span><br \/>3. \u4fee\u6539\u8a8d\u8b49\u8a2d\u5b9a\u6a94 \/<span style=\"color: #0000ff;\">var\/lib\/pgsql\/data\/pg_hba.conf<br \/><span style=\"color: #000000;\">#<\/span> <span style=\"color: #ff0000;\">sed -i &#8216;\/^local\/s\/peer$\/md5\/&#8217; \/var\/lib\/pgsql\/data\/pg_hba.conf<\/span><\/span><br \/># <span style=\"color: #ff0000;\">sed -i &#8216;\/^host\/s\/&#8230;..$\/md5\/&#8217; \/var\/lib\/pgsql\/data\/pg_hba.conf<\/span><br \/># <span style=\"color: #ff0000;\">egrep &#8216;^local|^host&#8217; \/var\/lib\/pgsql\/data\/pg_hba.conf<\/span><br \/><span style=\"color: #0000ff;\">local\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 md5<br \/>host\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 127.0.0.1\/32\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 md5<\/span><br \/><span style=\"color: #0000ff;\">host\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ::1\/128\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 md5<\/p>\n<p><\/span>4. \u555f\u52d5 PostgreSQL Server<br \/># <span style=\"color: #ff0000;\">systemctl start postgresql.service<\/span><br \/># <span style=\"color: #ff0000;\">systemctl enable postgresql.service<\/span><\/p>\n<p>5. \u958b\u555f\u9632\u706b\u7246\u8a2d\u5b9a<br \/># <span style=\"color: #ff0000;\">firewall-cmd &#8211;permanent &#8211;add-service=postgresql<\/span><br \/># <span style=\"color: #ff0000;\">firewall-cmd &#8211;reload<\/span><br \/>\u6216<br \/># <span style=\"color: #ff0000;\">iptables -A INPUT -p tcp &#8211;syn -m state &#8211;state NEW &#8211;dport 5432 -j ACCEPT<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f9e\u525b\u958b\u59cb\u5b78 GNU\/Linux \u7528\u7684\u5c31\u662f MySQL\uff0c\u4e00\u76f4\u5230\u5f8c\u4f86\u7684 MariaDB\uff0c\u5f88\u5c11\u4f7f\u7528\u7684 Postgre &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/06\/21\/%e5%9c%a8-centos-7-x-%e4%b8%8a%e5%ae%89%e8%a3%9d-postgresql-server\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008\u5728 CentOS 7.x \u4e0a\u5b89\u88dd PostgreSQL Server\u3009<\/span><\/a><\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117,150],"tags":[],"class_list":["post-19605","post","type-post","status-publish","format-standard","hentry","category-c-78462","category-c-78533"],"meta_key":{"_pingme":["1"],"_encloseme":["1"],"lt_post_id":["689379"]},"_links":{"self":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19605"}],"collection":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/comments?post=19605"}],"version-history":[{"count":0,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19605\/revisions"}],"wp:attachment":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/media?parent=19605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/categories?post=19605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/tags?post=19605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}