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