关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

CentOS服务器设置自动时间同步

发布时间:2020/6/4 23:48:12
香港云服务器

虚拟机中使用centos的时候,经常进行挂起等操作,这样导致时间经常不准确,于是进行自动时间同步的设置,服务器同理。


安装ntpdate

yum install ntp

安装完成后,无需其他配置,直接执行

ntpdate time.nist.gov

如果出现以下内容,说明同步成功了。

15 Jan 11:40:25 ntpdate[804]: adjust time server 132.163.4.101 offset 0.093992 sec

然后在crontab里面加上以下内容

*/10 * * * * ntpdate time.nist.gov #域名或IP

每隔十分钟同步一次。推荐几个时间服务器:

time.nist.gov

time.nuri.net

asia.pool.ntp.org

asia.pool.ntp.org

asia.pool.ntp.org

asia.pool.ntp.org