반응형
How to set or change timezone on Ubuntu 22.04
The test environment
docker run -d --privileged --name ubunut anti1346/ubuntu2204:systemd
docker exec -it ubunut bash
To set or change the timezone on Ubuntu, you can follow the steps below
1. Check the current timezone configuration
timedatectl show
$ timedatectl
Local time: Mon 2023-06-19 11:19:07 UTC
Universal time: Mon 2023-06-19 11:19:07 UTC
RTC time: n/a
Time zone: UTC (UTC, +0000)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
2. List the available timezones
timedatectl list-timezones
$ timedatectl list-timezones
UTC
3. Change the timezone
sudo timedatectl set-timezone [timezone]
For example, if you want to set the timezone to Asia/Seoul, you would run the following command:
sudo timedatectl set-timezone Asia/Seoul
How to fix the error
더보기
$ sudo timedatectl set-timezone Asia/Seoul
Failed to set time zone: Invalid or not installed time zone 'Asia/Seoul'
apt-get update
sudo apt-get install -y tzdata
timedatectl list-timezones | grep -i seoul
$ timedatectl list-timezones | grep -i seoul
Asia/Seoul
728x90
4. Verify the changed timezone
timedatectl show
$ timedatectl show
Timezone=Asia/Seoul
LocalRTC=no
CanNTP=yes
NTP=no
NTPSynchronized=no
TimeUSec=Mon 2023-06-19 20:27:01 KST
5. Synchronize the system time after changing the timezone
sudo systemctl restart systemd-timesyncd
This command will synchronize the system time with the updated timezone.
6. Verify the applied timezone
date
$ date
Mon Jun 19 20:27:51 KST 2023
This command will display the current time according to the updated timezone.
By following the above steps, you can set or change the timezone on your Ubuntu system.
반응형
'리눅스' 카테고리의 다른 글
MySQL 데이터베이스의 백업과 복구를 수행하는 방법 (0) | 2013.06.23 |
---|---|
[리눅스] MySQL innodb 설치 (0) | 2013.06.23 |
How to install the latest version of influxdb on Ubuntu (0) | 2013.06.21 |
우분투에서 텔레포트(teleport)를 설치하는 방법(1) (0) | 2013.06.21 |
CentOS에서 Cband를 설치하고 설정하는 방법 (0) | 2013.06.21 |