Phoenix Ignited is a proud tech solutions partner of Luxauro.com. View their news and media page here: Luxauro.com
In this quick tutorial we go through updating a Linux server’s time in no-time via NTPD. NTPD is the Network Time Protocol Deamon, it runs in the background on your system to keep your system clock synced with ntp servers. It ensures your server’s time does not begin to drift. NTP servers are simply servers that keep track of the current time and a NTPD Client is the background process on your server that gets the current time from the NTP server to ensure your server’s clock is accurate.
We will first install ntpd:
sudo apt-get install ntpdate # Debian-based systems
sudo yum install ntpdate # Red Hat-based systems
Next we sync our server’s time and date with pool.ntp.org
sudo ntpdate pool.ntp.org
Now we need to sync the server’s hardware clock with the system clock, this should help prevent this issue from re-occuring, otherwise the system clock will always reset to the hardware clock’s date and time next time the server is booted up.
sudo hwclock --systohc
Feel free to regularly sync your system clock with a ntp server clock by creating a cron job. Open the cron editor:
sudo crontab -e
Add the cron job:
0 * * * * /usr/sbin/ntpdate pool.ntp.org && /sbin/hwclock --systohc
Explanation: “0 * * * *” set’s the cron job to run at the start of every hour, “/usr/sbin/ntpdate pool.ntp.org” syncs the system clock with the ntp server clock, “&&” runs the next command after the first command, and “/sbin/hwclock -systohc” sycns the hardware clock to the system clock.
Walter Miely is a tech entrepreneur and CEO of Phoenix Ignited Tech You can find him on Linkedin. This material is licensed under the CC BY 4.0 License LEGAL DISCLAIMER: The content provided here is provided AS IS, and part of, or the entirety of this content may be incorrect. Please read the entireLegal Disclaimer here.
+ Ave Maria +