How to Configure Your Ubuntu Time Sync

How to Configure Your Ubuntu Time Sync

To ensure your business records accurate logs, you’ll want to work on your timekeeping synchronization. Time synchronization will also come in handy when you want to update your database or debug issues related to data corruption or errors. In this post, we will guide you on how to configure your Ubuntu 22.04 time sync.

What is Ubuntu?

Ubuntu is a free and open-source software designed for computers, smartphones, and network servers. It’s widely used for personal purposes but can be used to run an organization, school, home, or business.

Why choose Ubuntu?

Ubuntu is not just a popular operating system for nothing. It has a lot to offer. Here are some reasons to choose Ubuntu.

  • It’s free: Downloading, using, and sharing Ubuntu is free.
  • High-security Ubuntu comes with a built-in firewall and virus protection software to protect you and your programs.
  • Great features: Ubuntu comes with all the essential applications you might need, from an office suite, email, browsers, and media apps.
  • Accessibility: Ubuntu is available in 50 different languages and has essential assistive technologies.

Requirements

Here’s what you need to get started with Ubuntu:

  • CPU: 1 gigahertz or better
  • 2.5 gigabytes disk or more
  • 1 gigabyte RAM or more
  • Server with stable internet access
  • Server with Sudo privileges
  • An operating system running Ubuntu 22.04 server with a non-root administrative user
Note
Special notes: Date and time on Ubuntu 22.04 is synchronized by default. However, to ensure a smooth operation of your server you may want to double check the settings are set as expected. You won’t need any software or additional programs to configure time and date on Ubuntu.

How to Configure Ubuntu time sync

Follow the following steps to set up time synchronization in Ubuntu:

The most commonly used time command on Ubuntu 18.04 is the date command. This command is used to check the time and date on an Ubuntu server:

ubuntu time sync

ubuntu time sync

ubuntu time sync

The timedatetecl command allows you to both query and change the system clock and its settings on Linux systems.

To display the current settings, use the command by itself with no arguments. You should get something like this:

ubuntu time sync

Common Time Zones:

A few examples of Europe:

ubuntu time sync

US

ubuntu time sync

Time and date changes are seldom needed since your system generally manages this from the time of installation using NTP. If you move or take your laptop on vacation with you, however, you might want to make some changes to accommodate your new location.

To change your settings, you need to use Sudo. However, sudo is only needed if your session is not with a privileged user.

If you try to change the timezone with a non-privileged user without sudo, you receive an error:

ubuntu time sync

With sudo:

ubuntu time syncubuntu time sync

$ sudo timedatectl set-timezoneAmerica/New_York

This will change your time zone to America/New_York. To check if this time zone was properly implemented, execute the command below:

$ sudo date

This will give you the output below:

SunOct 28 12:18:59 EDT 2018

ubuntu time sync

To check the time sync status on your Ubuntu 18.04 system, run the command below

$ sudo timedatectl

This will give you the following output:

ubuntu time sync

The value YES for the System clock synchronized proves that time is correctly synced, and the YES for the system time synced. Service actively indicated that time synced has been enabled and is running properly. In case the time synced is inactive, run the command below to turn it on;

$ sudo timedatectl set-ntpon

Once you enable time synced, execute the ttimedatectl to check the status of the network time.

A SPACE MUST EXISTS AFTER SET-NTP (set-ntp on)

With man timedatectl, we can check the help of the command.

ubuntu time sync

So we can enable or disable it at will by launching:

timedatectl set-NTP on (enabled)

timedatectl set-ntp off (disabled)

We can check the NTP status with the following command:

timedatectl (we actívate it and check, and then disable and check again to see how it changes)

timedatectl set-ntp on.

ubuntu time sync

timedatectl set-ntp off

ubuntu time sync

CHANGING TO NTPD:

We will install NTP, and it will automatically disable the system-time sync service. We will be able to use NTPQ to query our sync status; if we try to use it before switching to NTPD, we will receive the following error:

ubuntu time sync

So we proceed to install NTPD:

ubuntu time sync

Confirm installation with “y.”

ubuntu time sync

Now, we can not use the aforementioned commands of timedatectl:

ubuntu time sync

This is because now we are using NTPD and not time synced, which has been masked and disabled:

ubuntu time sync

Instead of timedatectl, now we can use ntpq (NTP Query) with the following arguments:

-pn

ubuntu time sync

ubuntu time sync

So, the ntpq –pn command returns:ubuntu time sync

This is what each column means:

Remote: Hostname or IP address of the time source used

Refid: where the remote server mentioned above obtains the time from

st: The stratum of the source (16 means the source is not in sync or unreachable)

t: the type of the time source. A few examples could be: 1 for a local hardware reflock, or u for an NTP server that has been accessed via unicast protocol

When: This is the time in which the last poll event took place. When this field reaches the pool value is when the next polling action takes place.

Poll: in seconds, the current polling interval

Reach: octal representation of the field reach status.

Delay: in milliseconds: the mean of the time needed to reach and receive a response from the time source

Offset: in milliseconds, the mean of the time offset

Jitter: in milliseconds, and indicator of variance of the packet delays from individual pollings.

NTPD uses port 123 UDP

ubuntu time sync

Conclusion

Replacing your current operating system with Ubuntu and configuring time is an uneasy process whether you’re using Windows or macOS or running Ubuntu alongside it.

If you follow the above steps, you’ll be able to configure Ubuntu 22.04 fast and easily.

Next Steps: What Now?

Here are some practices that cut through this guide:

  • Download and install Ubuntu
  • Create a database on Ubuntu
  • Use the date command to check the date and time on the Ubuntu server.
  • Use sudo to change the date and time settings.

Further Reading

If you want to learn more about Ubuntu and Ubuntu time synchronization, here are some of our resources that will help guide you.

FAQ's

Question: What does time Sync do?
Answer: Time sync enables accurate time stamping by each device you use on the network. This allows proper sorting of events into chronological order enabling any data to be easily detected and resolved.
Question: How do I fix the time on Ubuntu?
Answer: To fix time on Ubuntu, you’ll need to change the date and time settings.Head over to activities and search Settings. Select the date and time on the sidebar. Go ahead and switch on the date and time. Remember to do this when you have an internet connection.
Question: How do I stop Ubuntu from syncing my time?
Answer: You’ll need to disable network time synchronization using the command: sudo timedatectl set-ntp no.

How To Set up a VSFTPD Server on a CentOS 7 VPS or Dedicated Server

Brief Description FTP is usually insecure exposing clear-text passwords, userna
2 min read
Avi Ilinsky
Avi Ilinsky
Hosting Expert

How To Set up a VSFTPD Server on an Ubuntu 16.04 VPS or Dedicated Server

Brief Description FTP data is usually insecure since information (usernames, pa
2 min read
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert

How to use phpMyAdmin to develop a website (without MySQL experience)

Brief description A web developer who is not well versed into coding websites f
2 min read
Idan Cohen
Idan Cohen
Marketing Expert

How to Install MySQL on a Windows Web Server Running Apache

This tutorial will show you how to install the MySQL database on a Windows serve
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top