CentOS / Redhat Linux: Install OpenNTPD To Synchronize The Local Clock

by on June 24, 2010 · 1 comment· LAST UPDATED June 24, 2010


OpenNTPD is a Unix system daemon implementing the Network Time Protocol to synchronize the local clock of a computer system with remote NTP servers. How do I install OpenNTPD under CentOS / RHEL / Fedora Linux instead of default NTPD client / server?

OpenNTPD offers simplicity and security over traditional NTPD. However, OpenNTPD isn't as accurate as the ntp.org daemon.

Install OpenNTPD

Download portable OpenNTPD version by visiting this page, enter:
# cd /tmp
# wget ftp://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/openntpd-3.9p1.tar.gz

Untar tar ball:
# tar -zxvf openntpd-3.9p1.tar.gz
# cd openntpd-3.9p1

To install OpenNTPD with default options, enter:
# ./configure
# make
# make install

Sample outputs:

/usr/bin/install -c -m 0755 -s ntpd /usr/local/sbin/ntpd
/usr/bin/install -c -m 644 ntpd.8.out /usr/local/man/man8/ntpd.8
/usr/bin/install -c -m 644 ntpd.conf.5.out /usr/local/man/man5/ntpd.conf.5
Please create a dedicated group for ntpd.
This is system-dependant, possibly:
# groupadd _ntp
Please create a dedicated user for ntpd and ensure it can
not be used to log in.  This is system-dependant, possibly:
# useradd -g _ntp -s /sbin/nologin -d /var/empty -c 'OpenNTP daemon' _ntp

Configure OpenNTPD

Type the following commands to create _ntp user and group to run OpenNTPD in its own jail:
# groupadd _ntp
# useradd -g _ntp -s /sbin/nologin -d /var/empty -c 'OpenNTP daemon' _ntp

Install startup script:
# cp contrib/redhat/ntpd /etc/init.d/openntpd
# chmod +x /etc/init.d/openntpd

Edit /etc/init.d/openntpd:
# vi /etc/init.d/openntpd
Add the following line before prog="ntpd" line:


Save and close the file. Edit /usr/local/etc/ntpd.conf, enter:
# vi /usr/local/etc/ntpd.conf
Make sur it listen on localhost and main server IP:

listen on
listen on
listen on
listen on ::1

Sync to a single server called ntp.example.com or ntp.isp.example.com:

server ntp.isp.example.com
# Use a random selection of 8 public stratum 2 servers
servers pool.ntp.org

Close and save the file.

Start OpenNTPD

Type the following command:
# /etc/init.d/openntpd start
Sample outputs:

Starting ntpd:                                             [  OK  ]

To stop openntpd, enter:
# /etc/init.d/openntpd stop
To restart openntpd, enter:
# /etc/init.d/openntpd restart

Verify OpenNTPD Is Working Or Not

Type the following command:
# tail -f /var/log/messages
Sample outputs:

Jun 23 20:48:16 txvip3 ntpd[31182]: listening on
Jun 24 01:48:16 txvip3 ntpd[31182]: listening on
Jun 24 01:48:16 txvip3 ntpd[31182]: listening on
Jun 24 01:48:16 txvip3 ntpd[31182]: ntp engine ready
Jun 24 01:48:36 txvip3 ntpd[31182]: peer now valid
Jun 24 01:48:37 txvip3 ntpd[31182]: peer now valid
Jun 24 01:48:40 txvip3 ntpd[31182]: peer now valid

Make sure it starts on reboot:
# chkconfig openntpd on
Type the following command to verify OpenNTPD (ntpd) running:
# netstat -tulpn
# netstat -tulpn | grep :123

Sample outputs:

udp        0      0     *                               31182/ntpd
udp        0      0   *                               31182/ntpd
udp        0      0     *                               31182/ntpd

See Also:

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 1 comment… read it below or add one }

1 sandeep May 13, 2013 at 1:03 pm


I followed all your steps on ubuntu but i could not get ntpd up after bootup. also the /etc/init.d/functions file is missing in ubuntu. Also
# tail -f /var/log/messages

is not printing anything for me even if i run it manually from command line.
same for
# netstat -tulpn | grep :123

Please help me.


Leave a Comment

Tagged as: , , , , , , , , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: