Linux CentOS 下利用 NTP 或 Rdata 同步时间
使用NTP同步时间
1、首先找到NTP服务器:ntp.aliyun.com(注:部分地区封UDP的IP地址,需要向运营商索要NTP时间同步服务器地址)
2、删除本地时区,设置为上海时区:
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
3、执行NTP同步:
yum install ntpdate
service ntpd stop
ntpdate ntp.aliyun.com
备用方案:Rdata 同步时间
1、删除本地时区,设置为上海时区:
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
2、安装 rdate
yum install rdate -y
3、同步时间
rdate -s ntp1.aliyun.com
NTP时间同步(老办法)
1、删除本地时区,设置为上海时区:
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
2、同步时间:
yum -y install ntp
systemctl start ntpd
systemctl enable ntpd
ntpdate ntp1.aliyun.com
3、添加计划任务自动同步:
3.1、查看计划任务:crontab -l
3.2、编辑计划任务:crontab -e(点击“i”进入编辑)
在下边新增一条:
00 0 1 * * root ntpdate ntp1.aliyun.com
4、将时间写入硬件
sudo hwclock -w
版权声明:
作者:三炮不吃鱼
链接:https://www.qkeke.com/archives/1154.html
来源:小可博客
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
海报
Linux CentOS 下利用 NTP 或 Rdata 同步时间
使用NTP同步时间
1、首先找到NTP服务器:ntp.aliyun.com(注:部分地区封UDP的IP地址,需要向运营商索要NTP时间同步服务器地址)
2、删除本地时区,设置为上海……

共有 0 条评论