{"id":1015,"date":"2018-10-21T00:12:56","date_gmt":"2018-10-21T00:12:56","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=1015"},"modified":"2018-10-23T01:00:28","modified_gmt":"2018-10-23T01:00:28","slug":"how-to-install-ntpd-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/21\/how-to-install-ntpd-on-centos-7\/","title":{"rendered":"How To Install NTPD On CentOS 7"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/linuxadmin.io\/wp-content\/uploads\/2017\/07\/install_ntpd.png\" alt=\"Install And Configure NTPD\" width=\"667\" height=\"247\" \/><\/p>\n<p>NTP (Network Time Protocol) is a protocol which allows computers to synchronize time. NTPd is a daemon that maintains the system time in synchronization with other NTP servers. This prevents drift which is the slow inconsistency of time on computers internal clocks. Keeping system time accurate is particularly important for system logs, replication, and applications.<\/p>\n<h2>Install NTPD<\/h2>\n<p>First you will want to install ntp, this is found in the default repostory<\/p>\n<p>yum -y install ntp<\/p>\n<p>CentOS 7 ships with chronyd as a default package, so you will want to disable that as well<\/p>\n<p>Stop the service:<\/p>\n<p>systemctl stop chronyd.service<\/p>\n<p>Disable the service:<\/p>\n<p>systemctl disable chronyd.service<\/p>\n<p>Both chronyd and ntpd be used at the same time.<\/p>\n<h2>Configure NTP<\/h2>\n<p>You will then want to locate the closest timeservers to you you can find them <a href=\"http:\/\/www.pool.ntp.org\">here<\/a> In this case we are going to leave the default servers that ship with the rpm<\/p>\n<p>server 0.centos.pool.ntp.org iburst<br \/>\nserver 1.centos.pool.ntp.org iburst<br \/>\nserver 2.centos.pool.ntp.org iburst<br \/>\nserver 3.centos.pool.ntp.org iburst<\/p>\n<p>Adding or removing servers would be done in \/etc\/ntp.conf<\/p>\n<h2>Enable And Start NTP<\/h2>\n<p>You will then want to start the ntpd service<\/p>\n<p>systemctl start ntpd<\/p>\n<p>And make sure the service will start on reboot<\/p>\n<p>systemctl enable ntpd<\/p>\n<p>You will also want to allow ntp in the firewall<\/p>\n<p>firewall-cmd &#8211;add-service=ntp &#8211;permanent<\/p>\n<p>Then reload the firewall<\/p>\n<p>firewall-cmd &#8211;reload<\/p>\n<p>You can then verify it has is working correctly<\/p>\n<p># systemctl status ntpd<br \/>\n\u25cf ntpd.service &#8211; Network Time Service<br \/>\nLoaded: loaded (\/usr\/lib\/systemd\/system\/ntpd.service; enabled; vendor preset: disabled)<br \/>\nActive: active (running) since Mon 2017-07-31 13:27:12 EDT; 5min ago<br \/>\nMain PID: 810 (ntpd)<br \/>\nCGroup: \/system.slice\/ntpd.service<br \/>\n\u2514\u2500810 \/usr\/sbin\/ntpd -u ntp:ntp -g<\/p>\n<p>You are looking for the \u2018active (running)\u2019 statement. That is it for installing ntpd.<\/p>\n<h2>Performing A Manual NTP Sync<\/h2>\n<p>How to perform a manual update of the system clock with ntp<\/p>\n<p>First stop the service to free up the port (123) to be used for the manual update:<\/p>\n<p>systemctl stop ntpd<\/p>\n<p>Run the update:<\/p>\n<p># ntpd -gq<br \/>\nntpd: time slew +0.009586s<\/p>\n<p>-g is to update the time no matter how much of a offset.<br \/>\n-q is to exit immediately after setting the time.<\/p>\n<p>Regard ntpd service:<\/p>\n<p>systemctl start ntpd<\/p>\n<p>That is all that is required for a manual sync.<\/p>\n<p>Jul 31, 2017LinuxAdmin.io<\/p>\n<p><a href=\"https:\/\/linuxadmin.io\/install-ntpd-centos-7\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>NTP (Network Time Protocol) is a protocol which allows computers to synchronize time. NTPd is a daemon that maintains the system time in synchronization with other NTP servers. This prevents drift which is the slow inconsistency of time on computers internal clocks. Keeping system time accurate is particularly important for system logs, replication, and applications. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/21\/how-to-install-ntpd-on-centos-7\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How To Install NTPD On CentOS 7&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1015","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1015","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=1015"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1015\/revisions"}],"predecessor-version":[{"id":1376,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1015\/revisions\/1376"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=1015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=1015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=1015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}