Auto sync time on ubuntu NTP server - haiquang9994/dev_env GitHub Wiki

Installing NTP on host server

sudo apt install ntp

Check ntp

sntp --version

Configure NTP server

sudo vim /etc/ntp.conf

After install ntp, default config like

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

Get ntp config at https://support.ntp.org/

Restart NTP service

sudo service ntp restart

Allow NTP in firewall

sudo ufw allow ntp
sudo ufw status

Test time

date

Original URL: https://linuxways.net/ubuntu/how-to-configure-an-ntp-server-on-ubuntu-20-04-lts-and-sync-a-clock/