Time Synchronization in the network is one of the most important things to do in virtual machines. Note that not synchronizing time can lead to network failure. In this article, we are going to teach you How to Set up Time Synchronization on AlmaLinux. Time Synchronization can help to record your logs in the correct order and apply database updates. If you don’t have Time Synchronization, you may encounter data corruption, errors, and other issues that are difficult to debug. Accurate timekeeping has become a critical component of modern software deployments. Time Synchronization is the most vital part of AlmaLinux. Keeping different clocks on one server is a very interesting task to keep your system time up to date.
– A non-root sudo enabled user
– AlmaLinux Server
If you want to buy a Linux VPS server, we suggest you to use the plans provided on our website, which have great performance and high location diversity.
At first, you can print out the date and time by entering the following command:
The server often will default to the UTC time zone, which is the Coordinated Universal Time, the time at zero degrees longitude. If your infrastructure spans multiple time zones, continued use of Universal Time will reduce confusion.
If you have different requirements and need to change the time zone, you should list the available time zones by running the following command:
A list of time zones is printed on the screen. You can press SPACE to page down, and b to page up. If you find the correct time zone, you should write it down and then type q to exit the list.
In this step, set the time zone with the following command, remember to replace the time zone you found in the list in the following command. You should use the following command to make a change:
sudo timedatectl set-timezone America/New_York
Now enter the following command again to verify the changes:
Make sure the time zone abbreviation reflects the newly selected value.
Most network time synchronization was done by the Network Time Protocol daemon or ntpd. The service connects to a pool of other NTP servers that provide constant and accurate time updates.
Now timesyncd is used instead of ntpd. timesyncd connects to the same servers and works in much the same way.
You should run the following command to query the timesyncd status. Note that you don’t need to use sudo in this case:
Local time: Wed 2021-11-03 17:49:25 EDT Universal time: Wed 2021-11-03 17:49:25 UTC RTC time: Wed 2021-11-03 17:49:25 Time zone: Amercia/New_York (EDT, -0400) System clock synchronized: yes systemd-timesyncd.service active: yes RTC in local TZ: no
The above output prints out the local time, universal time, and some network time status information.
System clock synchronized: yes indicates successful time synchronization
systemd-timesyncd.service active: yes indicates timesyncd is enabled and running.
You can turn on timesyncd by running the following command:
sudo timedatectl set-ntp on
You should run timedatectl again to confirm the network time status. It may take a minute for actual synchronization to occur, but eventually, both Network time on: and NTP synchronized: time should be yes.
Note that some very time-sensitive applications may be better used by ntpd because they use more sophisticated techniques to keep system time on track.
You should turn off timesyncd before installing ntpd by entering the following command:
sudo timedatectl set-ntp no
You can check that timesyncd is off with the following command:
systemd-timesyncd.service active: no indicates that timeyncd has stopped. Now you can install the ntp package by entering the following command:
sudo apt update sudo apt install ntp
ntpd starts automatically after installation. To check the status of ntpd, enter the following command:
ntpq is a query tool for ntpd. The -p flag asks for information about NTP servers to which ntpd is connected. Note that the ntpd connection may take a few minutes.
This article taught you how to set up Time Synchronization on AlmaLinux. Also, this tutorial showed you how to view the system time, change time zones, work with timesyncd, and install ntpd. I hope this article was useful for you.
How useful was this post?
Click on a star to rate it!
Average rating 5 / 5. Vote count: 1
No votes so far! Be the first to rate this post.
In this article, we are going to teach you How to Install SQLite on AlmaLinux 8. Storing and retriev...
What is your opinion about this Blog?