{"id":2404,"date":"2025-08-11T12:33:56","date_gmt":"2025-08-11T04:33:56","guid":{"rendered":"https:\/\/www.hgfwq.com\/blog\/?p=2404"},"modified":"2025-08-11T12:33:56","modified_gmt":"2025-08-11T04:33:56","slug":"centos-%e8%87%aa%e5%8a%a8%e5%af%b9%e6%97%b6%e8%ae%be%e7%bd%ae%e4%b8%8e%e9%85%8d%e7%bd%ae%e8%af%a6%e7%bb%86%e6%ad%a5%e9%aa%a4%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"https:\/\/www.hgfwq.com\/blog\/2404.html","title":{"rendered":"CentOS \u81ea\u52a8\u5bf9\u65f6\u8bbe\u7f6e\u4e0e\u914d\u7f6e\u8be6\u7ec6\u6b65\u9aa4\u89e3\u6790"},"content":{"rendered":"<p><p><strong>CentOS \u81ea\u52a8\u5bf9\u65f6<\/strong><\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.hgfwq.com\/blog\/wp-content\/uploads\/2025\/07\/0P55184DRt.jpg\" alt=\"CentOS \u81ea\u52a8\u5bf9\u65f6\u8bbe\u7f6e\u4e0e\u914d\u7f6e\u8be6\u7ec6\u6b65\u9aa4\u89e3\u6790\" title=\"CentOS \u81ea\u52a8\u5bf9\u65f6\u8bbe\u7f6e\u4e0e\u914d\u7f6e\u8be6\u7ec6\u6b65\u9aa4\u89e3\u6790\"><\/p>\n<\/p>\n<p><p>\u672c\u6587\u5c06\u6307\u5bfc\u60a8\u5982\u4f55\u5728CentOS\u670d\u52a1\u5668\u4e0a\u8bbe\u7f6e\u81ea\u52a8\u5bf9\u65f6\u529f\u80fd\u3002\u81ea\u52a8\u5bf9\u65f6\u786e\u4fdd\u670d\u52a1\u5668\u7684\u65f6\u95f4\u4fdd\u6301\u51c6\u786e\uff0c\u8fd9\u5bf9\u4e8e\u65e5\u5fd7\u8bb0\u5f55\u3001\u540c\u6b65\u548c\u5176\u4ed6\u65f6\u95f4\u654f\u611f\u7684\u64cd\u4f5c\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<\/p>\n<p><h2>\u64cd\u4f5c\u524d\u7684\u51c6\u5907<\/h2>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u7684CentOS\u670d\u52a1\u5668\u5df2\u7ecf\u5b89\u88c5\u4e86\u7f51\u7edc\u8fde\u63a5\uff0c\u5e76\u4e14\u53ef\u4ee5\u8bbf\u95ee\u4e92\u8054\u7f51\u3002<\/p>\n<\/p>\n<p><h2>\u5b8c\u6210\u4efb\u52a1\u7684\u8be6\u7ec6\u64cd\u4f5c\u6b65\u9aa4<\/h2>\n<\/p>\n<p><h3>1. \u786e\u8ba4\u5f53\u524d\u65f6\u533a\u8bbe\u7f6e<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u8ba4\u670d\u52a1\u5668\u5f53\u524d\u7684\u65f6\u533a\u8bbe\u7f6e\u662f\u5426\u6b63\u786e\u3002<\/p>\n<\/p>\n<p><pre><code>timedatectl<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u65f6\u533a\u4e0d\u6b63\u786e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u4fee\u6539\u5b83\uff1a<\/p>\n<\/p>\n<p><pre><code>timedatectl set-timezone <Your_Time_Zone><\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u5c06\u65f6\u533a\u8bbe\u7f6e\u4e3a\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4\uff1a<\/p>\n<\/p>\n<p><pre><code>timedatectl set-timezone America\/New_York<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u5b89\u88c5 chronyd<\/h3>\n<\/p>\n<p><p>Chronyd\u662f\u4e00\u4e2a\u7528\u4e8e\u540c\u6b65\u7cfb\u7edf\u65f6\u949f\u7684\u5b88\u62a4\u8fdb\u7a0b\uff0c\u6211\u4eec\u5c06\u4f7f\u7528\u5b83\u6765\u81ea\u52a8\u5bf9\u65f6\u3002<\/p>\n<\/p>\n<p><pre><code>yum install chronyd<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3. \u914d\u7f6e chronyd<\/h3>\n<\/p>\n<p><p>\u7f16\u8f91 chronyd \u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4ee5\u4fbf\u5b83\u53ef\u4ee5\u4eceNTP\u670d\u52a1\u5668\u81ea\u52a8\u540c\u6b65\u65f6\u95f4\u3002<\/p>\n<\/p>\n<p><pre><code>vi \/etc\/chrony.conf<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u786e\u4fdd\u5305\u542b\u4ee5\u4e0b\u884c\u6216\u7c7b\u4f3c\u884c\uff0c\u8fd9\u4e9b\u884c\u6307\u5b9a\u4e86NTP\u670d\u52a1\u5668\uff1a<\/p>\n<\/p>\n<p><pre><code>server ntp.ubuntu.com iburst<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u60a8\u53ef\u4ee5\u6839\u636e\u9700\u8981\u6dfb\u52a0\u591a\u4e2a\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<p><h3>4. \u542f\u52a8\u548c\u542f\u7528 chronyd \u670d\u52a1<\/h3>\n<\/p>\n<p><p>\u542f\u52a8 chronyd \u670d\u52a1\u5e76\u786e\u4fdd\u5b83\u5728\u7cfb\u7edf\u542f\u52a8\u65f6\u81ea\u52a8\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><pre><code>systemctl start chronyd<\/p>\r\n<p>systemctl enable chronyd<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>5. \u9a8c\u8bc1 chronyd \u670d\u52a1\u72b6\u6001<\/h3>\n<\/p>\n<p><p>\u786e\u8ba4 chronyd \u670d\u52a1\u6b63\u5728\u8fd0\u884c\uff0c\u5e76\u4e14\u65f6\u95f4\u540c\u6b65\u6b63\u5728\u8fdb\u884c\u3002<\/p>\n<\/p>\n<p><pre><code>systemctl status chronyd<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u5e94\u663e\u793a &#8220;active (running)&#8221; \u5e76\u4e14\u5728 &#8220;Last checked&#8221; \u548c &#8220;Last synchronized&#8221; \u4e4b\u95f4\u5b58\u5728\u65f6\u95f4\u5dee\uff0c\u8fd9\u8868\u660e\u65f6\u95f4\u540c\u6b65\u6b63\u5728\u8fdb\u884c\u3002<\/p>\n<\/p>\n<p><h2>\u6d89\u53ca\u7684\u5173\u952e\u547d\u4ee4\u3001\u4ee3\u7801\u6216\u914d\u7f6e\u793a\u4f8b<\/h2>\n<\/p>\n<ul>\n<li><strong>timedatectl<\/strong>: \u67e5\u770b\u548c\u7ba1\u7406\u7cfb\u7edf\u65f6\u95f4\u65e5\u671f\u3002<\/li>\n<li><strong>yum install chronyd<\/strong>: \u5b89\u88c5 chronyd \u670d\u52a1\u3002<\/li>\n<li><strong>vi \/etc\/chrony.conf<\/strong>: \u7f16\u8f91 chronyd \u914d\u7f6e\u6587\u4ef6\u3002<\/li>\n<li><strong>systemctl start chronyd<\/strong>: \u542f\u52a8 chronyd \u670d\u52a1\u3002<\/li>\n<li><strong>systemctl enable chronyd<\/strong>: \u8bbe\u7f6e chronyd \u670d\u52a1\u5728\u542f\u52a8\u65f6\u81ea\u52a8\u8fd0\u884c\u3002<\/li>\n<li><strong>systemctl status chronyd<\/strong>: \u68c0\u67e5 chronyd \u670d\u52a1\u72b6\u6001\u3002<\/li>\n<\/ul>\n<p><h2>\u64cd\u4f5c\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898\u3001\u6ce8\u610f\u4e8b\u9879\u6216\u76f8\u5173\u6280\u5de7<\/h2>\n<\/p>\n<ul>\n<li>\u5982\u679cNTP\u670d\u52a1\u5668\u54cd\u5e94\u7f13\u6162\u6216\u4e0d\u53ef\u7528\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u6dfb\u52a0\u5176\u4ed6NTP\u670d\u52a1\u5668\u5730\u5740\u3002<\/li>\n<li>\u786e\u4fdd\u60a8\u7684\u9632\u706b\u5899\u5141\u8bb8 chronyd \u4f7f\u7528\u7aef\u53e3123\uff08UDP\uff09\u8fdb\u884c\u901a\u4fe1\u3002<\/li>\n<li>\u5982\u679c\u670d\u52a1\u5668\u4f4d\u4e8e\u7f51\u7edc\u9694\u79bb\u73af\u5883\u4e2d\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u914d\u7f6eNTP\u4e2d\u7ee7\u6216\u76f4\u63a5\u8054\u7cfb\u7f51\u7edc\u7ba1\u7406\u5458\u3002<\/li>\n<\/ul>\n<p>&#8220;`<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CentOS \u81ea\u52a8\u5bf9\u65f6 \u672c\u6587\u5c06\u6307\u5bfc\u60a8\u5982\u4f55\u5728CentOS\u670d\u52a1\u5668\u4e0a\u8bbe\u7f6e\u81ea\u52a8\u5bf9\u65f6\u529f\u80fd\u3002\u81ea\u52a8\u5bf9\u65f6\u786e\u4fdd\u670d\u52a1\u5668\u7684\u65f6\u95f4\u4fdd\u6301\u51c6\u786e\uff0c\u8fd9\u5bf9\u4e8e\u65e5\u5fd7\u8bb0\u5f55\u3001\u540c\u6b65\u548c\u5176\u4ed6\u65f6\u95f4\u654f\u611f\u7684\u64cd\u4f5c\u81f3\u5173\u91cd\u8981\u3002 \u64cd\u4f5c\u524d\u7684\u51c6\u5907 \u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u7684CentOS\u670d\u52a1\u5668\u5df2\u7ecf\u5b89\u88c5\u4e86\u7f51\u7edc\u8fde\u63a5\uff0c&#8230;<\/p>\n","protected":false},"author":1,"featured_media":2405,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[117,788,789],"topic":[],"class_list":["post-2404","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-haiwai","tag-centos","tag-788","tag-789"],"_links":{"self":[{"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/posts\/2404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/comments?post=2404"}],"version-history":[{"count":1,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/posts\/2404\/revisions"}],"predecessor-version":[{"id":2407,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/posts\/2404\/revisions\/2407"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/media\/2405"}],"wp:attachment":[{"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/media?parent=2404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/categories?post=2404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/tags?post=2404"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hgfwq.com\/blog\/wp-json\/wp\/v2\/topic?post=2404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}