NTP stands for Network Time Protocol. It is a protocol for Internet connected systems to synchronize their clocks to a reference clock that is known to be accurate.
Most applications require your system clock to be accurate. This is especially important if an application uses a server farm where different systems will be accessed at different times. Obviously, you cannot have different times on each server or the application can and will not work properly.
Check for Current Installation
Often, ntp is already installed on your Ubuntu system. To check if it installed you can perform one or more these commands.
root@myServer:~# which ntpd /usr/sbin/ntpd
root@myServer:~# ntpd --version ntpd firstname.lastname@example.org Wed Feb 14 14:56:29 UTC 2018 (1)
To Install ntp on your Ubuntu 16.04
To install ntp simply issue the command:
sudo apt-get install ntp
In most cases, installing the above package starts the ntp server as well. To check if the server is already running you can issue the command:
sudo systemctl status ntp
The response should include text including the following showing ntp as “active (running)” and “enabled”.
test@myServer:~$ sudo systemctl status ntp ● ntp.service - LSB: Start NTP daemon Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled) Active: active (running) since Sat 2018-04-21 15:40:09 PDT; 36min ago Docs: man:systemd-sysv-generator(8) Process: 16351 ExecStop=/etc/init.d/ntp stop (code=exited, status=0/SUCCESS) Process: 16368 ExecStart=/etc/init.d/ntp start (code=exited, status=0/SUCCESS) CGroup: /system.slice/ntp.service └─16379 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 122:129
If you find that ntp is not running, you can start and enable it.
sudo systemctl start ntp sudo systemctl enable ntp
Further Checks of Your NTP Installation
There are some useful commands that help troubleshoot or look at the status of your ntp server installation.
The default configuration of ntp includes a set of ntp servers. This configuration is in the /etc/ntp.conf file.
The following servers are configured as default. If these must be changed simply edit this file and replace these servers.
# Specify one or more NTP servers. # Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board # on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for # more information. pool 0.ubuntu.pool.ntp.org iburst pool 1.ubuntu.pool.ntp.org iburst pool 2.ubuntu.pool.ntp.org iburst pool 3.ubuntu.pool.ntp.org iburst # Use Ubuntu's ntp server as a fallback. pool ntp.ubuntu.com
After your satisfied with the changes in this file, you can restart ntp and check the status.
To restart simply type:
sudo systemctl restart ntp
To check which time servers are in use, use the command:
ntpq -c lpeer
This should be all that is needed.
10,020 total views, 1 views today