Change centOS local timezone

August 4th, 2012
271 words · 2 minutes read · 0 Comments

So today I was taking a look at those lovely lovely photos that I brought over to the blog from instagram, and rearranging some other bits and pieces, when I realised that the timestamps on said images were well off what times I remembered actually taking the photos..

So I took a look at what the ‘date’ command had to say on my server, and low and behold it was set to an obscure timezone that is really of no use to me.

I soon discovered that there are a series of timezone files located in the /usr/share/zoneinfo directory. Take a look in there, and find the file most appropriate for your needs. Remeber this files path as you’re going to use it soon.

The active timezone that you system uses lives in the /etc/localtime file. On my system this was a symlink to another timezone file in the zoneinfo directory.

So, make a backup of this file if paranoia is your thing, and then create a symbolic link of the timezone you wish to use to /etc/localtime.

I did something along the lines of:

1
2
mv /etc/localtime /etc/localtime.bak
ln -s /usr/share/zoneinfo/Australia/Melbourne /etc/localtime


And there you have it.. My photos’ timestamps are more spot on that ever, and the rest of my system seems to be keeping up with things so far.

Of course, you should make sure that you replace Australia/Melbourne with the timezone that you wish to use, but hopefully that was implied.

Now to get back to the finer things in life,

ttfn


Posted in: Tech
Tagged: CentOS, linux
Originally published at: http://texh.net/blog/change-centos-local-timezone

Leave a comment