How to Change Timezone Linux on RHEL 6/7 and CentOS 6/7

change timezone linux

This post assumed that we will change the System Timezone from the command line without using redhat-config-date.

There are several files and directories that are used for time zones. In RHEL 6 and RHEL 6, there is one directory that very useful to select the appropriate time zone which is /usr/share/zoneinfo directory.

Sometimes we forget to set the correct time zone for the new linux system. This quick steps show how to change timezone on RHEL 6/7 and CentOS 6/7.

/usr/share/zoneinfo – this directory contains the System Timezone files that were compiled by zic. These are binary files and cannot be viewed with a text viewer. The files contain information such as rules about DST. They allow the kernel to convert UTC UNIX time into appropriate local dates and times.

See also  How to Install Webmin 1.580 on RHEL 6/CentOS 6 Using tar.gz File

In order to change the System Timezone of your system you will need to access the file or configuration using root.

How to Change Timezone Linux on RHEL / CentOS

1) How to list all available time zone on RHEL 6 / CentOS 6:

#ls /usr/share/zoneinfo

2) How to list all available time zone on RHEL 7 / CentOS 7:

# timedatectl list-timezones | grep Asia
Asia/Aden
Asia/Almaty
Asia/Amman
..
..
Asia/Kuala_Lumpur

3) How to check timezone in linux RHEL 6 / CentOS 6 :

# cat /etc/sysconfig/clock

4) How to check timezone in linux RHEL 7 / CentOS 7 :

# timedatectl status
      Local time: Thu 2017-01-05 20:00:22 MYT
  Universal time: Thu 2017-01-05 12:00:22 UTC
        RTC time: n/a
       Time zone: Asia/Kuala_Lumpur (MYT, +0800)
     NTP enabled: n/a
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

5) How to Change Timezone Linux RHEL 6 / CentOS 6 :

See also  How to Configure Static IP Address on CentOS 5.8 x86

Edit ZONE= to the following:

# cat /etc/sysconfig/clock
ZONE="Asia/Kuala_Lumpur"

Create a new soft link to your time zone :

# mv /etc/localtime /root/localtime.old
# ln -sf /usr/share/zoneinfo/Asia/Kuala_Lumpur /etc/localtime

6) How to Change Timezone Linux RHEL 7 / CentOS 7 :

timedatectl set-timezone Asia/Kuala_Lumpur

7) How to Display current date and time and timezone :

# date
Thu Jan  5 19:54:38 MYT 2017

Comments

Leave a Reply

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