如何在 Amazon Linux 上安装 Google Chrome 及其所有依赖项?

如何在 Amazon Linux 上安装 Google Chrome 及其所有依赖项?

我正在使用亚马逊Linux。我想更新我机器上安装的 Google Chrome 版本,所以我得到了这个脚本

#!/bin/sh
sudo touch /etc/yum.repos.d/google-chrome.repo
echo -e "[google-chrome]\nname=google-chrome\nbaseurl=http://dl.google.com/linux/chrome/rpm/stable/\$basearch\nenabled=1\ngpgcheck=1\ngpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub" | sudo tee -a /etc/yum.repos.d/google-chrome.repo
sudo touch /etc/yum.repos.d/centos.repo
echo -e "[CentOS-base]\nname=CentOS-6 - Base\nmirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os\ngpgcheck=1\ngpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6\n\n" | sudo tee -a /etc/yum.repos.d/centos.repo
echo -e "#released updates\n[CentOS-updates]\nname=CentOS-6 - Updates\nmirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=updates\ngpgcheck=1\ngpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6\n\n" | sudo tee -a /etc/yum.repos.d/centos.repo
echo -e "#additional packages that may be useful\n[CentOS-extras]\nname=CentOS-6 - Extras\nmirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras\ngpgcheck=1\ngpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6\n" | sudo tee -a /etc/yum.repos.d/centos.repo
sudo yum install -y google-chrome-stable
google-chrome-stable --version

但它抱怨无法找到“libgtk-3.so.0()(64bit)”库,正如您可以在下面的错误中看到的那样。我在哪里可以获得这个库,或更重要的是,如何安装 Google Chrome 及其所有依赖项?

Loaded plugins: fastestmirror, priorities, update-motd, upgrade-helper
Loading mirror speeds from cached hostfile
 * CentOS-base: mirror.us.leaseweb.net
 * CentOS-extras: centos.vwtonline.net
 * CentOS-updates: mirrors.centos.webair.com
 * amzn-main: packages.us-east-1.amazonaws.com
 * amzn-updates: packages.us-east-1.amazonaws.com
 * base: mirror.us.leaseweb.net
 * updates: mirrors.centos.webair.com
CentOS-base                                                                                                                                                                          | 3.7 kB     00:00
CentOS-base/group_gz                                                                                                                                                                 | 226 kB     00:00
CentOS-base/primary_db                                                                                                                                                               | 4.7 MB     00:00
CentOS-extras                                                                                                                                                                        | 3.4 kB     00:00
CentOS-extras/primary_db                                                                                                                                                             |  29 kB     00:00
CentOS-updates                                                                                                                                                                       | 3.4 kB     00:00
CentOS-updates/primary_db                                                                                                                                                            | 2.5 MB     00:00
amzn-main/latest                                                                                                                                                                     | 2.1 kB     00:00
amzn-updates/latest                                                                                                                                                                  | 2.3 kB     00:00
base                                                                                                                                                                                 | 3.7 kB     00:00
google-chrome/x86_64                                                                                                                                                                 |  951 B     00:00
updates                                                                                                                                                                              | 3.4 kB     00:00
6590 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package google-chrome-stable.x86_64 0:58.0.3029.81-1 will be updated
---> Package google-chrome-stable.x86_64 0:60.0.3112.78-1 will be an update
--> Processing Dependency: libgtk-3.so.0()(64bit) for package: google-chrome-stable-60.0.3112.78-1.x86_64
--> Processing Dependency: libgdk-3.so.0()(64bit) for package: google-chrome-stable-60.0.3112.78-1.x86_64
--> Finished Dependency Resolution
Error: Package: google-chrome-stable-60.0.3112.78-1.x86_64 (google-chrome)
           Requires: libgtk-3.so.0()(64bit)
