How to sync time using NTP in CentOS and Ubuntu servers?

Linux server users might have noticed that after adjusting the system clock to the correct time, server loses the correct time within a while. Keeping your system’s time up to date is important, especially when you have time critical cron tabs to execute or you are required to examine the logs from a particular time of the day. That's when the network time protocol (NTP) comes into the picture. In this article we will explain the steps to setup an NTP server on your machine to adjust your machine's clock regularly.


Network time protocol


Network time protocol (NTP) enables you to synchronize your server’s system time with a remote server periodically. Thus, you can keep your system time accurate by syncing with known time servers.


How do I Install NTP Server?


To install the NTP server issue following command.

For Ubuntu/Debian

sudo aptitude update
sudo aptitude install ntp

For CentOs

sudo yum install ntp


Set NTP service to run at boot time


Once NTP server is installed ensure that service will run at boot time by running.

For Ubuntu/ CentOS
sudo /sbin/chkconfig ntpd on


Start the NTP service


To make sure the NTP service starts after installing issue following command.

For Ubuntu / CentOS

sudo /etc/init.d/ntp start

By installing the NTP service your server is automatically setup to sync time with default NTP servers.

  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

Can I purchase additional RAM, Disk space and Bandwidth for VPS?

Yes, you can purchase additional RAM, DiskSpace, Bandwidth and vCPU resource during the VPS...

How to run ClamAV and Maldet together on cPanel server?

You may be familiar with ClamAV and Maldet scanner (aka Linux Malware Detect). They're widely...

Can I open APN port 2195 on my VPS?

You will get full administrative control of your VPS, therefore you can surely open/close any...

What if I exceed the bandwidth limit I am assigned with VPS?

Our system continually monitors the bandwidth usage of all our VPS. In case if your total monthly...

An error occurred while loading the hcpdriver module – R1Soft

R1soft CDP backup allows for full server backup and you can use it to perform the bare metal...