How To Set Up Time Synchronization on Ubuntu 12.04
sudo ntpdate pool.ntp.org
NTP needs port 123 to be open in order to work.
Step One— Install the NTP daemon
The easiest way to ensure that your time remains up to date is to install the Network Time Protocol daemon. You can download it from apt-get.
sudo apt-get install ntp
Step Two— Configure the NTP Servers
Once the program is installed, open up the configuration file:
sudo nano /etc/ntp.conf
Find the section within the configuration that lists the NTP Pool Project servers. The section will look like this:
server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org
Each line then refers to a set of hourly-changing random servers that provide your server with the correct time. The servers that are set up are located all around the world, and you can see the details of the volunteer servers that provide the time with the
command. You should see something like the following:
remote refid st t when poll reach delay offset jitter ============================================================================== -mail.fspproduct 188.8.131.52 2 u 50 128 377 1.852 2.768 0.672 *higgins.chrtf.o 184.108.40.206 2 u 113 128 377 14.579 -0.408 2.817 +mdnworldwide.co 220.127.116.11 2 u 33 128 377 47.309 -0.572 1.033 -xen1.rack911.co 18.104.22.168 2 u 44 128 377 87.449 -5.716 0.605 +europium.canoni 22.214.171.124 2 u 127 128 377 75.755 -2.797 0.718
Although these servers will accomplish the task of setting and maintaining server time, you set your time much more effectively by limiting the ntp to the ones in your region (europe, north-america, oceania or asia), or even to the ones in your country, for example in America:
You can find the list international country codes (although not all of the countries have codes) here Once all of the information is in the configuration file, restart ntp:
sudo service ntp restart
NTP will slowly start to adjust the virtual private server’s time.