Time synchronisation with NTP

The NTP protocol allows you to synchronise the clock of your computer with that of dedicated time servers on the Internet. Get the necessary packages with the following command:

user@ubuntu:~$ sudo apt-get install ntp-simple ntpdate

Stop the ntpd daemon and manually synchronise your computer’s clock with the following two commands:

user@ubuntu:~$ sudo /etc/init.d/ntp-server stop
user@ubuntu:~$ sudo ntpdate pool.ntp.org

Modify the file /etc/ntp.conf to read:

# You do need to talk to an NTP server or two (or three).
#server ntp.your-provider.example
#server ntp.ubuntu.com
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org

Start the ntpd daemon with the following command:

user@ubuntu:~$ sudo /etc/init.d/ntp-server start

After about one minute, query the status of the ntpq daemon with the following command:

user@ubuntu:~$ sudo ntpq -p

You can further increase the accuracy of time synchronisation by using the time servers in your continental or country zone.