CentOS8 realizes ntp synchronization

Please pay attention to whether your business will be affected by the time update, the method is for reference only.

1. Error reproduction

Centos 8 executes ntpdate and the following error occurs

No match for argument: ntpdate Error: Unable to find a match: ntpdate

Reason: The ntp software package is no longer supported by default in CentOS8.0, and time synchronization will be implemented by chrony

Two, the solution

1. Via wlnmp

Add wlnmp's yum source

# rpm -ivh http://mirrors.wlnmp.com/centos/wlnmp-release-centos.noarch.rpm

Install ntp service

# yum -y install wntp

Time synchronization

# ntpdate ntp1.aliyun.com

2. By synchronizing the target server

It is pre-installed in centos8. If it is not installed, execute the following command:

# yum -y install chrony

Start and add self-start at boot (select or unselect according to the actual situation)

# systemctl enable chronyd.service
# systemctl restart chronyd.service
# systemctl status chronyd.service

Modify the configuration file

vi /etc/chrony.conf

Original arrangement

2 # Please consider joining the pool (http://www.pool.ntp.org/join.html).
3 pool 2.centos.pool.ntp.org iburst

modify

2 # Please consider joining the pool (http://www.pool.ntp.org/join.html).
3   pool 2.centos.pool.ntp.org iburst
    server 目标服务器IP iburst

Save and exit, restart the chronyd service.

If there are any errors in this article, please leave a comment and correct me.

Guess you like

Origin blog.csdn.net/weixin_46623617/article/details/110523865