LinuxLearnSite

Ubuntu/Debian with timedatectl

  • Check current time:
    timedatectl
  • Set time zone:
    sudo timedatectl set-timezone Europe/Berlin
  • To enable NTP synchronization:
    sudo timedatectl set-ntp true
  • Check status:
    Timedatectl

RHEL/CentOS with chronyd

  • Installation:
    sudo yum install chrony
  • Configuration:
    • Open file /etc/chrony.conf:
      sudo nano /etc/chrony.conf
    • To add NTP servers:
      Server pool.ntp.org iburst
  • Start and activate the service:
    sudo systemctl start chronyd
    sudo systemctl enable chronyd

How to Use ntpd on Ubuntu

  • Installation:
    sudo apt install ntp
  • Configuration:
    • Open the /etc/ntp.conf file:
      sudo nano /etc/ntp.conf
    • To add NTP servers:
      Server pool.ntp.org
  • Start service:
    sudo systemctl start ntp

Synchronize hardware clock

  • Synchronize time from system clock to hardware clock:
    sudo hwclock –systohc
  • Display hardware time:
    hwclock –show