OSETC TECH

CentOS /Linux/Unix: How To Modify The System TimeZone

Nomrally A cluster is made up of two computers or more than two. Each node need to keep consistency of the system time.  we can use data command to modify the time in each node and also can setup a NTP server to synchronize the system time from network time for each node. beside keeping the system time consistency,  we still need to make sure that the system time zone are also the same. How to modify the system time zone under the different operating system such as: CentOS Linux, Unix. In this post, you will see that the way of modifying TimeZone of system.

CentOS Linux Modifing System TimeZone

For CentOS, Redhat, and Suse Linux system, we can use the below way to modify the time zone.

Step1# you should know that what timezone you are going to use, just go to “/usr/share/zoneinfo” directory to check the timezone name you want to change . type the following command to list all  timezone of linux supported:

ls /usr/share/zoneinfo

Outputs:

[root@osetc~]# ls /usr/share/zoneinfo/

Africa      Australia  Cuba     Etc      GMT0       Iceland      Japan

。。。

Step2# backup the current “/etc/localtime” file and rename its as “localtime.bak” ( For your recover use later) , issue the following command:

$sudo mv /etc/localtime /etc/localtime.bak

Step3# create  a new localtime file and create a softlink to the timezone time that you want to change, issue the following command:

$sudo touch /etc/localtime

$sudo ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Step4#  synchronize the system clock to hardware clock, type the following command:

$sudo hwclock --systohc

AIX System Changing TimeZone

Step1# checking the current timezone of AIX system, issue the following command;

# cat /etc/environment | grep TZ

TZ=EST5EDT

For output you should get that timezone is “EST5EDT”.

Step2#  Find the time zone name under “/usr/share/lib/zoneinfo” directory that you want to use.

#  ls /usr/share/lib/zoneinfo

Australia  EET        GMT+10     GMT+4      GMT-1      GMT-4

Brazil     EST        GMT+11 .....

Step3# using AIX “smit” command to submit the change.

#smit EST