Changing the timezone on a RHEL5/CentOS system

Posted on

Changing the timezone on a RHEL5/CentOS system – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, redhat, timezone, , .

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

Solution :

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

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.

I’ve been using the symlink method for years, but that’s the wrong way. Because when the tzdata package gets updated the symlink gets blown away. Instead:

  1. set the wanted zone in the file /etc/sysconfig/clock
    where the zone= value is the filename for the zone you want from /usr/share/zoneinfo, but without that full path. For instance: zone=”America/Chicago”

  2. rm /etc/localtime

  3. cp /usr/share/zoneinfo/America/Chicago /etc/localtime

    using Chicago is just an example.

  4. date

Leave a Reply

Your email address will not be published.