RHEL/CentOS

RHEL 이나 CentOs 계열의 리눅스는 시스템 전역 timezone 은 /etc/sysconfig/clock 에 정의되어 있습니다.


# cat /etc/sysconfig/clock
 
ZONE="America/Los_Angeles"
BASH


한국 시간으로 설정할 경우 clock 파일내에 ZONE="Asia/Seoul" 으로 설정하고 다음과 같이 해당 지역에 맞게 /etc/localtime 파일을 수정하면 됩니다.


$ sudo cp -p /usr/share/zoneinfo/Asia/Seoul /etc/localtime 
BASH


또는 tzselect 명령어를 사용하여 타임존을 설정할 수 있습니다.


명령어를 실행하고 대륙을 선택하는 창에서 4(Asia) 를 입력합니다.

$ tzselect

Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
 1) Africa
 2) Americas
 3) Antarctica
 4) Asia
 5) Atlantic Ocean
 6) Australia
 7) Europe
 8) Indian Ocean
 9) Pacific Ocean
10) coord - I want to use geographical coordinates.
11) TZ - I want to specify the time zone using the Posix TZ format.
#? 
BASH


country 를 선택하는 창에서는  23번 (Korea South)  를 선택합니다

Please select a country whose clocks agree with yours.
 1) Afghanistan           18) Israel                35) Palestine
 2) Armenia               19) Japan                 36) Philippines
 3) Azerbaijan            20) Jordan                37) Qatar
 4) Bahrain               21) Kazakhstan            38) Russia
 5) Bangladesh            22) Korea (North)         39) Saudi Arabia
 6) Bhutan                23) Korea (South)         40) Singapore
 7) Brunei                24) Kuwait                41) Sri Lanka
 8) Cambodia              25) Kyrgyzstan            42) Syria
 9) China                 26) Laos                  43) Taiwan
10) Cyprus                27) Lebanon               44) Tajikistan
11) East Timor            28) Macau                 45) Thailand
12) Georgia               29) Malaysia              46) Turkmenistan
13) Hong Kong             30) Mongolia              47) United Arab Emirates
14) India                 31) Myanmar (Burma)       48) Uzbekistan
15) Indonesia             32) Nepal                 49) Vietnam
16) Iran                  33) Oman                  50) Yemen
17) Iraq                  34) Pakistan
BASH


변경 확인창에서 1번 Yes 를 선택합니다.

The following information has been given:

        Korea (South)

Therefore TZ='Asia/Seoul' will be used.
Selected time is now:   Tue Nov 10 12:38:41 KST 2020.
Universal Time is now:  Tue Nov 10 03:38:41 UTC 2020.
Is the above information OK?
1) Yes
2) No
CODE


아래 메시지처럼 .profile 이나 .bash_profile 등 쉘 초기화 파일에 export TZ='Asia/Seoul' 을 추가합니다.

You can make this change permanent for yourself by appending the line
        TZ='Asia/Seoul'; export TZ
to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Seoul
BASH



같이 보기

Ref