Friday, January 28, 2011

Changing the timezone on a RHEL5/CentOS system

How do I change the timezone on a RHEL5 system? I'm reading the instructions here - http://www.cyberciti.biz/faq/howto-linux-unix-change-setup-timezone-tz-variable/

But they seem very bold (altering the /etc/localtime file).

Is this an acceptable practice (steps from link below):

Generic procedure to change timezone
Change directory to /etc
# cd /etc
Create a symlink to file localtime:
# ln -sf /usr/share/zoneinfo/EST localtime
  • Yes, this is exactly what I did to an RHEL5 box two days ago, and it worked fine (with the difference that I hard-linked the file, not soft-linked, but I don't see there should be much difference).

    If there is already a localtime file in place it is perhaps best to move the old one aside and put the new one in place in one operation:

    cd /etc; mv localtime localtime.orig; ln /usr/share/zoneinfo/EST localtime
    
    matt_tm : Did that - seems to work out fine...
    MadHatter : Glad to hear it!
    From MadHatter
  • It works, but the traditional RedHat way is to use a system-config-* utility. In this case, it'd be system-config-time.

    timeconfig also does the job.

    MadHatter : Your point is copmpletely fair and accurate, but I tend to prefer to do things in a non-distro-specific way if at all possible. The recipe above should work on all linuces, and probably solaris and a few other POSIXy unices too.
    From ewwhite

0 comments:

Post a Comment