{"id":43216,"date":"2024-10-04T21:41:56","date_gmt":"2024-10-04T13:41:56","guid":{"rendered":"https:\/\/server.hk\/cnblog\/43216\/"},"modified":"2024-10-04T21:41:56","modified_gmt":"2024-10-04T13:41:56","slug":"centos-7-%e7%b3%bb%e7%b5%b1%e9%85%8d%e7%bd%ae%e8%a9%b3%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/43216\/","title":{"rendered":"CentOS 7 \u7cfb\u7d71\u914d\u7f6e\u8a73\u89e3"},"content":{"rendered":"<h1 id=\"centos-7-%e7%b3%bb%e7%b5%b1%e9%85%8d%e7%bd%ae%e8%a9%b3%e8%a7%a3-BzgqoHasbF\">CentOS 7 \u7cfb\u7d71\u914d\u7f6e\u8a73\u89e3<\/h1>\n<p>CentOS 7 \u662f\u4e00\u500b\u57fa\u65bc Red Hat Enterprise Linux (RHEL) \u7684\u958b\u6e90\u64cd\u4f5c\u7cfb\u7d71\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u4f3a\u670d\u5668\u74b0\u5883\u4e2d\u3002\u7531\u65bc\u5176\u7a69\u5b9a\u6027\u548c\u5b89\u5168\u6027\uff0cCentOS 7 \u6210\u70ba\u8a31\u591a\u4f01\u696d\u548c\u958b\u767c\u8005\u7684\u9996\u9078\u3002\u672c\u6587\u5c07\u8a73\u7d30\u4ecb\u7d39 CentOS 7 \u7684\u7cfb\u7d71\u914d\u7f6e\uff0c\u5305\u62ec\u5b89\u88dd\u3001\u7db2\u7d61\u8a2d\u7f6e\u3001\u5b89\u5168\u6027\u914d\u7f6e\u53ca\u5e38\u7528\u547d\u4ee4\u3002<\/p>\n<h2 id=\"%e4%b8%80%e3%80%81%e5%ae%89%e8%a3%9d-centos-7-BzgqoHasbF\">\u4e00\u3001\u5b89\u88dd CentOS 7<\/h2>\n<p>\u5b89\u88dd CentOS 7 \u7684\u904e\u7a0b\u76f8\u5c0d\u7c21\u55ae\uff0c\u4ee5\u4e0b\u662f\u57fa\u672c\u6b65\u9a5f\uff1a<\/p>\n<ol>\n<li>\u4e0b\u8f09 CentOS 7 \u7684 ISO \u6620\u50cf\u6587\u4ef6\uff0c\u4e26\u5c07\u5176\u71d2\u9304\u5230 USB \u6216 DVD\u3002<\/li>\n<li>\u555f\u52d5\u8a08\u7b97\u6a5f\uff0c\u9032\u5165 BIOS \u8a2d\u7f6e\uff0c\u9078\u64c7\u5f9e USB \u6216 DVD \u555f\u52d5\u3002<\/li>\n<li>\u5728\u555f\u52d5\u83dc\u55ae\u4e2d\u9078\u64c7\u300cInstall CentOS 7\u300d\u3002<\/li>\n<li>\u9078\u64c7\u8a9e\u8a00\u548c\u5730\u5340\uff0c\u7136\u5f8c\u9ede\u64ca\u300cContinue\u300d\u3002<\/li>\n<li>\u5728\u300cInstallation Summary\u300d\u754c\u9762\u4e2d\uff0c\u914d\u7f6e\u4ee5\u4e0b\u9078\u9805\uff1a<\/li>\n<ul>\n<li><strong>Date &amp; Time:<\/strong> \u8a2d\u7f6e\u6b63\u78ba\u7684\u6642\u5340\u3002<\/li>\n<li><strong>Keyboard:<\/strong> \u9078\u64c7\u5408\u9069\u7684\u9375\u76e4\u4f48\u5c40\u3002<\/li>\n<li><strong>Installation Destination:<\/strong> \u9078\u64c7\u5b89\u88dd\u78c1\u789f\u3002<\/li>\n<li><strong>Network &amp; Hostname:<\/strong> \u914d\u7f6e\u7db2\u7d61\u8a2d\u7f6e\u3002<\/li>\n<\/ul>\n<li>\u5b8c\u6210\u914d\u7f6e\u5f8c\uff0c\u9ede\u64ca\u300cBegin Installation\u300d\u3002<\/li>\n<li>\u8a2d\u7f6e root \u5bc6\u78bc\u548c\u5275\u5efa\u7528\u6236\u3002<\/li>\n<li>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u91cd\u555f\u7cfb\u7d71\u3002<\/li>\n<\/ol>\n<h2 id=\"%e4%ba%8c%e3%80%81%e7%b6%b2%e7%b5%a1%e8%a8%ad%e7%bd%ae-BzgqoHasbF\">\u4e8c\u3001\u7db2\u7d61\u8a2d\u7f6e<\/h2>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u7db2\u7d61\u8a2d\u7f6e\u662f\u78ba\u4fdd\u4f3a\u670d\u5668\u6b63\u5e38\u904b\u884c\u7684\u91cd\u8981\u6b65\u9a5f\u3002\u4ee5\u4e0b\u662f\u914d\u7f6e\u7db2\u7d61\u7684\u57fa\u672c\u65b9\u6cd5\uff1a<\/p>\n<pre><code>nmcli con show  # \u67e5\u770b\u7576\u524d\u7db2\u7d61\u9023\u63a5\nnmcli con add type ethernet ifname eth0 con-name my-connection\nnmcli con modify my-connection ipv4.addresses 192.168.1.100\/24\nnmcli con modify my-connection ipv4.gateway 192.168.1.1\nnmcli con modify my-connection ipv4.dns 8.8.8.8\nnmcli con modify my-connection ipv4.method manual\nnmcli con up my-connection  # \u555f\u7528\u7db2\u7d61\u9023\u63a5\n<\/code><\/pre>\n<h2 id=\"%e4%b8%89%e3%80%81%e5%ae%89%e5%85%a8%e6%80%a7%e9%85%8d%e7%bd%ae-BzgqoHasbF\">\u4e09\u3001\u5b89\u5168\u6027\u914d\u7f6e<\/h2>\n<p>\u5b89\u5168\u6027\u662f\u4f3a\u670d\u5668\u7ba1\u7406\u4e2d\u4e0d\u53ef\u5ffd\u8996\u7684\u4e00\u90e8\u5206\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa\u672c\u7684\u5b89\u5168\u6027\u914d\u7f6e\u5efa\u8b70\uff1a<\/p>\n<ul>\n<li><strong>\u9632\u706b\u7246\u8a2d\u7f6e\uff1a<\/strong>\u4f7f\u7528 firewalld \u4f86\u7ba1\u7406\u9632\u706b\u7246\u898f\u5247\u3002<\/li>\n<pre><code>systemctl start firewalld\nsystemctl enable firewalld\nfirewall-cmd --permanent --add-service=http\nfirewall-cmd --permanent --add-service=https\nfirewall-cmd --reload\n<\/code><\/pre>\n<li><strong>SSH \u5b89\u5168\u6027\uff1a<\/strong>\u66f4\u6539\u9ed8\u8a8d\u7684 SSH \u7aef\u53e3\uff0c\u7981\u7528 root \u767b\u9304\u3002<\/li>\n<pre><code>vi \/etc\/ssh\/sshd_config\n# \u5c07 Port 22 \u6539\u70ba\u5176\u4ed6\u7aef\u53e3\uff0c\u4f8b\u5982 2222\nPermitRootLogin no\nsystemctl restart sshd\n<\/code><\/pre>\n<li><strong>\u5b89\u88dd SELinux\uff1a<\/strong>\u78ba\u4fdd SELinux \u8655\u65bc\u555f\u7528\u72c0\u614b\uff0c\u4ee5\u589e\u5f37\u7cfb\u7d71\u5b89\u5168\u6027\u3002<\/li>\n<pre><code>sestatus  # \u67e5\u770b SELinux \u72c0\u614b\nsetenforce 1  # \u555f\u7528 SELinux\n<\/code><\/pre>\n<\/ul>\n<h2 id=\"%e5%9b%9b%e3%80%81%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4-BzgqoHasbF\">\u56db\u3001\u5e38\u7528\u547d\u4ee4<\/h2>\n<p>\u719f\u6089\u4e00\u4e9b\u5e38\u7528\u547d\u4ee4\u53ef\u4ee5\u63d0\u9ad8\u7ba1\u7406\u6548\u7387\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa\u672c\u547d\u4ee4\uff1a<\/p>\n<ul>\n<li><code>yum update<\/code> &#8211; \u66f4\u65b0\u7cfb\u7d71\u4e2d\u7684\u6240\u6709\u5305\u3002<\/li>\n<li><code>yum install package_name<\/code> &#8211; \u5b89\u88dd\u6307\u5b9a\u7684\u8edf\u4ef6\u5305\u3002<\/li>\n<li><code>systemctl status service_name<\/code> &#8211; \u67e5\u770b\u670d\u52d9\u72c0\u614b\u3002<\/li>\n<li><code>journalctl -xe<\/code> &#8211; \u67e5\u770b\u7cfb\u7d71\u65e5\u8a8c\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-BzgqoHasbF\">\u7e3d\u7d50<\/h2>\n<p>CentOS 7 \u7684\u7cfb\u7d71\u914d\u7f6e\u904e\u7a0b\u96d6\u7136\u7e41\u7463\uff0c\u4f46\u901a\u904e\u6b63\u78ba\u7684\u6b65\u9a5f\u548c\u914d\u7f6e\uff0c\u53ef\u4ee5\u78ba\u4fdd\u4f3a\u670d\u5668\u7684\u7a69\u5b9a\u6027\u548c\u5b89\u5168\u6027\u3002\u7121\u8ad6\u662f\u5b89\u88dd\u3001\u7db2\u7d61\u8a2d\u7f6e\u9084\u662f\u5b89\u5168\u6027\u914d\u7f6e\uff0c\u9019\u4e9b\u90fd\u662f\u6bcf\u4f4d\u7cfb\u7d71\u7ba1\u7406\u54e1\u5fc5\u9808\u638c\u63e1\u7684\u57fa\u672c\u6280\u80fd\u3002\u5982\u679c\u60a8\u9700\u8981\u66f4\u9ad8\u6548\u7684\u89e3\u6c7a\u65b9\u6848\uff0c\u53ef\u4ee5\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\uff0c\u9019\u5c07\u70ba\u60a8\u7684\u696d\u52d9\u63d0\u4f9b\u66f4\u5f37\u5927\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6df1\u5165\u63a2\u8a0eCentOS 7\u7cfb\u7d71\u914d\u7f6e\uff0c\u63d0\u4f9b\u8a73\u7d30\u6b65\u9a5f\u8207\u6700\u4f73\u5be6\u8e10\uff0c\u52a9\u60a8\u8f15\u9b06\u638c\u63e1\u4f3a\u670d\u5668\u7ba1\u7406\u8207\u512a\u5316\u6280\u5de7\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-43216","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43216","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=43216"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43216\/revisions"}],"predecessor-version":[{"id":43217,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43216\/revisions\/43217"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=43216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=43216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=43216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}