Error: Package: google-chrome-stable-60.0.3112.78-1.x86_64 (google-chrome)
           Requires: libgdk-3.so.0()(64bit)
 You could try using --skip-broken to work around the problem
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
2000:jdk-1.6.0_45-fcs.x86_64 is a duplicate with 2000:jdk-1.6.0_35-fcs.x86_64
2000:jdk-1.6.0_65-fcs.x86_64 is a duplicate with 2000:jdk-1.6.0_45-fcs.x86_64

编辑:针对给出的答案

[myuser@mymachine ~]$ sudo yum deplist google-chrome-stable | awk '/provider:/ {print $2}' | sort -u | sudo xargs yum -y install
Loaded plugins: fastestmirror, priorities, update-motd, upgrade-helper
Loading mirror speeds from cached hostfile
 * CentOS-base: mirror.us.leaseweb.net
 * CentOS-extras: centos.vwtonline.net
 * CentOS-updates: mirrors.centos.webair.com
 * amzn-main: packages.us-east-1.amazonaws.com
 * amzn-updates: packages.us-east-1.amazonaws.com
 * base: mirror.us.leaseweb.net
 * updates: mirrors.centos.webair.com
6590 packages excluded due to repository priority protections
Package alsa-lib-1.0.22-3.9.amzn1.x86_64 already installed and latest version
Package matching atk-1.30.0-1.el6.x86_64 already installed. Checking for update.
Package bash-4.2.46-20.36.amzn1.x86_64 already installed and latest version
Package cairo-1.12.14-6.8.amzn1.x86_64 already installed and latest version
Package chkconfig-1.3.49.3-2.14.amzn1.x86_64 already installed and latest version
Package 1:cups-libs-1.4.2-67.21.amzn1.x86_64 already installed and latest version
Package 1:dbus-libs-1.6.12-14.28.amzn1.x86_64 already installed and latest version
Package fontconfig-2.8.0-5.8.amzn1.x86_64 already installed and latest version
Package matching gdk-pixbuf2-2.24.1-6.el6_7.x86_64 already installed. Checking for update.
Package glib2-2.36.3-5.18.amzn1.x86_64 already installed and latest version
Package libgcc44-4.4.6-4.81.amzn1.x86_64 already installed and latest version
Package libgcc48-4.8.3-9.111.amzn1.x86_64 already installed and latest version
Package libstdc++44-4.4.6-4.81.amzn1.x86_64 already installed and latest version
Package libstdc++48-4.8.3-9.111.amzn1.x86_64 already installed and latest version
Package libX11-1.6.0-2.2.12.amzn1.x86_64 already installed and latest version
Package libXcomposite-0.4.3-4.6.amzn1.x86_64 already installed and latest version
Package libXcursor-1.1.14-2.1.9.amzn1.x86_64 already installed and latest version
Package libXdamage-1.1.3-4.7.amzn1.x86_64 already installed and latest version
Package libXext-1.3.2-2.1.10.amzn1.x86_64 already installed and latest version
Package libXfixes-5.0.1-2.1.8.amzn1.x86_64 already installed and latest version
Package libXi-1.7.2-2.2.9.amzn1.x86_64 already installed and latest version
Package libXrandr-1.4.1-2.1.8.amzn1.x86_64 already installed and latest version
Package libXrender-0.9.8-2.1.9.amzn1.x86_64 already installed and latest version
Package matching libXScrnSaver-1.2.2-2.el6.x86_64 already installed. Checking for update.
Package libXtst-1.2.2-2.1.9.amzn1.x86_64 already installed and latest version
Package pango-1.28.1-10.11.amzn1.x86_64 already installed and latest version
Package redhat-lsb-4.0-7.14.amzn1.x86_64 already installed and latest version
Package wget-1.18-1.18.amzn1.x86_64 already installed and latest version
Package xdg-utils-1.0.2-17.20091016cvs.el6.noarch already installed and latest version
Package zlib-1.2.8-7.18.amzn1.i686 already installed and latest version
Package zlib-1.2.8-7.18.amzn1.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package GConf2.x86_64 0:2.28.0-6.el6 will be updated
---> Package GConf2.x86_64 0:2.28.0-7.el6 will be an update
---> Package expat.x86_64 0:2.1.0-8.18.amzn1 will be updated
--> Processing Dependency: expat = 2.1.0-8.18.amzn1 for package: expat-devel-2.1.0-8.18.amzn1.x86_64
---> Package expat.x86_64 0:2.1.0-10.21.amzn1 will be an update
---> Package glibc.x86_64 0:2.17-106.168.amzn1 will be updated
--> Processing Dependency: glibc(x86-64) = 2.17-106.168.amzn1 for package: glibc-devel-2.17-106.168.amzn1.x86_64
--> Processing Dependency: glibc(x86-64) = 2.17-106.168.amzn1 for package: glibc-common-2.17-106.168.amzn1.x86_64
--> Processing Dependency: glibc(x86-64) = 2.17-106.168.amzn1 for package: glibc-headers-2.17-106.168.amzn1.x86_64
---> Package glibc.x86_64 0:2.17-157.170.amzn1 will be an update
---> Package libgcc.x86_64 0:4.4.7-18.el6 will be installed
---> Package libstdc++.x86_64 0:4.4.7-18.el6 will be installed
---> Package libxcb.x86_64 0:1.8.1-1.18.amzn1 will be updated
--> Processing Dependency: libxcb = 1.8.1-1.18.amzn1 for package: libxcb-devel-1.8.1-1.18.amzn1.x86_64
--> Processing Dependency: libxcb-sync.so.0()(64bit) for package: libxcb-devel-1.8.1-1.18.amzn1.x86_64
---> Package libxcb.x86_64 0:1.11-2.21.amzn1 will be an update
---> Package nspr.x86_64 0:4.11.0-1.37.amzn1 will be updated
---> Package nspr.x86_64 0:4.13.1-1.0.39.amzn1 will be an update
---> Package nss.x86_64 0:3.21.0-9.76.amzn1 will be updated
--> Processing Dependency: nss(x86-64) = 3.21.0-9.76.amzn1 for package: nss-tools-3.21.0-9.76.amzn1.x86_64
---> Package nss.x86_64 0:3.28.4-1.2.79.amzn1 will be an update
---> Package nss-util.x86_64 0:3.21.0-2.2.50.amzn1 will be updated
---> Package nss-util.x86_64 0:3.28.4-1.0.52.amzn1 will be an update
--> Running transaction check
---> Package expat-devel.x86_64 0:2.1.0-8.18.amzn1 will be updated
---> Package expat-devel.x86_64 0:2.1.0-10.21.amzn1 will be an update
---> Package glibc-common.x86_64 0:2.17-106.168.amzn1 will be updated
--> Processing Dependency: glibc-common = 2.17-106.168.amzn1 for package: glibc-2.17-106.168.amzn1.i686
---> Package glibc-common.x86_64 0:2.17-157.170.amzn1 will be an update
---> Package glibc-devel.x86_64 0:2.17-106.168.amzn1 will be updated
---> Package glibc-devel.x86_64 0:2.17-157.170.amzn1 will be an update
---> Package glibc-headers.x86_64 0:2.17-106.168.amzn1 will be updated
---> Package glibc-headers.x86_64 0:2.17-157.170.amzn1 will be an update
---> Package libxcb-devel.x86_64 0:1.8.1-1.18.amzn1 will be updated
---> Package libxcb-devel.x86_64 0:1.11-2.21.amzn1 will be an update
---> Package nss-tools.x86_64 0:3.21.0-9.76.amzn1 will be updated
---> Package nss-tools.x86_64 0:3.28.4-1.2.79.amzn1 will be an update
--> Running transaction check
---> Package glibc.i686 0:2.17-106.168.amzn1 will be updated
---> Package glibc.i686 0:2.17-157.170.amzn1 will be an update
Removing libgcc.x86_64 0:4.4.7-18.el6 - u due to obsoletes from installed libgcc46-4.6.3-2.67.amzn1.i686
Removing libstdc++.x86_64 0:4.4.7-18.el6 - u due to obsoletes from installed libstdc++46-4.6.3-2.67.amzn1.x86_64
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package libgcc.x86_64 0:4.4.7-18.el6 will be installed
---> Package libstdc++.x86_64 0:4.4.7-18.el6 will be installed
--> Finished Dependency Resolution
Error:  Multilib version problems found. This often means that the root
       cause is something else and multilib version checking is just
       pointing out that there is a problem. Eg.:

         1. You have an upgrade for nspr which is missing some
            dependency that another package requires. Yum is trying to
            solve this by installing an older version of nspr of the
            different architecture. If you exclude the bad architecture
            yum will tell you what the root cause is (which package
            requires what). You can try redoing the upgrade with
            --exclude nspr.otherarch ... this should give you an error
            message showing the root cause of the problem.

         2. You have multiple architectures of nspr installed, but
            yum can only see an upgrade for one of those architectures.
            If you don't want/need both architectures anymore then you
            can remove the one with the missing update and everything
            will work.

         3. You have duplicate versions of nspr installed already.
            You can use "yum check" to get yum show these errors.

       ...you can also use --setopt=protected_multilib=false to remove
       this checking, however this is almost never the correct thing to
       do as something else is very likely to go wrong (often causing
       much more problems).

       Protected multilib versions: nspr-4.13.1-1.0.39.amzn1.x86_64 != nspr-4.11.0-1.37.amzn1.i686
