Instead of using the ntp daemon, here is the traditional means to syncing time. This approach was taught to me by Dickson and works on systems other than Ubuntu.
The advantage over the traditional cron tab approach is,
- Less inconsistency in logs for when there are large time corrections.
- A little processing power and memory, but for a modern server this is negligible.
Code Block |
---|
|
date # determine current timezone |
If need be change your time zone,
Code Block |
---|
|
sudo dpkg-reconfigure tzdata # sets the timezone |
Next we make sure the time stays correct.
Make ntpdate Scheduled in the chrontab (Scheduled Job):
Code Block |
---|
|
sudo crontab -e |
At this point you will be asked to choose a default editor. I recommend selecting nano if you are a beginner. You can always change the default editor later with, select-editor.
Add to the bottom of the file,
Code Block |
---|
|
# update time and date every morning at 5:00.
00 05 * * * ntpdate ntp.ubuntu.com pool.ntp.org |
Hit keys, CTRL-O and Enter (save in nano)
Hit keys, CTRL-X (exit in nano)
Next, verify that the crontab was updated successfully by listing the crontab. (Note: you don't need sudo to do this).