How to Configure Timezone and NTP on Ubuntu

Setting the correct time on your computer may seem like a small task. But when you’re running a server or doing anything time-sensitive, it becomes pretty important. I’ve had times where my logs were all out of order, or backups ran at the wrong hour—all because my server’s time was off.

In this article, I’ll show you how to set the right timezone and enable NTP (Network Time Protocol) on Ubuntu. Don’t worry if those words sound new. I’ll explain them clearly and walk you through the steps I use myself.


What Are Timezone and NTP?

Let’s start with some basics.

A timezone tells your system what time it is in your part of the world. For example, if you live in Jakarta, you’re in the Asia/Jakarta timezone. If your computer is in a different timezone, the system clock can show the wrong time—even if the time itself is ticking correctly.

NTP, short for Network Time Protocol, is a way for your computer to sync its clock with a time server. These time servers are super accurate. They help keep your system’s time in check, even if your hardware clock drifts.

Without NTP, your system might slowly lose or gain seconds, minutes, or even hours. That could cause problems with scheduling, logging, certificates, or even file syncing.

Have you ever wondered why your phone’s clock always seems right, but your old laptop isn’t? That’s because phones often use something like NTP in the background.


Why Time Settings Matter

When I set up my first Ubuntu server, I didn’t touch the timezone. Later, I noticed my logs were three hours ahead. That made it hard to debug issues because I couldn’t tell exactly when something broke.

Setting the correct time helps with:

  • Cron jobs: These are scheduled tasks. You want them to run at the correct time.
  • Logs and errors: Time stamps help you track down problems.
  • Database records: Having the wrong time can make your data confusing.
  • Security: SSL certificates and tokens can fail if the time is off.

So, it’s a good habit to always set your timezone right and make sure NTP is running.


Check Current Time and Timezone

You can start by checking the current time setup on your system. Just open your terminal and type:

timedatectl

You’ll see output like this:

               Local time: Mon 2025-05-06 13:24:50 UTC
           Universal time: Mon 2025-05-06 13:24:50 UTC
                 RTC time: Mon 2025-05-06 13:24:50
                Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

This tells you:

  • Your local time
  • Your timezone (in this example, it’s UTC)
  • Whether NTP is active

If everything looks good, you might not need to change anything. But if your timezone is wrong or NTP isn’t active, read on.


How to Change Timezone on Ubuntu

To change the timezone, you first need to know the correct timezone name. Ubuntu uses the “Region/City” format, like Asia/Jakarta or America/New_York.

To list all available timezones, run:

timedatectl list-timezones

This will scroll a long list of timezones. You can scroll or use grep to search. For example:

timedatectl list-timezones | grep Jakarta

Once you find the one you want, set it like this:

sudo timedatectl set-timezone Asia/Jakarta

You can double-check it worked:

timedatectl

Now your system should show the correct local time for your area.


How to Enable NTP

Most modern Ubuntu systems already have systemd-timesyncd, a built-in NTP service. You just need to make sure it’s enabled.

To enable NTP, run:

sudo timedatectl set-ntp true

Then check again with:

timedatectl

You should see:

System clock synchronized: yes
NTP service: active

If it says no, your system might not be syncing. Don’t worry—we’ll fix that next.


Install NTP Manually (Optional)

Sometimes, systemd-timesyncd doesn’t work well in some environments. Maybe you’re on an older version of Ubuntu or using a custom setup. In that case, I recommend installing the classic NTP package.

Here’s how you do it:

sudo apt update
sudo apt install ntp

Once installed, the NTP service will start automatically.

You can check its status:

sudo systemctl status ntp

And check which time servers it’s using:

ntpq -p

This shows a list of servers and how your system syncs with them. If you see a * next to one, that’s the server your system is using.


Compare Systemd-timesyncd vs NTP

Both options work well, but here’s how they’re different:

Feature systemd-timesyncd ntp (classic)
Built-in to Ubuntu ❌ (needs install)
Easy to use 🟡 (more config options)
Lightweight ❌ (uses more resources)
Custom server setup 🟡 (limited)

If you just want time syncing without fuss, use systemd-timesyncd. If you need advanced features or want full control, go with ntp.


Troubleshooting Tips

Sometimes, things don’t work right the first time. Here are a few quick tips I’ve picked up:

  • Use timedatectl status often to see what’s happening.
  • If you’re behind a firewall, make sure NTP traffic (UDP port 123) is allowed.
  • Logs are your friend. Try:
    journalctl -u systemd-timesyncd
    
  • Try restarting the time service:
    sudo systemctl restart systemd-timesyncd
    

Three Handy Command Groups

Timezone Commands

  • timedatectl list-timezones – view all timezones
  • timedatectl set-timezone YOUR_ZONE – set your timezone
  • timedatectl – check current time and settings

NTP (Systemd) Commands

  • sudo timedatectl set-ntp true – enable NTP
  • systemctl status systemd-timesyncd – check service status
  • journalctl -u systemd-timesyncd – view logs

NTP (Classic) Commands

  • sudo apt install ntp – install classic NTP
  • sudo systemctl status ntp – check service
  • ntpq -p – see NTP peers

Why I Keep My Server’s Clock in Check

Keeping the time right may seem like a small detail. But for servers, it’s like brushing your teeth. It helps everything run smoother, avoid confusion, and keeps future you from having headaches.

Since I started double-checking my time settings, I’ve had fewer issues with logs, scheduled tasks, and even SSL certificates. It’s a 5-minute setup that saves hours later.


Final Thoughts

Setting up timezone and NTP on Ubuntu is one of those tasks that’s easy to skip—but really worth doing. It helps your system stay in sync with the rest of the world.

It also makes your logs more useful, your backups more reliable, and your tasks run on time.

Have you checked your server’s clock lately? If not, now’s a good time.

Need help with any of the commands? Or want a simple graphic to show how NTP works behind the scenes? Just let me know.

Leave a Reply