2011年10月21日 星期五

Linux (Redhat / Fedora / CentOS) 設定時間的方式

1. copy /usr/share/zoneinfo/* 內的確切時區資料檔案為 /etc/localtime
2. 執行 date -u
3. 輸入 date 看看是否已經是正確時區
4. 調整系統時間
    透過 ntpdate -u time.stdtime.gov.tw 來校正目前時間
    透過 date –set=“2003-02-19 17:44” 方式直接手動設定
5. 輸入 hwclock 看看目前 BIOS 的時間是否正確
6. 執行 clock –systohc 將目前系統時間寫入 BIOS 時間
7. 輸入 date 與 hwclock 看看時間是否一致..



以下使用的範例
[root@localhost DS]# cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime
cp:是否覆寫 ‘/etc/localtime’? N
[root@localhost DS]# cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime
cp:是否覆寫 ‘/etc/localtime’? Y
[root@localhost DS]# md5sum /usr/share/zoneinfo/Asia/Taipei
c592fc12c2766fd6aef147be6d4c9550  /usr/share/zoneinfo/Asia/Taipei
[root@localhost DS]# md5sum /etc/localtime
c592fc12c2766fd6aef147be6d4c9550  /etc/localtime
[root@localhost DS]# date -u
五 10月 21 18:11:20 UTC 2011
[root@localhost DS]# date
六 10月 22 02:11:31 CST 2011
[root@localhost DS]# ntpdate -u time.stdtime.gov.tw
21 Oct 18:11:41 ntpdate[3610]: step time server 59.124.196.84 offset -28798.733049 sec
[root@localhost DS]# hwclock
西元2011年10月22日 (週六) 02時11分50秒  -0.156670 seconds
[root@localhost DS]# clock --systohc
[root@localhost DS]# date
五 10月 21 18:12:03 CST 2011
[root@localhost DS]# hwclock
西元2011年10月21日 (週五) 18時12分14秒  -0.391023 seconds

沒有留言:

張貼留言