NTP on Oracle Linux 8

Photo by Agê Barros on Unsplash


NTP or Network Time Protocol is an old and vastly used protocol which is used to synchronize time on computers over the network. This protocol is stable and actively supported. But RHEL Linux 8(on which Oracle Linux 8 is based), NTP is no longer supported and is being replaced a new service called Chrony. The new service has no issues, but the purpose of this article is to describe how we can still use NTP on Oracle Linux 8. There can be many reasons for that such as:

  • Old Software and build dependencies
  • More support for NTP as this has been ported to many more Operating Systems
  • Support for Multicast, Broadcast and Manycast of time which are not supported by Chrony but are supported by NTP.
  • Etc


The following are the assumptions for this article:

  • You have installed 64 bit Oracle Linux 8 and have got root access
  • You have basic knowledge of Linux System Administration
  • You are familiar with Systemd Services.

Build NTP from Source

As NTP package or RPM is not provided from the official Oracle Linux 8,we will build it from source. Here are the steps to do this:

  1. Get the latest source code from http://www.ntp.org/downloads.html. Use the Production Release always.
  2. Copy the downloaded tar file to a Linux Machine which should have basic tools present by default.
  3. Compare the checksum of the tar file downloaded:-
md5sum ntp-4.2.8p15.tar.gz

The output should match with the value inside ntp-4.2.8p15.tar.gz.md5 file (which is also downloaded from the same link)

4. Extract the content:

tar -xvzf ntp-4.2.8p15.tar.gz

5. Change directory:

cd ntp-4.2.8p15

6. Prepare for compilation:

./configure CFLAGS="-O2 -g -fPIC" --prefix=/usr --bindir=/usr/sbin --sysconfdir=/etc --enable-linuxcaps -with-lineeditlibs=readline --docdir=/usr/share/doc/ntp-4.2.8p15

7. Build using:


8. Make will build all the NTP and related exes. These can be reduced in size using the following commands:

cd ntpd
strip ntpd
cd ../ntpdc/
strip ntpdc
cd ../util/
strip ntp-keygen
strip ntptime
strip tickadj
cd ../ntpq
strip ntpq
cd ../ntpdate/
strip ntpdate

Now copy these files on to the target Oracle Linux 8 machine in the following locations, along with the permissions mentioned:

/usr/sbin/ntpd        755
/usr/sbin/ntpdc 755
/usr/sbin/ntp-keygen 755
/usr/sbin/ntptime 755
/usr/sbin/tickadj 755
/usr/sbin/ntpq 755
/usr/sbin/ntpdate 755


cp ntpd /usr/sbin/ntpd
chmod 755 /usr/sbin/ntpd

Do the same for other executables.

Setting up NTP Sytemd Service

Now we have the executables ready, we will register them as a service so that it can be managed and used via systemctl. For that first create a new file on the target at location /etc/systemd/service with the following content.

Description=This service starts and control NTP Deamon
ExecStart=/usr/sbin/ntpd -u ntp:ntp -p /var/run/ntpd.pid -g

Name this file as ntpd.service . Replace XYZ.service with the service name after which you want to start the NTP service or else remove that “After=” line. Keep the permission of this file as 644:

chmod 644 /etc/systemd/service/ntpd.service

Disable the Chrony Service:

systemctl disable chronyd

Create user and directories for NTP Service:

useradd -r ntp -s /bin/nologin -m -d /etc/ntp
mkdir /var/lib/ntp
chown ntp:ntp /var/lib/ntp

Enable the NTP Service:

systemctl enable ntpd.service

Copy the previous NTP configuration or create the new desired one at location /etc/ntp.conf with permission 644

Reboot the server and check the status of the newly created NTP Service using:

[root]# systemctl status ntpd.service
● ntpd.service - This service starts and control NTP Deamon
Loaded: loaded (/etc/systemd/system/ntpd.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2022-04-05 20:14:51 GMT; 3 weeks 1 days ago
Process: 752 ExecStart=/usr/sbin/ntpd -u ntp:ntp -p /var/run/ntpd.pid -g (code=exited, status=0/SUCCESS)
Main PID: 789 (ntpd)
Tasks: 2 (limit: 35799)
Memory: 3.5M
CGroup: /system.slice/ntpd.service
└─789 /usr/sbin/ntpd -u ntp:ntp -p /var/run/ntpd.pid -g

Now use the basic NTP commands like ntpq -pn to check the syncronization status etc.


After doing these steps you should be able to run NTP on Oracle Linux 8. These steps can also be easily automated using bash scripting and can also be integrated to any CI pipelines.

If you like this article, then please consider following me. Thanks for reading.




Software Developer having keen interest in Security, Privacy and Pen-testing. Certs:- Security+,PenTest+,AZ900

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Finding the last date a date stamped item shows up in a table (SQL)

Getting Started Spring Boot Application on AWS — S3 (Part 2)


What’s cool in Azure — April 2019

Kotlin or Java for Beginners

Continuous Testing

Running GUI at Docker container with VQAnalyzer 5

The Definitive Guide To Building a New Service

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Software Developer having keen interest in Security, Privacy and Pen-testing. Certs:- Security+,PenTest+,AZ900

More from Medium

Getting to know Linux

Everyday Computer Security for Everyday Computer People

Linux Shell scripting loops :