{"id":43790,"date":"2024-10-06T10:23:14","date_gmt":"2024-10-06T02:23:14","guid":{"rendered":"https:\/\/server.hk\/cnblog\/43790\/"},"modified":"2024-10-06T10:23:14","modified_gmt":"2024-10-06T02:23:14","slug":"centos-7-%e9%83%a8%e7%bd%b2-ntp-%e6%99%82%e9%96%93%e4%bc%ba%e6%9c%8d%e5%99%a8-2","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/43790\/","title":{"rendered":"CentOS 7 \u90e8\u7f72 ntp \u6642\u9593\u4f3a\u670d\u5668"},"content":{"rendered":"<h1 id=\"centos-7-%e9%83%a8%e7%bd%b2-ntp-%e6%99%82%e9%96%93%e4%bc%ba%e6%9c%8d%e5%99%a8-aEPMYGVgXP\">CentOS 7 \u90e8\u7f72 NTP \u6642\u9593\u4f3a\u670d\u5668<\/h1>\n<p>\u5728\u73fe\u4ee3\u7684\u8a08\u7b97\u74b0\u5883\u4e2d\uff0c\u6642\u9593\u7684\u6e96\u78ba\u6027\u5c0d\u65bc\u7cfb\u7d71\u7684\u904b\u884c\u81f3\u95dc\u91cd\u8981\u3002\u7121\u8ad6\u662f\u4f3a\u670d\u5668\u7684\u65e5\u8a8c\u8a18\u9304\u3001\u6578\u64da\u5eab\u7684\u6642\u9593\u6233\uff0c\u9084\u662f\u7db2\u7d61\u61c9\u7528\u7684\u5354\u8abf\uff0c\u6e96\u78ba\u7684\u6642\u9593\u90fd\u80fd\u78ba\u4fdd\u7cfb\u7d71\u7684\u7a69\u5b9a\u6027\u548c\u53ef\u9760\u6027\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS 7 \u4e0a\u90e8\u7f72 NTP\uff08Network Time Protocol\uff09\u6642\u9593\u4f3a\u670d\u5668\uff0c\u4ee5\u78ba\u4fdd\u7cfb\u7d71\u6642\u9593\u7684\u6e96\u78ba\u6027\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af-ntp%ef%bc%9f-aEPMYGVgXP\">\u4ec0\u9ebc\u662f NTP\uff1f<\/h2>\n<p>NTP \u662f\u4e00\u7a2e\u7528\u65bc\u540c\u6b65\u8a08\u7b97\u6a5f\u7cfb\u7d71\u6642\u9593\u7684\u5354\u8b70\u3002\u5b83\u80fd\u5920\u901a\u904e\u7db2\u7d61\u5c07\u8a08\u7b97\u6a5f\u7684\u6642\u9418\u8207\u539f\u5b50\u9418\u6216\u5176\u4ed6\u9ad8\u7cbe\u5ea6\u6642\u9593\u6e90\u9032\u884c\u540c\u6b65\u3002NTP \u7684\u5de5\u4f5c\u539f\u7406\u662f\u901a\u904e\u4e00\u7cfb\u5217\u7684\u6642\u9593\u8acb\u6c42\u548c\u97ff\u61c9\u4f86\u8a08\u7b97\u5ef6\u9072\uff0c\u5f9e\u800c\u8abf\u6574\u672c\u5730\u6642\u9418\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%81%b8%e6%93%87-ntp%ef%bc%9f-aEPMYGVgXP\">\u70ba\u4ec0\u9ebc\u9078\u64c7 NTP\uff1f<\/h2>\n<ul>\n<li><strong>\u6e96\u78ba\u6027\uff1a<\/strong>NTP \u80fd\u5920\u63d0\u4f9b\u6beb\u79d2\u7d1a\u7684\u6642\u9593\u6e96\u78ba\u6027\uff0c\u5c0d\u65bc\u9700\u8981\u9ad8\u7cbe\u5ea6\u6642\u9593\u7684\u61c9\u7528\u5c24\u70ba\u91cd\u8981\u3002<\/li>\n<li><strong>\u53ef\u9760\u6027\uff1a<\/strong>NTP \u652f\u6301\u591a\u500b\u6642\u9593\u6e90\uff0c\u80fd\u5920\u5728\u67d0\u500b\u6e90\u5931\u6548\u6642\u81ea\u52d5\u5207\u63db\uff0c\u78ba\u4fdd\u6642\u9593\u540c\u6b65\u7684\u6301\u7e8c\u6027\u3002<\/li>\n<li><strong>\u6613\u65bc\u914d\u7f6e\uff1a<\/strong>\u5728 Linux \u7cfb\u7d71\u4e0a\uff0cNTP \u7684\u5b89\u88dd\u548c\u914d\u7f6e\u76f8\u5c0d\u7c21\u55ae\uff0c\u9069\u5408\u5404\u7a2e\u7528\u6236\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%9c%a8-centos-7-%e4%b8%8a%e5%ae%89%e8%a3%9d-ntp-aEPMYGVgXP\">\u5728 CentOS 7 \u4e0a\u5b89\u88dd NTP<\/h2>\n<p>\u4ee5\u4e0b\u662f\u5b89\u88dd\u548c\u914d\u7f6e NTP \u7684\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-1%ef%bc%9a%e5%ae%89%e8%a3%9d-ntp-%e5%a5%97%e4%bb%b6-aEPMYGVgXP\">\u6b65\u9a5f 1\uff1a\u5b89\u88dd NTP \u5957\u4ef6<\/h3>\n<pre><code>sudo yum install ntp -y<\/code><\/pre>\n<p>\u9019\u689d\u547d\u4ee4\u5c07\u5f9e CentOS \u7684\u5b98\u65b9\u5009\u5eab\u4e2d\u5b89\u88dd NTP \u5957\u4ef6\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-2%ef%bc%9a%e5%95%9f%e7%94%a8-ntp-%e6%9c%8d%e5%8b%99-aEPMYGVgXP\">\u6b65\u9a5f 2\uff1a\u555f\u7528 NTP \u670d\u52d9<\/h3>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u9700\u8981\u555f\u7528 NTP \u670d\u52d9\u4e26\u8a2d\u7f6e\u5176\u5728\u7cfb\u7d71\u555f\u52d5\u6642\u81ea\u52d5\u555f\u52d5\uff1a<\/p>\n<pre><code>sudo systemctl start ntpd\nsudo systemctl enable ntpd<\/code><\/pre>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-3%ef%bc%9a%e9%85%8d%e7%bd%ae-ntp-%e4%bc%ba%e6%9c%8d%e5%99%a8-aEPMYGVgXP\">\u6b65\u9a5f 3\uff1a\u914d\u7f6e NTP \u4f3a\u670d\u5668<\/h3>\n<p>\u9ed8\u8a8d\u60c5\u6cc1\u4e0b\uff0cNTP \u6703\u4f7f\u7528\u516c\u5171 NTP \u4f3a\u670d\u5668\u3002\u60a8\u53ef\u4ee5\u7de8\u8f2f NTP \u914d\u7f6e\u6587\u4ef6\u4ee5\u6307\u5b9a\u60a8\u5e0c\u671b\u4f7f\u7528\u7684 NTP \u4f3a\u670d\u5668\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6253\u958b\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre><code>sudo vi \/etc\/ntp.conf<\/code><\/pre>\n<p>\u5728\u6587\u4ef6\u4e2d\uff0c\u60a8\u53ef\u4ee5\u6dfb\u52a0\u6216\u4fee\u6539\u4f3a\u670d\u5668\u689d\u76ee\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><code>server 0.centos.pool.ntp.org iburst\nserver 1.centos.pool.ntp.org iburst\nserver 2.centos.pool.ntp.org iburst\nserver 3.centos.pool.ntp.org iburst<\/code><\/pre>\n<p>\u9019\u4e9b\u4f3a\u670d\u5668\u4f86\u81ea CentOS \u7684 NTP \u6c60\uff0c\u60a8\u4e5f\u53ef\u4ee5\u6839\u64da\u9700\u8981\u9078\u64c7\u5176\u4ed6 NTP \u4f3a\u670d\u5668\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-4%ef%bc%9a%e9%87%8d%e5%95%9f-ntp-%e6%9c%8d%e5%8b%99-aEPMYGVgXP\">\u6b65\u9a5f 4\uff1a\u91cd\u555f NTP \u670d\u52d9<\/h3>\n<p>\u5b8c\u6210\u914d\u7f6e\u5f8c\uff0c\u91cd\u555f NTP \u670d\u52d9\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/p>\n<pre><code>sudo systemctl restart ntpd<\/code><\/pre>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-5%ef%bc%9a%e6%aa%a2%e6%9f%a5-ntp-%e7%8b%80%e6%85%8b-aEPMYGVgXP\">\u6b65\u9a5f 5\uff1a\u6aa2\u67e5 NTP \u72c0\u614b<\/h3>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5 NTP \u7684\u540c\u6b65\u72c0\u614b\uff1a<\/p>\n<pre><code>ntpq -p<\/code><\/pre>\n<p>\u9019\u5c07\u986f\u793a\u7576\u524d NTP \u4f3a\u670d\u5668\u7684\u72c0\u614b\uff0c\u5305\u62ec\u5ef6\u9072\u3001\u504f\u5dee\u548c\u540c\u6b65\u72c0\u614b\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-aEPMYGVgXP\">\u7e3d\u7d50<\/h2>\n<p>\u5728 CentOS 7 \u4e0a\u90e8\u7f72 NTP \u6642\u9593\u4f3a\u670d\u5668\u662f\u4e00\u500b\u76f8\u5c0d\u7c21\u55ae\u7684\u904e\u7a0b\uff0c\u80fd\u5920\u986f\u8457\u63d0\u9ad8\u7cfb\u7d71\u7684\u6642\u9593\u6e96\u78ba\u6027\u3002\u901a\u904e\u4e0a\u8ff0\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u8f15\u9b06\u5730\u5b89\u88dd\u548c\u914d\u7f6e NTP\uff0c\u78ba\u4fdd\u60a8\u7684\u4f3a\u670d\u5668\u59cb\u7d42\u4fdd\u6301\u6e96\u78ba\u7684\u6642\u9593\u3002\u5982\u679c\u60a8\u9700\u8981\u9032\u4e00\u6b65\u7684\u652f\u6301\u6216\u5c0b\u627e\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u5728 CentOS 7 \u4e0a\u90e8\u7f72 NTP \u6642\u9593\u4f3a\u670d\u5668\uff0c\u78ba\u4fdd\u7cfb\u7d71\u6642\u9593\u6e96\u78ba\u540c\u6b65\uff0c\u63d0\u5347\u4f3a\u670d\u5668\u6027\u80fd\u8207\u7a69\u5b9a\u6027\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-43790","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43790","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=43790"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43790\/revisions"}],"predecessor-version":[{"id":43791,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43790\/revisions\/43791"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=43790"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=43790"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=43790"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}