English
Setting Up chrony
chrony is an implementation of the Network Time Protocol and helps to keep your computer's time synchronized with NTP.

🐣
Installation

To install chrony, type:
1
sudo apt-get install chrony -y
Copied!
To create the chrony.conf config file, copy and paste the following:
1
cat > $HOME/chrony.conf << EOF
2
pool time.google.com iburst minpoll 1 maxpoll 2 maxsources 3
3
pool ntp.ubuntu.com iburst minpoll 1 maxpoll 2 maxsources 3
4
pool us.pool.ntp.org iburst minpoll 1 maxpoll 2 maxsources 3
5
6
# This directive specify the location of the file containing ID/key pairs for
7
# NTP authentication.
8
keyfile /etc/chrony/chrony.keys
9
10
# This directive specify the file into which chronyd will store the rate
11
# information.
12
driftfile /var/lib/chrony/chrony.drift
13
14
# Uncomment the following line to turn logging on.
15
#log tracking measurements statistics
16
17
# Log files location.
18
logdir /var/log/chrony
19
20
# Stop bad estimates upsetting machine clock.
21
maxupdateskew 5.0
22
23
# This directive enables kernel synchronisation (every 11 minutes) of the
24
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
25
rtcsync
26
27
# Step the system clock instead of slewing it if the adjustment is larger than
28
# one second, but only in the first three clock updates.
29
makestep 0.1 -1
30
EOF
Copied!
Move the file to /etc/chrony/chrony.conf
1
sudo mv $HOME/chrony.conf /etc/chrony/chrony.conf
Copied!
Restart chrony in order for config change to take effect.
1
sudo systemctl restart chronyd.service
Copied!

🤖
Helpful Commands

To see the source of synchronization data.
1
chronyc sources
Copied!
To view the current status of chrony.
1
chronyc tracking
Copied!

🔥
Bonus Commands

To pick your timezone run the following command:
1
sudo dpkg-reconfigure tzdata
Copied!
Find your region using the simple text-based GUI.
In the event that you are using national system like India's IST select:
1
Asia/Kolkata
Copied!
This will be appropriate for all locales in the country (IST, GMT+0530).