Study

[Linux] Ubuntu 서버 시간 변경

즐거운개발 2022. 8. 24. 09:13

1. 타임존(Timezone) 선택

  ls /usr/share/zoneinfo/에서 'Asia/Seoul' 선택

  

$ sudo ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime

 

2. timedatectl

timedatectl 이용해 'Asia/Seoul' 선택

'no module named ~' 에러 발생 시 'apt-get install timedatectl'로 설치 필수

 

$ sudo timedatectl set-timezone 'Asia/Seoul'
$ date
Sat May 16 19:52:25 KST 2020

 

3. tzselect

tzselect 명령어를 통해 적용 가능

'no module named ~' 에러 발생 시 'pip install tzselect'로 설치 필수

'/usr/share/zoneinfo/iso3166.tab: No such file or directory' 에러 발생 시 'apt-get install tzdata' -> asia - seoul로 해결

 

$ tzselect

 

 

4. 타임존 변경

 .profile 파일에 설정 값들을 추가 및 적용

 

$ echo "TZ='Asia/Seoul'; export TZ" >> .profile
$ source ~/.profile