centos redhat change timezone

How do I change my system timezone from the command line without using redhat-config-date?

centos redhat change timezone

In order to change the timezone of your system you will need to access the file /etc/sysconfig/clock directly:

 
#ZONE="America/New_York"
ZONE="GMT"
UTC=false
ARC=false

Note: If your system’s BIOS has UTC set to true, then set UTC to true. If it has it set to false, set it to false. UTC in the configuration file must always reflect your BIOS settings.

In order to get the particular zone you wish to use you must associate ZONE with a file located in /usr/share/zoneinfo. It is wise to note the directory structure because if you need to set the timezone to that of Shanghai which is located in the Asia directory you will then have to set your ZONE variable to the following :

ZONE="Asia/Shanghai"

Or perhaps you need to set the timezone to that of East Brazil :

ZONE="Brazil/East"

Finally save the file /etc/sysconfig/clock and on next reboot the system will be set to the defined timezone.

For the time on the machine to reflect the change timezone we need to link the zoneinfo file to /etc/localtime. This can be done as follows :

If you are setting your timezone to “Brazil/East” link the following file to /etc/localtime :

# ln -sf /usr/share/zoneinfo/Brazil/East /etc/localtime

Now by typing the date command to display the time you should see if reflect the newly linked timezone :

# date
Thu Sep 30 10:06:23 BRT 2004

Source

For me, to change everything over to Chicago time:

[root@centos6 ~]# cat /etc/sysconfig/clock
ZONE="America/Chicago"
UTC=false
ARC=false
[root@centos6 ~]# ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
[root@centos6 ~]# date
Fri Jul  6 04:15:45 CDT 2012
[root@centos6 ~]#

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.