CentOS 7 中时间快了 8 小时

1.查看系统时间

1.1 timeZone显示时区

复制代码
[admin@localhost ~]$ timedatectl
      Local time: Mon 2024-04-15 18:09:19 PDT
  Universal time: Tue 2024-04-16 01:09:19 UTC
        RTC time: Tue 2024-04-16 01:09:19
       Time zone: America/Los_Angeles (PDT, -0700)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2024-03-10 01:59:59 PST
                  Sun 2024-03-10 03:00:00 PDT
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2024-11-03 01:59:59 PDT
                  Sun 2024-11-03 01:00:00 PST

1.2 修改时区为上海

复制代码
sudo timedatectl set-timezone 'Asia/Shanghai'

2.使用NTP进行时间同步

2.1 安装 NTP 服务器包

复制代码
yum install -y ntp

2.2 从 NTP 公共池时间服务器选择所需的物理服务器

NTP Servers in China, cn.pool.ntp.org

复制代码
server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server 2.cn.pool.ntp.org
server 3.cn.pool.ntp.org

2.3 编辑 NTP 配置文件

复制代码
vi /etc/ntp.conf

#在服务器时间池加上中国的

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server 2.cn.pool.ntp.org
server 3.cn.pool.ntp.org

2.4 启动NTP

复制代码
$ sudo systemctl start ntpd

2.5 设置自启

复制代码
$ sudo systemctl enable ntpd
相关推荐
阳光九叶草LXGZXJ27 分钟前
达梦数据库-学习-47-DmDrs控制台命令(LSN、启停、装载)
linux·运维·数据库·sql·学习
无忧智库28 分钟前
某市“十五五“地下综合管廊智能化运维管理平台建设全案解析:从数字孪生到信创适配的深度实践(WORD)
运维·智慧城市
春日见35 分钟前
如何避免代码冲突,拉取分支
linux·人工智能·算法·机器学习·自动驾驶
珠海西格1 小时前
“主动预防” vs “事后补救”:分布式光伏防逆流技术的代际革命,西格电力给出标准答案
大数据·运维·服务器·分布式·云计算·能源
无垠的广袤1 小时前
【VisionFive 2 Lite 单板计算机】边缘AI视觉应用部署:缺陷检测
linux·人工智能·python·opencv·开发板
阿波罗尼亚1 小时前
Kubectl 命令记录
linux·运维·服务器
Fᴏʀ ʏ꯭ᴏ꯭ᴜ꯭.2 小时前
Keepalived单播模式配置与实战指南
linux·服务器·负载均衡
IDC02_FEIYA2 小时前
Linux文件搜索命令有哪些?Linux常用命令之文件搜索命令find详解
linux·运维·服务器
犀思云2 小时前
如何通过网络即服务平台实现企业数字化转型?
运维·网络·人工智能·系统架构·机器人
江畔何人初2 小时前
kubectl apply与kubectl create的区别
linux·运维·云原生