How To Change Time Zone in VPS Ubuntu

When you setting up a new VPS, sometimes it comes with default timezone. It is usually set to UTC. If you want to read log files or some configuration you will be confused with the default timezone and local time. You can change it to follow your timezone.

Check the default timezone
Just type command below at your console:

$ date

Then it will be shown

Wed Oct 17 06:43:42 WIB 2017

Change the timezone
Type this command:

$ sudo dpkg-reconfigure tzdata

And follow the step to choose your timezone.

Now check your current timezone:

$ timedatectl

Output:

$ Local time: Wed 2017-10-18 00:04:53 UTC
  Universal time: Wed 2017-10-18 00:04:53 UTC
        RTC time: Wed 2017-10-18 00:04:53
       Time zone: Etc/UTC (UTC, +0000)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

Synchronize timezone to NTP
To synchronize to Network Timezone Protocol, you need to install ntp:

$ sudo apt-get update
$ sudo apt-get install ntp

Once the package is installed, you will be automatically sync with NTP.