linux系統修改時區,時間自動同步
博客分類: Linux
1、調整時區
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
linux提供是依據/etc/localtime文件內容知道目前系統的時區信息,這個文件一般是從/usr/share/zone/裏面選擇適當的時區複製過來就可以使用
2、手動調整時間(需要ntpdate)
ntpdate us.pool.ntp.org
沒有安裝ntpdate可以
yum install -y ntpdate
3、加入定時計劃任務,每天進行同步一次:
在’/etc/cron.daily’ 目錄中建立一個腳本’ntpupdate’,內容如下表所示:
#! /bin/bash /usr/sbin/ntpdate -s us.pool.ntp.org /usr/sbin/hwclock --systohc |
另用下列指令設定腳本可執行:
# chmod +x /etc/cron.daily/ntpupdate |
中國國家授時中心:
http://www.time.ac.cn/stime.asp
其他網絡時間服務器地址如下
time.nist.gov(美國)
ntp.fudan.edu.cn(復旦)(國內用戶推薦使用此服務器)
timekeeper.isi.edu
subitaneous.cpsc.ucalgary.ca
usno.pa-x.dec.com
time.twc.weather.com
swisstime.ethz.ch
ntp0.fau.de
ntp3.fau.de
time-a.nist.gov
time-b.nist.gov
time-nw.nist.gov
nist1-sj.glassey.com