centos7 几种修改系统时区的方法

1. 
# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime  // 两句是等效的
 
2.
# timedatectl set-timezone Asia/Shanghai   //修改时区为Asia/Shanghai
# timedatectl   //查询服务器时间
 
3. 
# tzselect   // 然后根据提示进行选择:5,9,1,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

查询时间后,仍然没有改过来。

 

安装提示操作:

# export TZ='Asia/Shanghai'  // 测试后,发现只是临时有效,重启后不起作用了

 
posted @ 2020-12-15 14:04  阿木工作室  阅读(1013)  评论(0编辑  收藏  举报