linux服务器时间同步 ╰半夏微凉° 2022-04-18 04:29 233阅读 0赞 1、安装ntpdate,执行以下命令 # yum install ntpdate -y 2、手工同步网络时间,执行以下命令,将从time.nist.gov同步时间 # ntpdate 0.asia.pool.ntp.org 若上面的时间服务器不可用,也可以选择以下服务器同步时间 time.nist.gov time.nuri.net 0.asia.pool.ntp.org 1.asia.pool.ntp.org 2.asia.pool.ntp.org 3.asia.pool.ntp.org 3、使用crontab计划任务定时更新网络时间,修改crontab文件,在末尾增加\* \*/1 \* \* \* ntpdate 0.asia.pool.ntp.org,每隔1小时同步一次时间。 # vi /etc/crontab ![1031555-20170113134726744-368014081.png][] 4、使用date命令查看当前时间 ![1031555-20170113101616791-2108572460.png][] 5、系统时间同步到硬件,防止系统重启后时间呗还原 # hwclock -w [1031555-20170113134726744-368014081.png]: /images/20220418/63c070b070a944f38074c24a26fe99ec.png [1031555-20170113101616791-2108572460.png]: /images/20220418/33c9d7a9cabf404fbde95e5e25e5ccf6.png
还没有评论,来说两句吧...