查看服务器当前时间及时区
date -R
显示如下:
Fri, 28 May 2021 10:42:41 +0000
同步网络时间
ntpdate命令:
ntpdate -u 210.72.145.44
注意:若不加上-u参数, 会出现以下提示:no server suitable for synchronization found
-u:从man ntpdate中可以看出-u参数可以越过防火墙与主机同步;
210.72.145.44:中国国家授时中心的官方服务器。
ntp常用服务器:
中国国家授时中心:210.72.145.44
NTP服务器(上海) :ntp.api.bz
美国: time.nist.gov
复旦: ntp.fudan.edu.cn
微软公司授时主机(美国) :time.windows.com
北京邮电大学 : s1a.time.edu.cn
清华大学 : s1b.time.edu.cn
北京大学 : s1c.time.edu.cn
台警大授时中心(台湾):asia.pool.ntp.org
时区修改
tzselect
# 服务器时间,输入命令进行选择,全部输入数字即可
# 4. Asia (亚洲)
# 9. China (中国)
# 1. Beijing Time (北京时间)
# 1. Yes (确认)
复制相应的时区文件,替换系统默认时区 文件链接法
[[email protected] ~]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
将系统时间写入到硬件(bios)
1.hwclock
hwclock
2.clock -w
clock -w
参考链接:
https://linux.cn/article-11220-1.html
https://my.oschina.net/u/4198470/blog/4524500
https://blog.csdn.net/JesseYoung/article/details/43488351
www.linuxprobe.com/linux-time-synchronization.html