Short guide for setting server timezone in both Ubuntu and Amazon linux.
Ubuntu
Is much easier (and nicer) in Ubuntu. Simply
sudo dpkg-reconfigure tzdata
and follow the prompts.
Amazon Linux
Find your timezone with
ls /usr/share/zoneinfo
Note some the of the outputs are folders which contain the timezone (these were coloured blue). For example, Canberra (where I currently reside) is under the Australia folder. Make note of the path to your timezone (e.g. mine was Australia/Canberra).
We need to edit the /etc/sysconfig/clock file:
sudo nano /etc/sysconfig/clock
Change the "zone" value to equal your timezone. For example, I changed mine to:
ZONE="Australia/Canberra"
Finally, we create a symbolic link to /etc/timezone
sudo ln -sf /usr/share/zoneinfo/Australia/Canberra /etc/localtime
Reboot and you're done... don't know about you but I prefer the Ubuntu way...
References
- http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html
- https://help.ubuntu.com/community/UbuntuTime
Related articles