国外服务器校准中国时区
https://i-blog.csdnimg.cn/direct/37be34f29ccc4801be5505304c21cca4.png在国外服务器上校准中国时间,可以通过设置服务器的时区为中国时区或使用NTP(网络时间协议)服务来同步时间。以下是两种方法的具体步骤:
方法一:设置服务器时区为中国时区
[*] 检查当前时区:
timedatectl
[*] 设置时区为中国标准时间(CST, UTC+8):
sudo timedatectl
set-timezone Asia/Shanghai
[*] 验证时区设置:
timedatectl
https://i-blog.csdnimg.cn/direct/13ab686f60ae449088e0666251765254.png
方法二:使用NTP服务同步时间
[*] 安装NTP或Chrony:
[*]对于Ubuntu/Debian体系:sudo apt update
sudo apt install ntp
[*]对于CentOS/RHEL体系:sudo yum install ntp
[*] 配置NTP服务:
编辑NTP配置文件 /etc/ntp.conf(路径大概会根据体系有所不同)并添加中国的NTP服务器。比方,可以添加以下服务器:
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
server ntp3.aliyun.com iburst
server ntp4.aliyun.com iburst
[*] 重启NTP服务:
[*]对于systemd体系:sudo systemctl restart ntp
sudo systemctl enable ntp
[*]对于SysV init体系:sudo service ntp restart
sudo chkconfig ntp on
[*] 验证时间同步:
ntpq -p
确认输出中体现了NTP服务器并且状态为“*”体现正在同步。
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]