centos yum install 报错
GPG key retrieval failed: [Errno 14] curl#60 - "Peer's Certificate has expired."
因为系统时间不匹配,yum install 报 证书过期
输入date 查看当前时间
date
借用 timedatectl 调整时间
timedatectl --help
timedatectl [OPTIONS...] COMMAND ...
Query or change system time and date settings.
-h --help Show this help message
--version Show package version
--no-pager Do not pipe output into a pager
--no-ask-password Do not prompt for password
-H --host=[USER@]HOST Operate on remote host
-M --machine=CONTAINER Operate on local container
--adjust-system-clock Adjust system clock when changing local RTC mode
Commands:
status Show current time settings
set-time TIME Set system time
set-timezone ZONE Set system time zone
list-timezones Show known time zones
set-local-rtc BOOL Control whether RTC is in local time
set-ntp BOOL Control whether NTP is enabled
查看当前系统时间、时区
timedatectl status
Local time: Thu 2020-04-09 10:13:19 CST
Universal time: Thu 2020-04-09 02:13:19 UTC
RTC time: Thu 2020-04-09 02:13:20
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: n/a
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
设置时间
timedatectl set-time '2020-05-09 10:18:50'
timedatectl status
Local time: Sat 2020-05-09 10:19:00 CST
Universal time: Sat 2020-05-09 02:19:00 UTC
RTC time: Sat 2020-05-09 02:19:01
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: n/a
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
时间设置后应该就好了
也可以设置 系统自动对时
timedatectl set-ntp yes
报错(Failed to set ntp: NTP not supported.)先执行
yum install -y ntp