-
-
Notifications
You must be signed in to change notification settings - Fork 2
Linux Time Synchronization
Complete beginner-friendly guide to time synchronization on Linux, covering Arch Linux, CachyOS, and other distributions including NTP, systemd-timesyncd, and timezone configuration.
- Understanding Time Synchronization
- Timezone Configuration
- systemd-timesyncd
- NTP Configuration
- Hardware Clock
- Troubleshooting
Time synchronization keeps system time accurate.
What it does:
- Accurate time: Keeps time correct
- Network sync: Syncs with time servers
- Timezone: Handles timezones
- Consistency: Consistent time across network
Why it matters:
- Security: Certificates require accurate time
- Logs: Accurate timestamps
- Scheduling: Cron jobs, etc.
- Network: Network protocols need accurate time
List timezones:
# List available timezones
timedatectl list-timezonesSet timezone:
# Set timezone
sudo timedatectl set-timezone America/New_York
# Or
sudo timedatectl set-timezone Europe/LondonCheck timezone:
# Check time and timezone
timedatectlEnable service:
# Enable timesyncd
sudo systemctl enable systemd-timesyncd
sudo systemctl start systemd-timesyncd
# Check status
timedatectl statusEdit config:
# Edit config
sudo vim /etc/systemd/timesyncd.confExample:
[Time]
NTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org
FallbackNTP=0.pool.ntp.org 1.pool.ntp.org
Restart service:
sudo systemctl restart systemd-timesyncdInstall NTP:
# Arch/CachyOS
sudo pacman -S ntp
# Debian/Ubuntu
sudo apt install ntp
# Fedora
sudo dnf install ntpEnable service:
# Enable service
sudo systemctl enable ntpd
sudo systemctl start ntpd
# Check status
systemctl status ntpdEdit config:
# Edit config
sudo vim /etc/ntp.confAdd servers:
server 0.arch.pool.ntp.org
server 1.arch.pool.ntp.org
server 2.arch.pool.ntp.org
server 3.arch.pool.ntp.org
Restart:
sudo systemctl restart ntpdCheck clock:
# Check hardware clock
sudo hwclock --show
# Check system clock
dateSync to system:
# Sync hardware clock to system
sudo hwclock --systohc
# Sync system to hardware clock
sudo hwclock --hctosysSet clock:
# Set hardware clock
sudo hwclock --set --date "2024-01-15 10:00:00"Check sync status:
# Check timesyncd
timedatectl status
# Check NTP
ntpq -pSet timezone:
# List timezones
timedatectl list-timezones
# Set timezone
sudo timedatectl set-timezone Your/TimezoneThis guide covered time synchronization for Arch Linux, CachyOS, and other distributions, including timezone configuration, systemd-timesyncd, NTP, and hardware clock.
- Locale and Language - Locale setup
- System Configuration - System setup
- ArchWiki Time: https://wiki.archlinux.org/title/System_time
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.