skip down to the 6 comments

Setting the timezone on CentOS

I forget this pretty much all the time, even though it’s a fairly simple operation. There are loads of timezone data files stored in:

/usr/share/zoneinfo

So for my CentOS install, to set my machine to London time, I use:

#
# this is not correct for me
#
$ date
Wed Oct  1 07:43:58 CDT 2008
#
# to fix it
#
$ sudo rm /etc/localtime
$ sudo ln -s /usr/share/zoneinfo/Europe/London /etc/localtime
#
# now check it's ok
#
$ date
Wed Oct  1 12:42:33 GMT 2008

I imagine this works on Redhat and Fedora as well, but I can’t be sure on other Linux distros.

There have been 6 responses to this post.

  1. John Trupiano

    This was helpful to me. Thanks!

  2. Jeremy Hoyland

    I linked in /usr/share/zoneinfo/Europe/London to localtime on the theory that it might get me summertime.

    I’ll find out in March!

  3. Duncan

    @jeremy you’re right :) and I’ve swapped mine too

  4. The Separator

    Fine instructions, thank you!

  5. DDevine

    I can confirm this works on CentOS 5.5. The directories are the same.

  6. Brian Berlin

    Thank you sir!


back to the top