Panduan cara sinkronisasi waktu (tanggal/jam) di Ubuntu 18.x atau 20.04 atau versi lebih baru. Pertama kita cek daftar zona yang ada dengan perintah berikut
timedatectl list-timezones
Tekan tombol naviagasi pada keyboard ke bawah/ke atas untuk melihat-lihat daftar zona. Jika sudah, tentukan dan atur zona waktu, sebagai contoh saya akan atur di zona +7 Waktu Indonesia bagian Barat (WIB) atau Asia/Jakarta
timedatectl set-timezone Asia/Jakarta
Install NTP
apt install ntp -y
Aktikan sinkronisasi jam
ntpq -p
Keterangan:
-p,--pers: Print a list of the peers. This option must not appear in combination with any of the following options: interactive. Print a list of the peers known to the server as well as a summary of their state. This is equivalent to the ‘peers’ interactive command.
Chek dengan perintah date atau timedatectl dan lihat hasilnya
Hasilnya
Local time: Thu 2022-05-19 13:48:58 WIB
Universal time: Thu 2022-05-19 06:48:58 UTC
RTC time: Thu 2022-05-19 06:48:58
Time zone: Asia/Jakarta (WIB, +0700)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no
Tidak perlu restart server/komputer, jika memakai service webserver cukup restart webservernya saja.
Selesai semoga bermanfaat.