HugeServer Knowledgebase

How to config Time and Date on CentOS 6 (NTP)

NTP (Network Time Protocol) is a protocol which runs over port 123 UDP. NTP synchronize clients time and date with a master server.

This tutorial is about the client side configuration, but the server side configurations are not entirely different.

We are assuming that you have root permission, otherwise, you may start commands with “sudo”.

Install and configure NTP Daemon

The NTP package is provided by default from RHEL repositories, and can be installed by the following command:

 yum install ntp

To make sure that the appropriate time zone is configured on the server please execute below command.

 date

If you wish to change the timezone, go to the following path to see available time zones:

 ls -la /usr/share/zoneinfo/

As it appears some of the time zones are available in the folder but the others are in the sub-directories. For example, we are going to change the time zone to Los Angeles.

mv /etc/localtime /etc/localtime.back
ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

You have to start the NTP service with the command below:

service ntpd start

To make NTP run at startup:

 chkconfig ntpd on

To check if the NTP is working properly:

 ntpstat

To confirm if the date has been successfully synchronized and time zone is correct.

 date

We are done! If you have any comment or question please let us know.

Was this tutorial helpful?

Thank you for your vote.Thank you for your vote.

Similar Posts

2 thoughts on “How to config Time and Date on CentOS 6 (NTP)”

  1. Is it possible to add how to configure ntp/ntpd to only run as a client, not as a client and server? Default configuration appears to run as a server too, answering queries from any IP that asks – thinking DDoS attack participation angle.

Leave a Reply

Your email address will not be published. Required fields are marked *

*