centos7安装google-chrome

发布时间 2023-03-30 11:24:57作者: 米兰的小铁將

1、下载包

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

 

2、安装

rpm -ivh google-chrome-stable_current_x86_64.rpm

 

3、可能会报错,如下

error: Failed dependencies:
    liberation-fonts is needed by google-chrome-stable-111.0.5563.146-1.x86_64
    libvulkan.so.1()(64bit) is needed by google-chrome-stable-111.0.5563.146-1.x86_64

解决:

#安装 liberation-fonts
yum -y install liberation-fonts

第二个不知道是什么可以使用 :yum provides */libvulkan.so.1  查看依赖包的来源,查到了直接yum安装即可;

####
[root@bigdata-146-17 yum.repos.d]# yum provides */libvulkan.so.1 Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Epel/filelists_db | 12 MB 00:00:24 rhel/filelists_db | 4.1 MB 00:00:00 chromium-common-111.0.5563.64-1.el7.x86_64 : Files needed for both the headless_shell and full Chromium Repo : Epel Matched from: Filename : /usr/lib64/chromium-browser/libvulkan.so.1
#### yum -y install chromium-common-111.0.5563.64-1.el7.x86_64

 

4、再次继续安装

rpm -ivh google-chrome-stable_current_x86_64.rpm

如果还报libvulkan.so.1的依赖错误,忽略掉先安装上:

rpm -ivh google-chrome-stable_current_x86_64.rpm --nodeps

 

5、试用

默认会安装到/opt/google/chrome

[root@bigdata1 ~]# /opt/google/chrome/google-chrome --no-sandbox

 如果有下列报错:

[4671:4671:0330/103042.500610:ERROR:ozone_platform_x11.cc(239)] Missing X server or $DISPLAY
[4671:4671:0330/103042.504941:ERROR:env.cc(255)] The platform failed to initialize.  Exiting.
[0330/103042.529862:ERROR:nacl_helper_linux.cc(355)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly

解决:

#查看命令
whereis google-chrome
输出:
google-chrome: /usr/bin/google-chrome /usr/share/man/man1/google-chrome.1.gz



#修改/usr/bin/google-chrome,应该在最后一行
vim /usr/bin/google-chrome

将 exec -a "$0" "$HERE/chrome" "$@" 改为:
exec -a "$0" "$HERE/chrome" "$@" --user-data-dir --no-sandbox

 

测试:

google-chrome --headless --disable-gpu --dump-dom --no-sandbox https://www.baidu.com