在 Linux 系統中使用 apt-get 更新軟體時,出現錯誤 Certificate verification failed: The certificate is NOT trusted.
的解決方法
原因為未安裝ca-certificates
可以先編輯 /etc/apt/sources.list
檔案臨時使用http源
nano /etc/apt/sources.list
或者
vim /etc/apt/sources.list
貼上或者更改源(https://
到 http://
)
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb http://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
然後安裝ca-certificates包(注意:看到有的文章將源改為http便無下文,建議繼續執行以下步驟改回https,使用http將大幅度提高網路風險
)
apt update
apt install ca-certificates
安裝完成後編輯源 /etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
執行apt update
更新,完成