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