Base de Conhecimento

How to Fix Incorrect Time on a Linux VPS (Ubuntu, Debian, CentOS, AlmaLinux)  Imprima este artigo

How to Fix Incorrect Time on a Linux VPS (Ubuntu, Debian, CentOS & AlmaLinux)

Incorrect server time can cause SSL errors, cron job failures, email delivery problems, incorrect logs, and authentication issues. In this guide, we will show you how to check, fix, and synchronize time on Linux VPS servers.


Why VPS Time Synchronization Matters

Incorrect VPS time may cause:

  • SSL certificate validation errors
  • Broken cron jobs
  • Email sending problems
  • Incorrect server logs
  • Database synchronization issues
  • Authentication failures

For stable server operation, every VPS should have proper NTP time synchronization enabled.


Step 1 — Check Current VPS Time

Run the following command:

timedatectl

Example output:

Local time: Wed 2026-05-13 21:35:11 UTC
Universal time: Wed 2026-05-13 21:35:11 UTC
RTC time: Wed 2026-05-13 21:35:10
Time zone: UTC (UTC, +0000)
System clock synchronized: yes
NTP service: active

The important values are:

System clock synchronized: yes
NTP service: active

Step 2 — Set the Correct Timezone

Timezone controls how time is displayed on the server. Most VPS servers use UTC timezone by default.

To list available timezones:

timedatectl list-timezones

Example: Set timezone to Singapore

sudo timedatectl set-timezone Asia/Singapore

Example: Set timezone to New York

sudo timedatectl set-timezone America/New_York

Verify changes:

timedatectl

Ubuntu & Debian Time Synchronization

Ubuntu and Debian use systemd-timesyncd by default.

Enable Automatic Time Synchronization

sudo timedatectl set-ntp true

Restart the synchronization service:

sudo systemctl restart systemd-timesyncd

Verify synchronization status:

timedatectl status

Configure External NTP Servers (Ubuntu/Debian)

Edit the configuration file:

sudo nano /etc/systemd/timesyncd.conf

Add the following:

[Time]
NTP=time.google.com time.cloudflare.com pool.ntp.org
FallbackNTP=ntp.ubuntu.com

Restart the service:

sudo systemctl restart systemd-timesyncd

Check synchronization:

timedatectl timesync-status

CentOS / AlmaLinux / Rocky Linux Time Synchronization

These operating systems commonly use Chrony for NTP synchronization.

Install Chrony

CentOS 7:

sudo yum install chrony -y

AlmaLinux / Rocky Linux:

sudo dnf install chrony -y

Enable and Start Chrony

sudo systemctl enable chronyd
sudo systemctl start chronyd

Check service status:

systemctl status chronyd

Configure External NTP Servers (Chrony)

Edit Chrony configuration:

sudo nano /etc/chrony.conf

Add the following servers:

server time.google.com iburst
server time.cloudflare.com iburst
server pool.ntp.org iburst

Restart Chrony:

sudo systemctl restart chronyd

Verify synchronization:

chronyc tracking
chronyc sources

Force Immediate Time Synchronization

If the VPS clock is heavily out of sync, restart the synchronization service.

Ubuntu / Debian

sudo systemctl restart systemd-timesyncd

CentOS / AlmaLinux / Rocky Linux

sudo systemctl restart chronyd

Verify:

timedatectl

Manual Time Adjustment (Temporary Fix)

Manual time changes should only be used temporarily.

sudo timedatectl set-time "2026-05-13 21:45:00"

Or:

sudo date -s "2026-05-13 21:45:00"

Once NTP synchronization resumes, the server will automatically correct itself.


Recommended Public NTP Servers

time.google.com
time.cloudflare.com
pool.ntp.org
ntp.ubuntu.com

Troubleshooting

NTP Service Not Active

sudo timedatectl set-ntp true

Or restart Chrony:

sudo systemctl restart chronyd

Firewall Blocking NTP

NTP uses UDP port 123.

sudo firewall-cmd --add-service=ntp --permanent
sudo firewall-cmd --reload

Final Notes

Correct server time is critical for stable VPS operation. We strongly recommend enabling automatic NTP synchronization on every Linux VPS immediately after deployment.

If your VPS continues experiencing time synchronization problems, contact your hosting provider for assistance.

Esta resposta foi útil?

Artigos Relacionados

How To Activate Windows Server 2012 R2 Trial License
Hi Thank you for choosing service from Host4Fun . Go to run > cmd > slmgr.vbs /rearm and...
How to enable ping response on Windows Server 2008
By default Windows Server 2008 firewall blocks ping requests. To enable please follow the...
How to enable ping response on Windows Server 2012
By default Windows Server 2012 firewall blocks ping requests. To enable please follow the below...
How to fix CentOS 6 : YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Hi , Thank you for choosing Service from Host4Fun.Com. When we run command "yum update" on our...
How to fix CentOS 6 error
For Guide Visit :...