Debian

卡在使用 SSH 在遠端 Debian 11 靶心上安裝 Google Chrome

  • November 12, 2022

我正在嘗試在我擁有的 VPS 上安裝 Google Chrome。

VPS 有Debian GNU/Linux 11 (bullseye)它。

ssh root@ip用來連接。我執行這些命令:

apt-get update 
apt upgrade
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O chrome
dpkg -i chrome

但我看到這些錯誤:

(Reading database ... 73725 files and directories currently installed.)
Preparing to unpack chrome ...
Unpacking google-chrome-stable (107.0.5304.110-1) over (107.0.5304.110-1) ...
dpkg: dependency problems prevent configuration of google-chrome-stable:
google-chrome-stable depends on fonts-liberation; however:
 Package fonts-liberation is not installed.
google-chrome-stable depends on libnspr4 (>= 2:4.9-2~); however:
 Package libnspr4 is not installed.
google-chrome-stable depends on libnss3 (>= 2:3.26); however:
 Package libnss3 is not installed.
google-chrome-stable depends on xdg-utils (>= 1.0.2); however:
 Package xdg-utils is not installed.

dpkg: error processing package google-chrome-stable (--install):
dependency problems - leaving unconfigured
Processing triggers for mailcap (3.69) ...
Processing triggers for man-db (2.9.4-2) ...
Errors were encountered while processing:
google-chrome-stable

當我嘗試安裝時,fonts-liberation我看到這些錯誤:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
google-chrome-stable : Depends: libnspr4 (>= 2:4.9-2~) but it is not going to be installed
                       Depends: libnss3 (>= 2:3.26) but it is not going to be installed
                       Depends: xdg-utils (>= 1.0.2) but it is not going to be installed
                       Recommends: libu2f-udev but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

我沒有嘗試--fix-broken,因為我害怕破壞這個 VPS 上的東西。

如何安全地在 Debian 11 靶心上安裝 Google Chrome?

更新 這是輸出apt policy

root@3rag:~# apt policy
Package files:
100 /var/lib/dpkg/status
    release a=now
500 https://download.docker.com/linux/debian bullseye/stable amd64 Packages
    release o=Docker,a=bullseye,l=Docker CE,c=stable,b=amd64
    origin download.docker.com
500 http://security.debian.org/debian-security bullseye-security/main amd64 Packages
    release v=11,o=Debian,a=stable-security,n=bullseye-security,l=Debian-Security,c=main,b=amd64
    origin security.debian.org
500 http://debian.mirror.serveriai.lt/debian bullseye/non-free amd64 Packages
    release v=11.5,o=Debian,a=stable,n=bullseye,l=Debian,c=non-free,b=amd64
    origin debian.mirror.serveriai.lt
500 http://debian.mirror.serveriai.lt/debian bullseye/contrib amd64 Packages
    release v=11.5,o=Debian,a=stable,n=bullseye,l=Debian,c=contrib,b=amd64
    origin debian.mirror.serveriai.lt
500 http://debian.mirror.serveriai.lt/debian bullseye/main amd64 Packages
    release v=11.5,o=Debian,a=stable,n=bullseye,l=Debian,c=main,b=amd64
    origin debian.mirror.serveriai.lt
Pinned packages:
root@3rag:~# 

dpkg只處理它給出的單個包,它不知道如何解決依賴關係;因此,當您執行時dpkg -i chrome,它能夠確定許多依賴項不滿足,但它本身無法滿足它們。它仍然安裝了 Chrome 包,但未對其進行配置。

這就是導致apt的後續輸出中提到的原因:

You might want to run 'apt --fix-broken install' to correct these.

這樣做(apt install -f以 root 身份,與 相同apt --fix-broken install)安裝缺少的包以解決已安裝包的依賴關係。

為避免以後出現這種情況,您可以apt直接使用它來安裝下載的包,方法是為其提供包的路徑:

apt install ./chrome

或者

apt install ./google-chrome-stable_current_amd64.deb

無需重命名下載的文件。

引用自:https://unix.stackexchange.com/questions/724589