How to change the timezone in Rhel 6 / Rhel 7

by admin August 11, 2020 at 5:14 pm

How to change the timezone in RHEL 7

To check current time settings

[root@rhel7-1 ~]# timedatectl status
      Local time: Tue 2020-08-11 13:06:53 EDT
  Universal time: Tue 2020-08-11 17:06:53 UTC
        RTC time: Tue 2020-08-11 17:06:52
       Time zone: America/New_York (EDT, -0400)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2020-03-08 01:59:59 EST
                  Sun 2020-03-08 03:00:00 EDT
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2020-11-01 01:59:59 EDT
                  Sun 2020-11-01 01:00:00 EST
[root@rhel7-1 ~]# 

To List available timezones

[root@rhel7-1 ~]# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
Africa/Brazzaville
Africa/Bujumbura
Africa/Cairo
Africa/Casablanca
Africa/Ceuta
Africa/Conakry
Africa/Dakar
Africa/Dar_es_Salaam
Africa/Djibouti

Current timezone of server is America/New_York and I’m going to changes this to Asia/Kolkata.


[root@rhel7-1 ~]# timedatectl set-timezone Asia/Kolkata

Verify that timezone was changed successfully


[root@rhel7-1 ~]# timedatectl status
      Local time: Tue 2020-08-11 22:39:57 IST
  Universal time: Tue 2020-08-11 17:09:57 UTC
        RTC time: Tue 2020-08-11 17:09:57
       Time zone: Asia/Kolkata (IST, +0530)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

How to change the timezone in RHEL 6

Please make sure that /etc/localtime is not a symlink before making changes. If symlink then unlink it

[root@rhel6 ~]# file /etc/localtime 
/etc/localtime: timezone data, version 2, 4 gmt time flags, 4 std time flags, no leap seconds, 185 transition times, 4 abbreviation chars

Current timezone of the server can be found in /etc/sysconfig/clock

[root@rhel6 ~]# cat /etc/sysconfig/clock 
ZONE="America/Los_Angeles"
[root@rhel6 ~]# 

All the available timezones can be found in /usr/share/zoneinfo.

[root@rhel6 Asia]# ll Kolkata 
-rw-r--r--. 2 root root 286 May  6  2018 Kolkata
[root@rhel6 Asia]# pwd
/usr/share/zoneinfo/Asia
[root@rhel6 Asia]# 

Modify the /etc/sysconfig/clock. Here I’m going to change it to “Asia/Kolkata”

[root@rhel6 Asia]# cat /etc/sysconfig/clock 
ZONE="Asia/Kolkata"

Run the tzdata-update to re-configure the system time zone which will update the same in the /etc/localtime

[root@rhel6 Asia]# tzdata-update 

Verify with the date command to ensure that time zone has been changed

[root@rhel6 Asia]# date
Fri Aug 14 22:27:54 IST 2020

Add Comment