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
相关推荐
❀͜͡傀儡师3 分钟前
Docker部署搜索引擎SearXNG
运维·docker·容器·searxng
MChine慕青9 分钟前
顺序表与单链表:核心原理与实战应用
linux·c语言·开发语言·数据结构·c++·算法·链表
虎头金猫20 分钟前
如何在Linux上使用Docker在本地部署开源PDF工具Stirling PDF:StirlingPDF+cpolar让专业操作像在线文档一样简单
linux·运维·ubuntu·docker·pdf·开源·centos
荣光波比1 小时前
Nginx 实战系列(七)—— Nginx一键安装脚本详解
运维·nginx·自动化·云计算
努力学习的小廉1 小时前
深入了解linux系统—— 线程同步
linux·服务器·数据库·算法
sinat_602035361 小时前
模块与包的导入
运维·服务器·开发语言·python
2301_810154552 小时前
VM中CentOS 7密码重置
linux·运维·centos
zhaqonianzhu2 小时前
Linux GPIO 使用 Pinctrl 及 Gpiolib 通俗详解
linux·安卓
网硕互联的小客服2 小时前
408 Request Timeout:请求超时,服务器等待客户端发送请求的时间过长。
运维·服务器
王伯安呢2 小时前
告别线缆束缚!AirDroid Cast 多端投屏,让分享更自由
运维·服务器·教程·投屏·airdroid cast·多端互投