{"id":59561,"date":"2024-10-12T22:57:16","date_gmt":"2024-10-12T14:57:16","guid":{"rendered":"https:\/\/server.hk\/cnblog\/59561\/"},"modified":"2024-10-12T22:57:16","modified_gmt":"2024-10-12T14:57:16","slug":"centos-%e8%bc%95%e9%ac%86%e5%ae%89%e8%a3%9d%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9a%e5%bf%ab%e9%80%9f%e9%83%a8%e7%bd%b2%e4%bd%a0%e7%9a%84%e6%95%b8%e6%93%9a%e5%ba%ab%e3%80%82-centos%e6%95%b8%e6%93%9a","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/59561\/","title":{"rendered":"Centos \u8f15\u9b06\u5b89\u88dd\u6578\u64da\u5eab\uff1a\u5feb\u901f\u90e8\u7f72\u4f60\u7684\u6578\u64da\u5eab\u3002 (centos\u6578\u64da\u5eab\u5b89\u88dd)"},"content":{"rendered":"<h1 id=\"centos-%e8%bc%95%e9%ac%86%e5%ae%89%e8%a3%9d%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9a%e5%bf%ab%e9%80%9f%e9%83%a8%e7%bd%b2%e4%bd%a0%e7%9a%84%e6%95%b8%e6%93%9a%e5%ba%ab-afpqtqYBuw\">CentOS \u8f15\u9b06\u5b89\u88dd\u6578\u64da\u5eab\uff1a\u5feb\u901f\u90e8\u7f72\u4f60\u7684\u6578\u64da\u5eab<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u64da\u9a45\u52d5\u7684\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u5eab\u7684\u7ba1\u7406\u548c\u90e8\u7f72\u8b8a\u5f97\u8d8a\u4f86\u8d8a\u91cd\u8981\u3002CentOS \u4f5c\u70ba\u4e00\u500b\u7a69\u5b9a\u4e14\u5ee3\u6cdb\u4f7f\u7528\u7684 Linux \u767c\u884c\u7248\uff0c\u70ba\u7528\u6236\u63d0\u4f9b\u4e86\u5f37\u5927\u7684\u652f\u6301\u4f86\u5b89\u88dd\u548c\u7ba1\u7406\u5404\u7a2e\u6578\u64da\u5eab\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS \u4e0a\u8f15\u9b06\u5b89\u88dd\u6578\u64da\u5eab\uff0c\u4e26\u5feb\u901f\u90e8\u7f72\u4f60\u7684\u6578\u64da\u5eab\u74b0\u5883\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%81%b8%e6%93%87-centos%ef%bc%9f-afpqtqYBuw\">\u70ba\u4ec0\u9ebc\u9078\u64c7 CentOS\uff1f<\/h2>\n<p>CentOS \u662f\u4e00\u500b\u57fa\u65bc Red Hat Enterprise Linux (RHEL) \u7684\u958b\u6e90\u64cd\u4f5c\u7cfb\u7d71\uff0c\u56e0\u5176\u7a69\u5b9a\u6027\u548c\u5b89\u5168\u6027\u800c\u53d7\u5230\u5ee3\u6cdb\u9752\u775e\u3002\u5b83\u9069\u5408\u7528\u65bc\u4f3a\u670d\u5668\u74b0\u5883\uff0c\u4e26\u4e14\u64c1\u6709\u5927\u91cf\u7684\u793e\u5340\u652f\u6301\u3002\u9019\u4f7f\u5f97 CentOS \u6210\u70ba\u90e8\u7f72\u6578\u64da\u5eab\u7684\u7406\u60f3\u9078\u64c7\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9d%e5%89%8d%e7%9a%84%e6%ba%96%e5%82%99-afpqtqYBuw\">\u5b89\u88dd\u524d\u7684\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u5b89\u88dd\u6578\u64da\u5eab\u4e4b\u524d\uff0c\u78ba\u4fdd\u4f60\u7684 CentOS \u7cfb\u7d71\u5df2\u7d93\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u66f4\u65b0\u7cfb\u7d71\uff1a<\/p>\n<pre><code>sudo yum update -y<\/code><\/pre>\n<p>\u6b64\u5916\uff0c\u78ba\u4fdd\u4f60\u64c1\u6709 root \u6b0a\u9650\uff0c\u9019\u5c0d\u65bc\u5b89\u88dd\u548c\u914d\u7f6e\u6578\u64da\u5eab\u662f\u5fc5\u9700\u7684\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9d-mysql-%e6%95%b8%e6%93%9a%e5%ba%ab-afpqtqYBuw\">\u5b89\u88dd MySQL \u6578\u64da\u5eab<\/h2>\n<p>MySQL \u662f\u6700\u6d41\u884c\u7684\u958b\u6e90\u6578\u64da\u5eab\u4e4b\u4e00\uff0c\u9069\u5408\u5404\u7a2e\u61c9\u7528\u3002\u4ee5\u4e0b\u662f\u5b89\u88dd MySQL \u7684\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"1-%e5%ae%89%e8%a3%9d-mysql-afpqtqYBuw\">1. \u5b89\u88dd MySQL<\/h3>\n<p>\u9996\u5148\uff0c\u6dfb\u52a0 MySQL \u7684\u5b98\u65b9 Yum \u5b58\u5132\u5eab\uff1a<\/p>\n<pre><code>sudo rpm -Uvh https:\/\/repo.mysql.com\/mysql57-community-release-el7-11.noarch.rpm<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u5b89\u88dd MySQL \u4f3a\u670d\u5668\uff1a<\/p>\n<pre><code>sudo yum install mysql-community-server -y<\/code><\/pre>\n<h3 id=\"2-%e5%95%9f%e5%8b%95-mysql-%e6%9c%8d%e5%8b%99-afpqtqYBuw\">2. \u555f\u52d5 MySQL \u670d\u52d9<\/h3>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u555f\u52d5 MySQL \u670d\u52d9\u4e26\u8a2d\u7f6e\u5176\u5728\u958b\u6a5f\u6642\u81ea\u52d5\u555f\u52d5\uff1a<\/p>\n<pre><code>sudo systemctl start mysqld\nsudo systemctl enable mysqld<\/code><\/pre>\n<h3 id=\"3-%e7%8d%b2%e5%8f%96%e8%87%a8%e6%99%82%e5%af%86%e7%a2%bc-afpqtqYBuw\">3. \u7372\u53d6\u81e8\u6642\u5bc6\u78bc<\/h3>\n<p>\u5b89\u88dd\u904e\u7a0b\u4e2d\uff0cMySQL \u6703\u751f\u6210\u4e00\u500b\u81e8\u6642\u5bc6\u78bc\u3002\u4f60\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u547d\u4ee4\u627e\u5230\u5b83\uff1a<\/p>\n<pre><code>sudo grep 'temporary password' \/var\/log\/mysqld.log<\/code><\/pre>\n<h3 id=\"4-%e9%85%8d%e7%bd%ae-mysql-%e5%ae%89%e5%85%a8%e6%80%a7-afpqtqYBuw\">4. \u914d\u7f6e MySQL \u5b89\u5168\u6027<\/h3>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u904b\u884c\u5b89\u5168\u6027\u914d\u7f6e\u8173\u672c\uff1a<\/p>\n<pre><code>sudo mysql_secure_installation<\/code><\/pre>\n<p>\u6839\u64da\u63d0\u793a\u8a2d\u7f6e\u65b0\u7684 root \u5bc6\u78bc\uff0c\u4e26\u9078\u64c7\u5176\u4ed6\u5b89\u5168\u9078\u9805\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9d-postgresql-%e6%95%b8%e6%93%9a%e5%ba%ab-afpqtqYBuw\">\u5b89\u88dd PostgreSQL \u6578\u64da\u5eab<\/h2>\n<p>PostgreSQL \u662f\u53e6\u4e00\u500b\u6d41\u884c\u7684\u958b\u6e90\u6578\u64da\u5eab\uff0c\u7279\u5225\u9069\u5408\u9700\u8981\u9ad8\u6027\u80fd\u548c\u9ad8\u53ef\u64f4\u5c55\u6027\u7684\u61c9\u7528\u3002\u4ee5\u4e0b\u662f\u5b89\u88dd PostgreSQL \u7684\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"1-%e5%ae%89%e8%a3%9d-postgresql-afpqtqYBuw\">1. \u5b89\u88dd PostgreSQL<\/h3>\n<p>\u9996\u5148\uff0c\u5b89\u88dd PostgreSQL \u7684 Yum \u5b58\u5132\u5eab\uff1a<\/p>\n<pre><code>sudo yum install -y https:\/\/download.postgresql.org\/pub\/repos\/yum\/reporpms\/EL-7-x86_64\/pgdg-redhat-repo-latest.noarch.rpm<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u5b89\u88dd PostgreSQL \u4f3a\u670d\u5668\uff1a<\/p>\n<pre><code>sudo yum install -y postgresql13-server<\/code><\/pre>\n<h3 id=\"2-%e5%88%9d%e5%a7%8b%e5%8c%96%e6%95%b8%e6%93%9a%e5%ba%ab-afpqtqYBuw\">2. \u521d\u59cb\u5316\u6578\u64da\u5eab<\/h3>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u521d\u59cb\u5316 PostgreSQL \u6578\u64da\u5eab\uff1a<\/p>\n<pre><code>sudo \/usr\/pgsql-13\/bin\/postgresql13-setup initdb<\/code><\/pre>\n<h3 id=\"3-%e5%95%9f%e5%8b%95-postgresql-%e6%9c%8d%e5%8b%99-afpqtqYBuw\">3. \u555f\u52d5 PostgreSQL \u670d\u52d9<\/h3>\n<p>\u555f\u52d5 PostgreSQL \u670d\u52d9\u4e26\u8a2d\u7f6e\u5176\u5728\u958b\u6a5f\u6642\u81ea\u52d5\u555f\u52d5\uff1a<\/p>\n<pre><code>sudo systemctl start postgresql-13\nsudo systemctl enable postgresql-13<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-afpqtqYBuw\">\u7e3d\u7d50<\/h2>\n<p>\u5728 CentOS \u4e0a\u5b89\u88dd\u6578\u64da\u5eab\u662f\u76f8\u5c0d\u7c21\u55ae\u7684\u904e\u7a0b\uff0c\u7121\u8ad6\u662f MySQL \u9084\u662f PostgreSQL\uff0c\u90fd\u80fd\u5920\u5feb\u901f\u90e8\u7f72\u4e26\u6eff\u8db3\u5404\u7a2e\u9700\u6c42\u3002\u900f\u904e\u4e0a\u8ff0\u6b65\u9a5f\uff0c\u4f60\u53ef\u4ee5\u8f15\u9b06\u5730\u5728\u4f60\u7684\u4f3a\u670d\u5668\u4e0a\u8a2d\u7f6e\u6578\u64da\u5eab\uff0c\u70ba\u4f60\u7684\u61c9\u7528\u63d0\u4f9b\u652f\u6301\u3002\u5982\u679c\u4f60\u6b63\u5728\u5c0b\u627e\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u4f86\u904b\u884c\u4f60\u7684\u6578\u64da\u5eab\uff0cServer.HK \u63d0\u4f9b\u4e86\u591a\u7a2e\u9078\u64c7\uff0c\u9069\u5408\u4e0d\u540c\u7684\u9700\u6c42\u548c\u9810\u7b97\u3002\u7121\u8ad6\u662f <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u9084\u662f\u5176\u4ed6\u5730\u5340\u7684\u670d\u52d9\uff0cServer.HK \u90fd\u80fd\u70ba\u4f60\u63d0\u4f9b\u53ef\u9760\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5feb\u901f\u5b78\u7fd2\u5982\u4f55\u5728CentOS\u4e0a\u8f15\u9b06\u5b89\u88dd\u6578\u64da\u5eab\uff0c\u5be6\u73fe\u9ad8\u6548\u90e8\u7f72\uff0c\u63d0\u5347\u6578\u64da\u7ba1\u7406\u6548\u7387\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-59561","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/59561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=59561"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/59561\/revisions"}],"predecessor-version":[{"id":59562,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/59561\/revisions\/59562"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=59561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=59561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=59561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}