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'  // 测试后,发现只是临时有效,重启后不起作用了

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM