How To Install ntp on CentOS 7

In this tutorial we learn how to install ntp on CentOS 7. ntp is The NTP daemon and utilities

Introduction

In this tutorial we learn how to install ntp on CentOS 7.

What is ntp

The Network Time Protocol (NTP) is used to synchronize a computer’s time with another reference time source. This package includes ntpd (a daemon which continuously adjusts system time) and utilities used to query and configure the ntpd daemon. Perl scripts ntp-wait and ntptrace are in the ntp-perl package, ntpdate is in the ntpdate package and sntp is in the sntp package. The documentation is in the ntp-doc package.

We can use yum or dnf to install ntp on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install ntp.

Install ntp on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install ntp using yum by running the following command:

sudo yum -y install ntp

Install ntp on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install ntp using dnf by running the following command:

sudo dnf -y install ntp

How To Uninstall ntp on CentOS 7

To uninstall only the ntp package we can use the following command:

sudo dnf remove ntp

References

Summary

In this tutorial we learn how to install ntp on CentOS 7 using yum and dnf.