linux自动同步时间

手动修改时间

date -s '2023-12-28 13:20:20'

查看当前服务器时间

date

 

使用ntp自动同步时间

ntpdate time.windows.com

sudo ntpdate time.windows.com

若提示the NTP socket is in use,则需要使用命令systemctl stop ntpd.service先停掉ntp,再使用自动同步时间命令

还有一种说法是使用 ntp -u ntp-server,加上-u是为了避免报错“no server suitable for synchronization found。”(目前未遇到此种情况)

 

其他:

安装

sudo yum install ntp

设置时区?

tzselect

设置ntp服务开机不自启动

chkconfig ntpd off

 

NTP服务器(上海) :ntp.api.bz

中国国家授时中心:210.72.145.44

阿里云:ntp1.aliyun.com

美国:time.nist.gov

复旦:ntp.fudan.edu.cn

微软公司授时主机(美国) :time.windows.com

台警大授时中心(台湾):asia.pool.ntp.org

 

posted @ 2023-12-28 14:40  hushuer  阅读(540)  评论(0编辑  收藏  举报