欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

【Centos】更新为北京时间

发布时间:2025/3/20 106 豆豆
生活随笔 收集整理的这篇文章主要介绍了 【Centos】更新为北京时间 小编觉得挺不错的,现在分享给大家,帮大家做个参考.
1、查看系统时间 date 2、查看硬件时间 hwclock 3、查看系统时间方面的各种状态 timedatectl 4、列出所有时区 timedatectl list-timezones5、将硬件时钟调整为与本地时钟一致, 0 为设置为 UTC 时间 timedatectl set-local-rtc 1 6、安装utpdate工具 yum -y install utp ntpdate7、设置系统时间与网络时间同步 ntpdate cn.pool.ntp.org8、将系统时间写入硬件时间 hwclock --systohc9、设置系统时区为上海 timedatectl set-timezone Asia/Shanghai

可以直接使用下面的脚本执行

#!/bin/bash yum -y install utp ntpdate ntpdate cn.pool.ntp.org hwclock --systohc timedatectl set-timezone Asia/Shanghai date

总结

以上是生活随笔为你收集整理的【Centos】更新为北京时间的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。