Solve the problem that the time zone cannot be set in linux environment

  • 2021-07-18 09:39:52
  • OfStack

When modifying the time zone under linux, it is always impossible to modify it

Modified to Asia/Shanghai but the time zone is always +0000 but not the desired +0800

According to the online method,

A: tzselect: Execute the tzselect command-- > Select Asia-- > Select China-- > Select east China-Beijing, Guangdong, Shanghai, etc-- > Then enter 1.

B: Modify the configuration file to modify the time zone

1. Modification/etc/sysconfig/clock ZONE=Asia/Shanghai

2. rm/etc/localtime3, link to Shanghai time zone file

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

After performing the above process, restart the machine and you can see that the time zone has changed.

These all need to be restarted to take effect

Later, it was discovered that it only needed to be

/etc/profile under simple setting 1

export TZ = 'CST-8', which will be completed in 1 immediate effect.

The above method is very simple, if you have a better method can contact this site to supplement, thank you for your support of this site.


Related articles: