1. 查看是否已安装ntp服务
rpm -qa | grep ntp
# 如果有执行命令卸载相关包
yum –y remove "package_name"
2. 重新安装ntp
yum –y install ntp
3. 配置ntp服务
vim /etc/ntp.conf
### 注释掉server行,增加以自己为服务的配置
20 # Please consider joining the pool (http://www.pool.ntp.org/join.html).
21 #server 0.centos.pool.ntp.org iburst
22 #server 1.centos.pool.ntp.org iburst
23 #server 2.centos.pool.ntp.org iburst
24 #server 3.centos.pool.ntp.org iburst
25 server 127.127.1.0 iburst
4. 启动ntp服务
service ntpd start
5. 查看ntp服务的同步状态
ntpq -p
[root@host-a bin]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*LOCAL(0) .LOCL. 5 l 24 64 377 0.000 0.000 0.000
6. 客户端可以使用ntpdate去同步时间
ntpdate "ip_address"