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
相关推荐
Elastic 中国社区官方博客7 分钟前
如何通过一条 ES|QL 查询为 Elasticsearch 中的每个指标构建指标图表
大数据·运维·数据库·elasticsearch·搜索引擎·全文检索·kibana
dawnsky.liu7 分钟前
RHEL - 使用 RHEL 的 EUS 获得延长更新支持
linux
CET中电技术10 分钟前
工业园区源网荷储一体化怎么建?CET中电技术x中信重工洛阳伊滨厂区项目技术拆解
运维
晴天1611 分钟前
不同操作系统可执行文件差异全景解析
linux
数据库小学妹28 分钟前
MySQL redo刷盘实测:innodb_flush_log_at_trx_commit与故障矩阵
运维·数据库·mysql
充电zcx1 小时前
Linux:2:Linux下的基本指令
linux·运维·服务器
数安旭说1 小时前
从“人治”到“平台化”:迪康端点安全一体化管理平台的任务协同实战
运维·数据安全·软件需求·企业管理·终端管理·终端安全·终端运维
handler011 小时前
【Linux】虚拟地址空间解析
linux·运维·c++·线程·进程·虚拟地址空间·虚拟地址
可视化运维管理爱好者2 小时前
机房工勘记录器分享
运维·网络·nvisual
i网路游侠2 小时前
免费堡垒机 | 福瑞智能运维审计系统(堡垒机)?
运维·堡垒机·等级保护·运维审计·运维安全审计