• Home
  • About Us
  • Contact
  • Privacy Policy

LinuxAdmin.io

  • Home
  • Tutorials
    • System Administration
    • Linux Tutorials
    • Web Hosting
    • WordPress
    • Virtualization
    • Troubleshooting
    • OpenStack

How To Install NTPD On CentOS 7

Install And Configure NTPD

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.

Install NTPD

First you will want to install ntp, this is found in the default repostory

yum -y install ntp

CentOS 7 ships with chronyd as a default package, so you will want to disable that as well

Stop the service:

systemctl stop chronyd.service

Disable the service:

systemctl disable chronyd.service

Both chronyd and ntpd be used at the same time.

Configure NTP

You will then want to locate the closest timeservers to you you can find them here In this case we are going to leave the default servers that ship with the rpm

server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

Adding or removing servers would be done in /etc/ntp.conf

Enable And Start NTP

You will then want to start the ntpd service

systemctl start ntpd

And make sure the service will start on reboot

systemctl enable ntpd

You will also want to allow ntp in the firewall

firewall-cmd --add-service=ntp --permanent

Then reload the firewall

firewall-cmd --reload

You can then verify it has is working correctly

# systemctl status ntpd
● ntpd.service - Network Time Service
 Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
 Active: active (running) since Mon 2017-07-31 13:27:12 EDT; 5min ago
 Main PID: 810 (ntpd)
 CGroup: /system.slice/ntpd.service
 └─810 /usr/sbin/ntpd -u ntp:ntp -g

You are looking for the ‘active (running)’ statement. That is it for installing ntpd.

Performing A Manual NTP Sync

How to perform a manual update of the system clock with ntp

First stop the service to free up the port (123) to be used for the manual update:

systemctl stop ntpd

Run the update:

# ntpd -gq
ntpd: time slew +0.009586s

-g is to update the time no matter how much of a offset.
-q is to exit immediately after setting the time.

Regard ntpd service:

systemctl start ntpd

That is all that is required for a manual sync.

Jul 31, 2017LinuxAdmin.io
0 0 votes
Article Rating
How To Install Memcached on CentOSHow to Save PHP Sessions in Memcached
You Might Also Like
 
Piwik Analytics on Nginx
 
Recover A Root Password On CentOS
Subscribe
Notify of
guest

guest

0 Comments
Inline Feedbacks
View all comments
7 years ago Linux System Administration, Linux Tutorials centos11,433
Recent Posts
  • Configuring Firewalld to Work Seamlessly with Docker on CentOS
  • Mastering NGINX Tuning: Optimizing Web Server Performance
  • Exploring eBPF: Revolutionizing Network and System Monitoring
  • Kubernetes: Installation and Overview on CentOS 8
  • Install Docker on Centos 8
Most Commented
Hot Clone Linux Server with Rsync
Hot Clone A CentOS Server With Rsync
14 Comments
ngx_cache_purge module
Install The ngx_cache_purge Module In Nginx
8 Comments
piwik-nginx
Piwik Analytics on Nginx
8 Comments
Tags
linuxcentosLinux Performance Tuningsysadminkvmnetworkingmemcachedanalyticssystemd
About

We love Linux and are dedicated to creating Linux administration tutorials for System Administrators since 2016.

Most Viewed
Default Gateway
How To Configure A Default Gateway on CentOS
76,148 views
Zend Opcache
Setup and Optimize Zend OpCache
47,105 views
Install ffmpeg
FFMpeg Install On CentOS 7
21,675 views
Archives
Email subscription

Sign up for our newsletter to receive the latest news and event postings.

2018 © LinuxAdmin.io
wpDiscuz