Time is one of the most critical components of a computer system. Keeping time manually synchronized has been a thing of the past for years. If you want your system time to sync with other systems on the network, then configuring a Network Time Protocol (NTP) client will automate the task.
The following steps will demonstrate how to install and configure ntpd on linux:
Step 1 – Install NTP
Run your favorite package management tool Apt to install ntpd:
sudo apt-get install ntp
Step 2 – Edit Configuration File
Edit the /etc/ntp.conf file to point to the server you want to grab the time from.
cd /etc sudo vi ntp.conf
Step 3 – Modify
Add a line with your server to the config, I added mine above the defaults in they had listed:
server 10.12.3.4
Step 4 – Save
Save your changes with :wq
:wq
Step 5 – Restart Services
Now start the ntp service:
service ntp start
Verify the Results
To verify the results, type “date” to see the current time and date on your box. It should be current after the service starts.
Note: If your system’s time isn’t updating even after NTP is configured, there might be an issue preventing it from catching up. Take a look at this post for more help: Immediately Update NTP in Linux using this simple process.
You can use the ntpq command to check on the configured peers and also see if there are any issues. Start by typing ntpq, then type peers and iostats:
webadmin@web5:~$ ntpq ntpq> ntpq> peers remote refid st t when poll reach delay offset jitter ============================================================================== 10.12.3.4 129.6.15.29 2 u 3 64 1 1.634 -542407 0.000 ntpq> iostats time since reset: 70 receive buffers: 10 free receive buffers: 9 used receive buffers: 0 low water refills: 1 dropped packets: 0 ignored packets: 0 received packets: 7 packets sent: 19 packet send failures: 0 input wakeups: 12 useful input wakeups: 12 ntpq> exit
For additional options and settings, check out the video walk through of this process. Here’s a direct link if the embedded version doesn’t appear in your browser: https://www.youtube.com/watch?v=F_d62F67Ihk
Installing and Configuring NTP is so easy I can do with with one command!Click To TweetIf you have questions or suggestions on how to make this process better, please post a comment below. We appreciate positive feedback 🙂