基于NTP的时间同步
2023-08-30 11:07 ndzj 阅读(30) 评论(0) 收藏 举报CentOS基于NTP的时间同步(How)
1、安装ntp:
yum install ntp
2、修改/etc/ntp.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
new(新增)
server ntp1.aliyun.com prefer
server ntp2.aliyun.com
old(原有)
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
3、设置时区
timedatectl set-timezone Asia/Shanghai
或者
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
4、时间同步
手工发起同步:
ntpdate ntp1.aliyun.com
date查看时间是否已经同步
启动NTP服务:
service ntpd start
设置开机启动:
chkconfig ntpd on
end 2023年8月30日11:06:06
浙公网安备 33010602011771号