centos7 配置時(shí)間同步服務(wù)器ntp
第一方法: 簡單 高效 沒煩惱 一條命令解決單臺(tái)server-time
ntpdate -u ntp.api.bz
第二方法:時(shí)間服務(wù)器:
1) sudo yum install ntp
2)sudo nano /etc/ntp.conf
注釋一行
restrict default ignore
加入一行
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap #服務(wù)器的地址
3)sudo nano /etc/ntp/step-tickers
加入一行(也可以在原有基礎(chǔ)上改寫)
pool.ntp.org
這樣每次ntpd啟動(dòng)時(shí),會(huì)自動(dòng)連接該國際標(biāo)準(zhǔn)時(shí)間服務(wù)器;
4)sudo systemctl restart ntpd
5)ss -an |grep 123
確保該端口以u(píng)dp方式開放
6)sudo systemctl enable ntpdate.service (加入開機(jī)自啟動(dòng))
7)date (檢測時(shí)間是否靠譜)
Wed Aug 31 11:45:50 CST 2016