How to change the timezone on CentOS 8
It’s quite easy to change the timezone of CentOS 8, because there is only one instruction you have to operate is
datetimectl
.
Check the current settings of your system including the datetime and the timezone.
The important part of this operation, the timezone file, which is a soft link and connected with the zoneinfo file in the path located at “/usr/share/zoneinfo/”.
As you can see the highlighted line 4 in the script block below.
1 2 3 4 |
$ date Sat Mar 14 01:08:08 CST 2020 $ ls -l /etc/localtime lrwxrwxrwx. 1 root root 33 Oct 11 18:32 /etc/localtime -> ../usr/share/zoneinfo/Asia/Taipei |
How to identify the timezone name?
We can use this timezone list of Wikipedia.
And search this page using the city name or country name that you preferred. Then you should copy the value in the column named “TZ database name” in the search results.
For example, I want to set the timezone as Taipei. After searching, I should copy this term of “Asia/Taipei”.
And then execute the instruction below.
Please, remember replacing the “Asia/Taipei” with your timezone.
1 |
$ sudo timedatectl set-timezone Asia/Taipei |
Varify your changes.
Just run date
. It should return the correct date and time on the console.
1 |
$ date |
Pingback:Setup a LAMP web server using CentOS 8 - BrilliantCode.net