Background:
One of my recent projects required me to setup an ubuntu server on Amazon AWS to host database and web services. During final testing we found that server is returning incorrect time (time was actually 5 minutes behind actual time). After some testing and brain storming I zeroed in that server is actually having incorrect time and even if I manually set the correct time, it tend to go slow to match that 5 minutes late time.
Solution:
After going through Amazon documentation, I found this article that helped me setting correct time zone for my server and the server started giving correct time. Here I am quoting essential command to do the needful task:
- Identify the timezone to be used in your server. In my case, my server was located in Oregon, which eventually falls under PST timezone.
- Create a link between your local time and your timezone by using this command: sudo ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
- Reboot your system to pick up the new timezone information: sudo reboot
Note that reboot command will disconnect connection to your server from your local machine. So don’t panic, wait for few minutes before re connecting. Once your server reboot will be completed, you will be able to successfully connect to your server again and this time it will be having correct time.
If this article helped you in any manner, don’t forgot to leave a comment below.