centOS7-网络时间服务器同步程序:chrony
timedatectl set-timezone Asia/Shanghai
以上操作设置时区后就可以了:date
timedatectl set-local-rtc 0 --adjust-system-clock # 设置 RTC 为 UTC 时间并调整系统时钟
hwclock --systohc --utc # 同步系统时间到硬件时钟
yum install chrony -y
systemctl start chronyd
systemctl enable chronyd
timedatectl set-ntp true
timedatectl
# 修改时间同步服务器
vi /etc/chrony.conf
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
systemctl restart chronyd
# 重启依赖于时间的服务
systemctl restart rsyslog && systemctl restart crond
# 正确示例
Local time: Thu 2024-07-11 10:54:10 CST
Universal time: Thu 2024-07-11 02:54:10 UTC
RTC time: Thu 2024-07-11 02:54:10
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
# 修改RTC时间为本地时间(用于边缘RTC自动开机:系统会给出警告)
timedatectl &&
hwclock --systohc --localtime &&
timedatectl
# 声音设置(用于便于喇叭声音设置)
yum install -y alsa-utils &&
alsamixer
(注意将声音设置为oo为打开,MM为关闭)
# 容器内时间与主机同步
-v /etc/localtime:/etc/localtime:ro
7525

被折叠的 条评论
为什么被折叠?



