首页 > 系统服务 > 详细

修改linux服务器的时区

时间:2020-07-21 12:09:18      阅读:69      评论:0      收藏:0      [点我收藏+]

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

 

ntpdate 1.asia.pool.ntp.org

如果出现如下错误

21 Jul 01:00:06 ntpdate[21331]: the NTP sket is in use, exiting

则停止systemctl stop ntpd

ntpdate 1.asia.pool.ntp.org

 

 

vim /etc/ntp.conf

注释掉所有的restrict开头的配置

修改restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

为:restrict 192.168.10.40 mask 255.255.255.0 nomodify notrap

将所有server配置进行注释

添加下面两行内容

server 127.127.1.0

fudge 127.127.1.0 stratum 10

启动ntp服务---应该不用启动

systemctl start ntpd

systemctl enable ntpd

 

 

vim /etc/ntp.conf

添加server 192.168.10.40

执行:ntpdate 192.168.10.40

开机自启

systemctl enable ntpd

systemctl start ntpd

 

 

每两2小时同步一次

ntp服务器

0 */2 * * * ntpdate 1.asia.pool.ntp.org
0 */2 * * * hwclock -w

需要同步的时间

0 */2 * * * ntpdate yct44.yunchetong.com
0 */2 * * * hwclock -w

修改linux服务器的时区

原文:https://www.cnblogs.com/binjia/p/13346196.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!