CentOS启用NTP服务

安装ntp

# yum install ntp
配置ntp启动项
# chkconfig ntpd on
同步时间
# ntpdate pool.ntp.org
启动ntpd服务
# /etc/init.d/ntpd start

2 配置时间源
# vi /etc/ntp.conf
server pool.ntp.org   #可选择其他优先服务器
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
 
3)配置是否为其他PC提供时间服务
# vi /etc/ntp.conf
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
 
6)验证ntp服务已经运行
# pgrep ntpd
 
7)初始同步
# ntpdate -u time.lib.tsinghua.edu.cn
 
8)确认同步成功
# ntpq -p
 
9)同时建议修改一下 /etc/sysconfig/ntpd 文件
 
# vi /etc/sysconfig/ntpd
 
SYNC_HWCLOCK=yes
 
# 改成 yes 吧!这样主机 BIOS 的时间也会跟着一起改变的 !
 
3 修改时区
复制相应的时区文件,替换CentOS系统时区文件;或者创建链接文件
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 
附NTP时间服务器:
210.72.145.44(中国国家授时中心服务器IP地址)
ntp.fudan.edu.cn  为复旦大学的网络时间服务器
原文地址:https://www.cnblogs.com/songzhenhua/p/9312834.html