3

I'm trying to change my server's timezone.

I was following this tutorial but I can't get it to change to Pacific Standard Time.

ln -sf /usr/share/zoneinfo/EST localtime

Will work, but

ln -sf /usr/share/zoneinfo/PST localtime

will not. What's going on here?

Steve Robbins
  • 1,904
  • 5
  • 23
  • 26

4 Answers4

5

You have to do two things: edit /etc/sysconfig/clock, you will need to change the ZONE variable. And once you've changed it, next time you reboot your CentOS it will apply the change.

To apply it inmediately you need to change the /etc/localtime, i.e.

ln -sf /usr/share/zoneinfo/PST8PDT /etc/localtime

That will make the change immediate, but remember to also edit /etc/sysconfig/clock so your change won't be undone in next reboot.

Pablo Martinez
  • 2,326
  • 16
  • 13
2
# yum -y install system-config-date
# system-config-date
dmourati
  • 24,720
  • 2
  • 40
  • 69
  • This only works on systems that have a GUI. – offby1 Aug 25 '14 at 22:35
  • 1
    Hmm, you are right. I distinctly remember a curses version of this. Looks like it is gone now.http://fadvisor.net/blog/wp-content/uploads/2008/06/timeconfig.png – dmourati Aug 26 '14 at 21:17
  • This was the only thing that worked for me on CentOS 5. All other means of altering the settings didn't make date use the correct time zone (UTC). Now if only I can get hwclock to sync (--systohc isn't doing the job) – jerclarke Oct 02 '14 at 18:47
1

Try ln -sf /usr/share/zoneinfo/US/Pacific localtime

Alex
  • 7,789
  • 4
  • 36
  • 51
1

From CentOS7 onwards:

timedatectl set-timezone US/Pacific

The question doesn't specify CentOS version, and there is no /etc/sysconfig/clock anymore on a default CentOS 7 (RHEL 7).

kubanczyk
  • 13,502
  • 5
  • 40
  • 55