时间同步
-
先改时区,因为安装系统的时候都是最小化安装,所以之后可能会需要改时区哦~
-
本地服务端的配置~ 它既是一个服务端(相对于企业内部)又是一个客户端(相对于互联网)
修改时区
[root@centos8 ~]#date
Thu Feb 13 03:06:14 EST 2020
[root@centos8 ~]#ll /etc/localtime
lrwxrwxrwx. 1 root root 38 Jan 2 16:21 /etc/localtime -> ../usr/share/zoneinfo/America/New_York
[root@centos8 ~]#rm -f /etc/localtime
[root@centos8 ~]#ln -s ../usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@centos8 ~]#ll /etc/localtime
lrwxrwxrwx 1 root root 35 Feb 13 16:07 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai
[root@centos8 ~]#date
Thu Feb 13 16:08:12 CST 2020
- 然后就是安装chrony包来提供时间同步,一般都是用两台服务器来做这个服务端(一个主一个从),防止单点失败~
[root@centos8 ~]#yum install chrony -y
[root@centos8 ~]#vim /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#pool 2.centos.pool.ntp.org iburst #此行注释掉
server ntp.aliyun.com iburst #增加以下两行
server ntp1.aliyun.com iburst
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Allow the system clock to be stepped in the first three updates
# if its offset is la