How to Set/Change Time Zone in RHEL

The /etc/sysconfig/clock file allows us to configure UTC
This controls how the system reads the hardware clock

- If this value is set to YES, then system will use Universal time
- If set to NO, system will use localtime

ZONE="zone name"

Drill into /usr/share/zoneinfo

You may see directories like this

# pwd

# ls US
-rw-r--r--  1 root  wheel   1.0K Nov  1 15:05 Pacific
-rw-r--r--  4 root  wheel   877B Nov  1 15:12 Mountain
-rw-r--r--  2 root  wheel   811B Nov  1 15:12 Michigan
-rw-r--r--  3 root  wheel   869B Nov  1 15:12 Indiana-Starke
-rw-r--r--  3 root  wheel   1.2K Nov  1 15:12 Eastern
-rw-r--r--  4 root  wheel   606B Nov  1 15:12 East-Indiana
-rw-r--r--  2 root  wheel   1.2K Nov  1 15:12 Central
-rw-r--r--  2 root  wheel   130B Nov  1 15:12 Arizona
-rw-r--r--  3 root  wheel   858B Nov  1 15:12 Aleutian
-rw-r--r--  2 root  wheel   861B Nov  1 15:12 Alaska
-rw-r--r--  3 root  wheel   125B Nov  1 15:12 Samoa
-rw-r--r--  2 root  wheel   101B Nov  1 15:12 Hawaii

If your zone is Pacific for example (which lies under US), you'll name your zone as "US/Pacific"


In case UTC is set to NO, the file /etc/localtime can be set as a symlink pointing to the files in the directories above.

For example: If you use local time for Pacific then

# ln -s /usr/share/zoneinfo/US/Pacific /etc/localtime

The two files, working together will determine that we use localtime and the zone is US Pacific.

No comments:

Post a Comment

Help a friend, share your knowledge