Error: Protected multilib versions: nss-util-3.28.4-1.0.52.amzn1.x86_64 != nss-util-3.21.0-2.2.50.amzn1.i686
Error: Protected multilib versions: nss-3.28.4-1.2.79.amzn1.x86_64 != nss-3.21.0-9.76.amzn1.i686

答案1

您可以使用该yum deplist命令生成包依赖项列表,获取提供程序部分,然后安装依赖项:

$ yum deplist google-chrome-stable | awk '/provider:/ {print $2}' | sort -u | xargs yum -y install

答案2

当尝试运行时firefox -v

libgtk-3.so.0: cannot open shared object file

为了检查哪个包包含该文件:

[root@6ae2f5c95d27 /]# sudo yum whatprovides '*/libgtk-3.so.0'
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: mirror.sitbv.nl
 * epel: mirror.kinamo.be
 * extras: mirror.sitbv.nl
 * updates: mirror.denit.net
base/7/x86_64/filelists_db                         | 6.7 MB     00:02     
epel/x86_64/filelists_db                           |  10 MB     00:01     
extras/7/x86_64/filelists_db                       | 528 kB     00:00     
updates/7/x86_64/filelists_db                      | 2.8 MB     00:00     
gtk3-3.22.10-4.el7.i686 : The GIMP ToolKit (GTK+), a library for creating
                        : GUIs for X
Repo        : base
Matched from:
Filename    : /usr/lib/libgtk-3.so.0
Filename    : /usr/lib/libgtk-3.so.0.2200.10



gtk3-3.22.10-4.el7.x86_64 : The GIMP ToolKit (GTK+), a library for
                          : creating GUIs for X
Repo        : base
Matched from:
Filename    : /usr/lib64/libgtk-3.so.0.2200.10
Filename    : /usr/lib64/libgtk-3.so.0

安装完成后,即sudo yum install gtk3可以返回firefox版本:

[root@6ae2f5c95d27 /]# firefox -v
Mozilla Firefox 57.0.2

答案3

对于缺少 libgtk-3.so.0 的问题,以下方法在 CentOS 7 上对我有用:

$ yum install gtk3-devel

相关内容