Amazon Web Services Linux Rackspace

Is your Linux Timezone Reverting to UTC After Rebooting?

Being based in Perth (GMT +8), I have always thought it made sense to have our servers running in the Australia/Perth timezone (rather than UTC).

This makes sense for many reasons, mostly that when we set up a cron job, we can use local time (rather than UTC), which makes life very easy.

Recently our Rackspace Cloud servers and Amazon EC2 instances (both running CentOS) were rebooted after updating the glibc package, which caused each server’s timezone to revert back to UTC.

To set the timezone, I had always created a /etc/localtime symbolic link pointing to /usr/share/zoneinfo/Australia/Perth, however it turns out that there is one other thing that has to be done in order to make the timezone setting be persistent across updates and reboots.

Luckily, the solution was hidden away in the AWS user guide.

In addition to the symlink, it is also necessary to edit the /etc/sysconfig/clock file, and change it to your local timezone ( in my case ZONE="Australia/Perth" ).

After making both of these changes, be sure to reboot your server, and then use the date command to check that your server is still in your local timezone (rather than UTC).

By James Collins

A WordPress web developer and ameteur photographer from Perth, Australia. I've been using WordPress since version 2.2.    
More about me →     Follow @james_collins_ on Twitter →

2 replies on “Is your Linux Timezone Reverting to UTC After Rebooting?”

Leave a Reply

Your email address will not be published. Required fields are marked *