Logo

dev-resources.site

for different kinds of informations.

NTP (Network Time Protocol) Setup for Linux (Ubuntu) Server

Published at
4/19/2021
Categories
linux
ubuntu
ntp
timezone
Author
ibrarturi
Categories
4 categories in total
linux
open
ubuntu
open
ntp
open
timezone
open
Author
9 person written this
ibrarturi
open
NTP (Network Time Protocol) Setup for Linux (Ubuntu) Server

When you launch a new Linux server, whether it's an AWS EC2 instance or a local server, by default, the server time is not synced with the NTP server and most of the times the timezone is set to UTC.

In most cases server timing synchronizing with the NTP server is very important.

Following are the steps:

Install & Configure NTP

  • Run the following command to install the NTP
sudo apt-get install ntp
Enter fullscreen mode Exit fullscreen mode
  • Open the ntp.conf file:
sudo vi /etc/ntp.conf
Enter fullscreen mode Exit fullscreen mode
  • Check if the NTP pool entries the same as below otherwise update it:
pool 0.ubuntu.pool.ntp.org iburst
pool 1.ubuntu.pool.ntp.org iburst
pool 2.ubuntu.pool.ntp.org iburst
pool 3.ubuntu.pool.ntp.org iburst
Enter fullscreen mode Exit fullscreen mode
  • Restart the NTP service
sudo service ntp restart
Enter fullscreen mode Exit fullscreen mode
  • Check the NTP service status by running the following command:
service ntp status
Enter fullscreen mode Exit fullscreen mode

Set/Change timezone

  • Let's say you want to change the timezone to AEDT
  • You can set it by running the following command:
sudo timedatectl set-timezone Australia/ACT
Enter fullscreen mode Exit fullscreen mode
  • Restart the NTP service
sudo service ntp restart
Enter fullscreen mode Exit fullscreen mode
  • You can confirm the result by running the following command:
service ntp status
Enter fullscreen mode Exit fullscreen mode
  • and it should you the result like the following:

Alt Text

timezone Article's
30 articles in total
Favicon
Converting date by user time zone in "NestJS", and entering and displaying date in "Angular"
Favicon
Timezone support in a full-stack application based on NestJS and Angular: working with REST and WebSockets
Favicon
Python: it is now() time to migrate from utcnow()
Favicon
geo2tz - 4 years later
Favicon
🌐 How to Change Time Zone in Google Chrome to Test Different Timezones
Favicon
¿Cómo trabajar correctamente con fechas?
Favicon
How to fix Dynamics AX 2012 R3 when the time is 1 hour ahead when not using daylight savings time
Favicon
Config Timezone Laravel in Your Project
Favicon
Javascript Zoned-Date library - fully DST support
Favicon
ChronoMate: Your Ultimate Time Zone Companion for Seamless Productivity and Scheduling Ease!
Favicon
supabase timezone + cron
Favicon
Command Prompt - Set Timezone
Favicon
Troubleshooting Timezone Issues in PostgreSQL with DBeaver
Favicon
Fixed: WHM (CPanel) + Laravel Timezone Issue
Favicon
Solve UK time changes (DST) with NodeJS and date-fns and Docker (epoch/unix format)
Favicon
Is there any reason to use ZoneId.of("UTC") instead of ZoneOffset.UTC?
Favicon
Debugging timezone issue in Java [Linux]
Favicon
Local time of employees in Notion
Favicon
Modificando a hora nas configurações do PHP8
Favicon
Time change in daylight saving
Favicon
Avoid this when using Date/Time functions in PHP
Favicon
Timezone for DateTime Field at Laravel Nova
Favicon
NTP (Network Time Protocol) Setup for Linux (Ubuntu) Server
Favicon
[Phoenix LiveView] formatting date/time with local time zone
Favicon
Shift the TZ for your K8s CronJobs
Favicon
Datetimes Are Hard: Part 2 - Writing and running code
Favicon
Where does GMT-0456 Timezone Come From?
Favicon
Dealing with Timezone in JavaScript
Favicon
Date and time gotchas
Favicon
How to avoid and debug most of timezone problems in production

Featured ones: