Skip to content

This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!


ntp

The NTP Project provides a reference implementation of the NTP protocol and implementation documentation through a largely volunteer effort.

It is a common method to synchronize the software clock of a GNU/Linux system with internet time servers. It is designed to mitigate the effects of variable network latency and can usually maintain time to within tens of milliseconds over the public Internet. The accuracy on local area networks is even better, up to one millisecond.

Reference(s)

Table of contents


Install

# apt add ntp
# apt install ntp
# dnf install ntp
# emerge -a sys-process/ntp
# nix-env -iA nixos.ntp
# nix-env -iA nixpkgs.ntp
# pacman -S ntp

For Artix users

  • If using dinit:
    # pacman -S ntp ntp-dinit
    
  • If using openrc:
    # pacman -S ntp ntp-openrc
    
  • If using runit:
    # pacman -S ntp ntp-runit
    
  • If using s6:
    # pacman -S docker ntp-s6
    
# yum install ntp
# xbps-install -S ntp
# zypper install ntp

Config

# rc-update add ntp default
# rc-service ntp start

Depending on your runit implementation, either run:

# ln -s /etc/runit/sv/ntpd /service
or run:
# ln -s /etc/runit/sv/ntpd /var/service
or run:
# ln -s /etc/runit/sv/ntpd /run/runit/service
In any case, finally run:
# sv up ntpd

# service ntp start
# chkconfig ntp on
# systemctl enable ntp
# systemctl start ntp

The default /etc/ntp.conf config file should be OK for common use.


If this cheat sheet has been useful to you, then please consider leaving a star here.