先查看当前系统时间
node@node5:~$ date -R
Fri, 22 Jul 2022 09:51:10 +0800
设置时区
tzselect
node@node4:~$ tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
1) Africa 5) Atlantic Ocean 9) Pacific Ocean
2) Americas 6) Australia 10) coord - I want to use geographical coordinates.
3) Antarctica 7) Europe 11) TZ - I want to specify the timezone using the Posix TZ format.
4) Asia 8) Indian Ocean
#? 4
Please select a country whose clocks agree with yours.
1) Afghanistan 7) Bhutan 13) Georgia 19) Israel 25) Kuwait 31) Mongolia 37) Philippines 43) Syria 49) Uzbekistan
2) Antarctica 8) Brunei 14) Hong Kong 20) Japan 26) Kyrgyzstan 32) Myanmar (Burma) 38) Qatar 44) Taiwan 50) Vietnam
3) Armenia 9) Cambodia 15) India 21) Jordan 27) Laos 33) Nepal 39) Russia 45) Tajikistan 51) Yemen
4) Azerbaijan 10) China 16) Indonesia 22) Kazakhstan 28) Lebanon 34) Oman 40) Saudi Arabia 46) Thailand
5) Bahrain 11) Cyprus 17) Iran 23) Korea (North) 29) Macau 35) Pakistan 41) Singapore 47) Turkmenistan
6) Bangladesh 12) East Timor 18) Iraq 24) Korea (South) 30) Malaysia 36) Palestine 42) Sri Lanka 48) United Arab Emirates
#? 10
Please select one of the following timezones.
1) Beijing Time
2) Xinjiang Time
#? 1
The following information has been given:
China
Beijing Time
Therefore TZ='Asia/Shanghai' will be used.
Selected time is now: Fri Jul 22 09:52:18 CST 2022.
Universal Time is now: Fri Jul 22 01:52:18 UTC 2022.
Is the above information OK?
1) Yes
2) No
#? 1
You can make this change permanent for yourself by appending the line
TZ='Asia/Shanghai'; 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/Shanghai
切换时区
node@node4:~$ sudo ln -f -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
node@node4:~$ date -R
Fri, 22 Jul 2022 09:54:08 +0800
写入CMOS
sudo hwclock --systohc