Linux-基础-NTP服务

1、Liunx常用时间命令

查看系统时间
date
查看硬件时间
hwclock

2、什么是NTP服务

NTP是网络时间协议(Network Time Protocol),它是用来同步网络中各个计算机的时间的协议。

3、安装配置NTP服务

(1) 查看是否安装NTP服务

rpm -qa|grep ntp

(2) 安装NTP服务

 yum install -y ntp

(3) 常用的时间服务器
可以在 NTP时间源服务器 中获取中国时间源服务器

Linux-基础-NTP服务_第1张图片
image.png

(4)同步系统时间

ntpdate  0.cn.pool.ntp.org
hwclock -w 系统时间保存到硬件时间

(5)修改NTP配置文件
配置 vim /etc/ntp.conf ,修改server 为中国服务器

 server 0.cn.pool.ntp.org iburst
 server 1.cn.pool.ntp.org iburst
 server 2.cn.pool.ntp.org iburst
server 3.cn.pool.ntp.org iburst

(6)启动NTP服务

systemctl start ntpd.service 

(7)设置开机启动

systemctl enable ntpd.service

你可能感兴趣的:(Linux-基础-NTP服务)