Wednesday, April 15, 2015

Linux server's datetime is wrong and how to fix

Use this when your Linux server's datetime is wrong. Basically, all you have to do is sync with a reliable NTP server (ex.

1. First, make sure the server is set with the right timezone (ex. Asia/Ho_Chi_Minh):

$ sudo dpkg-reconfigure tzdata

2. Sync it with a local NTP server:

$ sudo ntpdate

The Time on the Linux server should be correct now.

3. Furthermore, you can install ntpd. It synchronizes the clock for you, doing so continuously in the background:

* Install ntpd:
$ sudo apt-get install ntp

* Config ntpd:
$ sudo nano /etc/ntp.conf

* Add your reliable NTP server:

* Restart ntpd:
$ sudo service ntp restart