Set Up Time Synchronization on CentOS 7

In this tutorial from the Orcacore website, we want to teach you How To Set Up Time Synchronization on CentOS 7. Time synchronization is the process of coordinating the time of independent clocks. Clocks and timepieces often utilize relatively low-cost components that are not particularly precise. Many will drift by several seconds each day.

Even clocks set to identical times will differ significantly after a relatively short period. In modern computing, clock drift can be a severe problem.

  • The process of coordinating the clocks of computers is vitally important.
  • Without synchronization, clocks will diverge.
  • Modern distributed computer systems rely on clock coordination.
  • GPS and GNSS systems are essential sources of accurate time.
  • Protocols such as NTP and PTP synchronize networks of computers.

Network Time Protocol (NTP) was developed to coordinate the time of the Internet and networked computers. It is one of the oldest Internet protocols still in use today.

Steps To Set Up Time Synchronization on CentOS 7

To set up time synchronization, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on the Initial Server Setup with CentOS 7.

Now follow the steps below to complete this guide.

1. Check Current Time Zone And Clock on CentOS 7

The most basic command to find out the time on your server is “date”. Any user can run the following command to check the date and time on CentOS 7:

sudo date
Output
Sat Oct  1 04:35:48 EDT 2022

Note: Most often, your server will default to the UTC zone. UTC is Coordinated Universal Time, the time at zero degrees longitude. Also, using Universal Time reduces confusion when your infrastructure spans multiple time zones.

If you have requirements and need to change the time zone on CentOS 7, you can use the “timedatectl” command.

First, list the available time zones on CentOS 7 with the following command:

sudo timedatectl list-timezones

In your output, you will see a list of available time zones on CentOS 7.

When you find the correct time zone, use the following command to set the time zone:

sudo timedatectl set-timezone America/New_York

Remember to replace the time zone you have found in the list.

Now that you know how to check the time zone and clock on CentOS 7, let’s install and start NTP.

2. Install NTP and Check the ntpd Status on CentOS 7

To install NTP on your server, you can use the following command:

sudo yum install ntp -y

Then, restart your service with the following command:

sudo systemctl restart ntpd

Verify that the service is active and running on your server:

sudo systemctl status ntpd

In your output, you will see:

Check NTP Service Status

To get more information about the status of ntpd, you can use the following command:

ntpq -p

Your output should be similar to this:

information about the status of ntpd

Your output will be different.

If everything went well, then your date and time should be synchronized from the NTP Server on CentOS 7. You can verify your timezone with the following command:

timedatectl
Check NTP is synchronized

NTP synchronized: yes” means that the time on CentOS 7 has been successfully synced, and “NTP enabled: yes” means that timesyncd is enabled and running.

Conclusion

In conclusion, managing system time on CentOS 7 involves viewing the current time with timedatectl, changing the time zone as needed, and using ntpd to synchronize time automatically. These tools ensure accurate system time, which is essential for logs, scheduled tasks, and network operations.

Hope you enjoy it. Please subscribe to us on Facebook, Instagram, and YouTube.

You may also like these guides:

Set up and Configure Apache Cassandra on CentOS 7

How To Install OpenCV on CentOS 7

How To Install TensorFlow on CentOS 7

Install and Configure VNC on CentOS 7

Share your love

Stay informed and not overwhelmed, subscribe now!