{"id":782,"date":"2021-08-04T04:33:54","date_gmt":"2021-08-04T04:33:54","guid":{"rendered":"https:\/\/hkc.nasclub.vip\/wordpress\/?p=782"},"modified":"2025-03-13T12:36:49","modified_gmt":"2025-03-13T04:36:49","slug":"centos7%e6%96%b0%e5%ae%89%e8%a3%85%e7%b3%bb%e7%bb%9f%e7%9a%84%e5%9f%ba%e6%9c%ac%e4%bc%98%e5%8c%96","status":"publish","type":"post","link":"https:\/\/hkc.nasclub.vip\/?p=782","title":{"rendered":"centos7\u65b0\u5b89\u88c5\u7cfb\u7edf\u7684\u57fa\u672c\u4f18\u5316"},"content":{"rendered":"<h3><strong>\u5b89\u88c5\u5b8ccentos7.3\u540e\uff0c\u505a\u4e00\u4e9b\u57fa\u672c\u7684\u64cd\u4f5c\u00a0<\/strong><\/h3>\n<h3><strong>\u57fa\u672c\u64cd\u4f5c\u4e00:\u4e3b\u673a\u540d<\/strong><\/h3>\n<p>centos7\u6709\u4e00\u4e2a\u65b0\u7684\u4fee\u6539\u4e3b\u673a\u540d\u7684\u547d\u4ee4hostnamectl<\/p>\n<pre class=\"prism-highlight prism-language-php\">#\u00a0hostnamectl\u00a0set-hostname\u00a0--static\u00a0li.cluster.com\u00a0\r\n#\u00a0vim\u00a0\/etc\/hosts\u00a0--\u6700\u540e\u52a0\u4e0a\u4f60\u7684IP\u4e0e\u4e3b\u673a\u540d\u7684\u7ed1\u5b9a\r\n127.0.0.1\u00a0\u00a0localhost\u00a0localhost.localdomain\u00a0localhost4\u00a0localhost4.localdomain4\u00a0\r\n::1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0localhost\u00a0localhost.localdomain\u00a0localhost6\u00a0localhost6.localdomain6\u00a0\r\n172.16.1.20\u00a0\u00a0li.cluster.com\u00a0\u00a0li<\/pre>\n<h3>\u57fa\u672c\u64cd\u4f5c\u4e8c:\u5173\u95ediptables<\/h3>\n<pre class=\"prism-highlight prism-language-php\">#\u00a0systemctl\u00a0status\u00a0firewalld.service\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u67e5\u770bfirewalld\u670d\u52a1\u7684\u72b6\u6001,active\u662f\u542f\u52a8\u72b6\u6001\uff0cinactive\u662f\u5173\u95ed\u72b6\u6001\r\n#\u00a0systemctl\u00a0stop\u00a0firewalld.service\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u5173\u95ed\u6b64\u670d\u52a1\r\n#\u00a0systemctl\u00a0list-unit-files\u00a0|grep\u00a0firewalld\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u67e5\u770bfirewalld\u662f\u5426\u5f00\u673a\u81ea\u52a8\u542f\u52a8\r\nfirewalld.service\u00a0\u00a0\u00a0enabled\r\n#\u00a0systemctl\u00a0disable\u00a0firewalld.service\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u7c7b\u4f3c\u4ee5\u524d\u7684chkconfig\u00a0xxx\u00a0off\r\n#\u00a0systemctl\u00a0list-unit-files\u00a0|grep\u00a0firewalld\r\nfirewalld.service\u00a0\u00a0\u00a0disabled<\/pre>\n<h3>\u57fa\u672c\u64cd\u4f5c\u4e09:\u5173\u95edselinux<\/h3>\n<pre class=\"prism-highlight prism-language-php\"># sed -i 7s\/enforcing\/disabled\/\u00a0\u00a0\/etc\/selinux\/config     --\u6539\u5b8c\u540e\uff0c\u5728\u540e\u9762\u91cd\u542f\u7cfb\u7edf\u751f\u6548\u57fa\u672c\u64cd\u4f5c<\/pre>\n<h3>\u56db:\u7f51\u7edc\u914d\u7f6e<\/h3>\n<pre class=\"prism-highlight prism-language-php\">#\u00a0systemctl\u00a0stop\u00a0NetworkManager\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u505c\u6b62\u670d\u52a1\r\n#\u00a0systemctl\u00a0status\u00a0NetworkManager\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u67e5\u770b\u72b6\u6001\uff0c\u786e\u8ba4\u4e3a\u5173\u95ed\u4e86\r\n#\u00a0systemctl\u00a0disable\u00a0NetworkManager\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u8bbe\u7f6e\u4e3a\u5f00\u673a\u4e0d\u81ea\u52a8\u542f\u52a8\r\n#\u00a0vim\u00a0\/etc\/sysconfig\/network-scripts\/ifcfg-enp2s0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u7f51\u5361\u540d\u5982\u679c\u4e0d\u4e00\u6837\uff0c\u627e\u5230\u5bf9\u5e94\u7684\u6587\u4ef6\u5c31\u884c\r\nBOOTPROTO=\"static\"\r\nNAME=\"enp2s0\"\r\nDEVICE=\"enp2s0\"\r\nONBOOT=\"yes\"\r\nIPADDR=10.10.1.x\r\nNETMASK=255.255.255.0\r\nGATEWAY=10.10.1.1\r\nDNS1=114.114.114.114\r\n#\u00a0\/etc\/init.d\/network\u00a0restart\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--network\u670d\u52a1\u8fd9\u91cc\u9ed8\u8ba4\u8fd8\u662f\u53ef\u4ee5\u4f7f\u7528\u539f\u6765\u7684\u7ba1\u7406\u65b9\u6cd5\r\n#\u00a0chkconfig\u00a0network\u00a0on\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u5f00\u673a\u81ea\u542f\u52a8<\/pre>\n<p>\u57fa\u672c\u64cd\u4f5c\u4e94:yum\u914d\u7f6e,\u914d\u7f6e\u672c\u5730yum\u6e90<\/p>\n<pre class=\"prism-highlight prism-language-php\">#\u00a0rm\u00a0\/etc\/yum.repos.d\/*\u00a0-rf\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u8fd9\u91cc\u6211\u5220\u9664\u4e86\u5b83\u6240\u6709\u7684\u9ed8\u8ba4\u7684\u914d\u7f6e(\u56e0\u4e3a\u8fd9\u4e9b\u9ed8\u8ba4\u914d\u7f6e\u8981\u8fde\u516c\u7f51\u7684\u6e90\uff0c\u901f\u5ea6\u592a\u6162)\r\n#\u00a0vim\u00a0\/etc\/yum.repos.d\/local.repo\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u7136\u540e\u81ea\u5efa\u4e86\u672c\u5730yum\u6e90\u914d\u7f6e\u6587\u4ef6\r\n[local]\r\nname=local\r\nbaseurl=file:\/\/\/yum\r\nenabled=1\r\ngpgcheck=0\r\n\u914d\u7f6e\u53ef\u9009163\u7684centos\u6e90\r\n163centos\u6e90\uff08\u5176\u5b9e\u5c31\u662fcentos\u5b98\u65b9\u7684yum\uff0c\u4f7f\u7528163\u7684\u56fd\u5185\u901f\u5ea6\u66f4\u5feb\uff09\r\n\u914d\u7f6e\u65b9\u6cd5\u4e24\u79cd\r\na)\u76f4\u63a5\u516c\u7f51\u8fde\u63a5\u7f51\u6613163,\u4f18\u70b9:\u901f\u5ea6\u5feb\uff0c\u8f6f\u4ef6\u5305\u4f1a\u5b9a\u671f\u66f4\u65b0\r\n#\u00a0cd\u00a0\/etc\/yum.repos.d\/\r\n#\u00a0wget\u00a0http:\/\/mirrors.163.com\/.help\/CentOS7-Base-163.repob)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u81ea\u5df1\u7f16\u5199\r\n#\u00a0vim\u00a0\/etc\/yum.repos.d\/cento163.repo\r\n[centos163]\r\nname=centos163\r\nbaseurl=http:\/\/mirrors.163.com\/centos\/7.3.1611\/os\/x86_64\r\nenabled=1\r\ngpgcheck=0\r\n\u914d\u7f6e\u53ef\u9009epel\u6e90\r\n\u914d\u7f6e\u65b9\u6cd5\u4e24\u79cd\r\na)\u76f4\u63a5\u516c\u7f51\u8fde\u63a5epel,\u4f18\u70b9:\u901f\u5ea6\u5feb\uff0c\u8f6f\u4ef6\u5305\u4f1a\u5b9a\u671f\u66f4\u65b0\r\n#\u00a0wget\u00a0http:\/\/dl.fedoraproject.org\/pub\/epel\/7\/x86_64\/e\/epel-release-7-10.noarch.rpm\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u6b64\u7248\u672c\u4fe1\u606f\u4f1a\u968f\u65f6\u95f4\u63a8\u79fb\u800c\u53d8\u5316\r\n#\u00a0rpm\u00a0-ivh\u00a0epel-release-7-10.noarch.rpmb)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u81ea\u5df1\u7f16\u5199\r\n#\u00a0vim\u00a0\/etc\/yum.repos.d\/epel.repo\r\n[epel]\r\nname=epel\r\nbaseurl=http:\/\/dl.fedoraproject.org\/pub\/epel\/7\/x86_64\r\nenabled=1\r\ngpgcheck=0\u00a0\r\n\u914d\u7f6e\u5b8c\u4e0a\u9762\u4e09\u4e2ayum\u540e\r\n#\u00a0yum\u00a0clean\u00a0all\r\n#\u00a0yum\u00a0makecache\u00a0fast<\/pre>\n<h3>\u57fa\u672c\u64cd\u4f5c\u516d:\u8f93\u5165\u6cd5\u914d\u7f6e<\/h3>\n<p>\u9ed8\u8ba4\u53ea\u6709\u62fc\u97f3\u4e2d\u6587\u8f93\u5165\u6cd5\uff0c\u9700\u8981\u4f7f\u7528\u6781\u70b9\u4e94\u7b14\u8f93\u5165\u6cd5\uff0c\u5b89\u88c5\u8fc7\u7a0b\u5982\u4e0b:<\/p>\n<pre class=\"prism-highlight prism-language-php\">#\u00a0yum\u00a0install\u00a0ibus\u00a0ibus-table-chinese-wubi-jidian\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u5b89\u88c5\u5b8c\u540e\uff0c\u9700\u8981\u53f3\u4e0a\u89d2\u628a\u7528\u6237\u6ce8\u9500\u91cd\u767b\u5f55\u00a0\r\n\u5de6\u4e0a\u89d2applications--system\u00a0tools\u00a0--\u00a0settions\u00a0--\u00a0Region\u00a0&amp;\u00a0Language\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u00a0+\u6216-\u4f60\u7684\u8f93\u5165\u6cd5\u5c31\u53ef\u4ee5\u4e86\u00a0\r\n\u52a0\u5b8c\u4e4b\u540e\uff0c\u4f7f\u7528super+space\u952e\u8fdb\u884c\u5207\u6362<\/pre>\n<h3>\u57fa\u672c\u64cd\u4f5c\u4e03:\u65f6\u95f4\u540c\u6b65<\/h3>\n<pre class=\"prism-highlight prism-language-php\">#\u00a0yum\u00a0install\u00a0ntp\u00a0\u00a0ntpdate\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u5b89\u88c5ntp\u65f6\u95f4\u540c\u6b65\u76f8\u5173\u8f6f\u4ef6\u5305\r\n#\u00a0vim\u00a0\/etc\/ntp.conf\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u786e\u8ba4\u914d\u7f6e\u6587\u4ef6\u91cc\u6709\u4e0b\u5217\u7684\u65f6\u95f4\u540c\u6b65\u6e90\r\nserver\u00a00.rhel.pool.ntp.org\u00a0iburst\r\nserver\u00a01.rhel.pool.ntp.org\u00a0iburst\r\nserver\u00a02.rhel.pool.ntp.org\u00a0iburst\r\nserver\u00a03.rhel.pool.ntp.org\u00a0iburst\r\n#\u00a0systemctl\u00a0enable\u00a0ntpd\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u8bbe\u7f6e\u5f00\u673a\u81ea\u52a8\u542f\u52a8ntpd\r\n#\u00a0systemctl\u00a0start\u00a0ntpd\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u7acb\u5373\u542f\u52a8ntpd\u670d\u52a1\r\n#\u00a0date\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u786e\u8ba4\u65f6\u95f4\u4e0e\u73b0\u5728\u65f6\u95f4\u4e00\u81f4\r\n#\u00a0ntpdate\u00a00.rhel.pool.ntp.org\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u5982\u679c\u8fd8\u6ca1\u6709\u540c\u6b65\u6210\u529f\uff0c\u4f60\u53ef\u4ee5\u7528\u6b64\u547d\u4ee4\u624b\u52a8\u540c\u6b65\u4e00\u4e0b\r\n\u53e6\u5916\u4e00\u4e2a\u65f6\u95f4\u670d\u52a1\u5668\u7684\u642d\u5efa\u65b9\u6cd5\r\n#\u00a0yum\u00a0install\u00a0xinetd\u00a0-y\r\n#\u00a0vim\u00a0\/etc\/xinet.d\/time-dgram\r\ndisable\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0=\u00a0no\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(--yes\u6539\u4e3ano)\r\n#\u00a0vim\u00a0\/etc\/xinetd.d\/time-stream\r\ndisable\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0=\u00a0no\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(--yes\u6539\u4e3ano)\r\n#\u00a0systemctl\u00a0restart\u00a0xinetd\r\n#\u00a0systemctl\u00a0status\u00a0xinetd\r\n#\u00a0systemctl\u00a0enable\u00a0xinetd\r\n\u5ba2\u6237\u7aef\u540c\u6b65\u65f6\u95f4\u7684\u7528\u6cd5\r\n#\u00a0rdate\u00a0-s\u00a0\u65f6\u95f4\u670d\u52a1\u5668\u7684ip<\/pre>\n<h3>\u57fa\u672c\u64cd\u4f5c\u516b:\u6709\u4e9b\u547d\u4ee4\u7684\u53c2\u6570\u53ef\u4ee5\u81ea\u52a8\u8865\u5168\uff0c\u5982\u679c\u4e0d\u80fd\u8865\u5168\uff0c\u5219\u5b89\u88c5\u4e0b\u9762\u7684\u547d\u4ee4\uff08\u53ef\u80fd\u9700\u8981\u6ce8\u9500\u4e00\u4e0b\uff09<\/h3>\n<pre class=\"prism-highlight prism-language-php\">#\u00a0yum\u00a0install\u00a0bash-completion<\/pre>\n<h3>\u57fa\u672c\u64cd\u4f5c\u4e5d:vnc\u7684\u914d\u7f6e<\/h3>\n<pre class=\"prism-highlight prism-language-php\">#\u00a0vncpasswd\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--\u8bbe\u5b9avcn\u8fde\u63a5\u7684\u5bc6\u7801\r\nPassword:\r\nVerify:\r\n#\u00a0x0vncserver\u00a0--PasswordFile=\/root\/.vnc\/passwd\u00a0--AlwaysShared=on\u00a0--AcceptKeyEvents=off\u00a0AcceptPointerEvents=off\u00a0&amp;&gt;\u00a0\/dev\/null\u00a0&amp;<\/pre>\n<h3><\/h3>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5\u5b8ccentos7.3\u540e\uff0c\u505a\u4e00&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-782","post","type-post","status-publish","format-standard","hentry","category-7"],"_links":{"self":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts\/782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=782"}],"version-history":[{"count":3,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts\/782\/revisions"}],"predecessor-version":[{"id":1690,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=\/wp\/v2\/posts\/782\/revisions\/1690"}],"wp:attachment":[{"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hkc.nasclub.vip\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}