›INDEX
Last Updated:

Network Time Protocol (NTP)

NTP has the important job of synchronizing clocks over a network. We use ntpd ( a service available on Linux) to synchronize the software clock of a GNU/Linux system with the internet time servers. Note that this differs from a hardware clock (specific to the hardware).

We install NTP on archlinux using the following command:

pacman -S ntp

Now we run a command:

sudo ntpd -qg

The -q flag instructs the service to set the time and then quit. The -g flag allows the first adjustment to be big (normally, ntpd exits if the offset exceeds a given threshold). This initial command will synchronize our time with the time on one of the NTP servers.

This command sets the current time to be the time that's being synchronized with the ntp server.

And then we start and enable the ntpd service using systemctl (for systemd) in the following way:

systemctl enable ntpd.service
systemctl start ntpd.service

Then we run the command:

sudo timedatectl set-ntp true

This asks the system to use the ntpd service to keep track of the time and update it if necessary.

Enjoy the notes on this website? Consider supporting me in this adventure in you preferred way: Support me.