728x90
반응형
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
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.
728x90
반응형
'Linux Distributions' 카테고리의 다른 글
How to install the latest version of influxdb on Ubuntu (0) | 2023.06.21 |
---|---|
How to install and configure chrony (0) | 2023.06.20 |
How to Install SSH Server on Ubuntu (0) | 2023.06.16 |
How to install Apache from source code on CentOS 7 and enable HTTP/2 (0) | 2023.06.15 |
How to ubuntu with docker container (0) | 2023.06.14 |