chrome 安装

Centos7 yum安装chrome浏览器

 

跟着这个教程安装的:Centos7安装chrome浏览器 (点击)

1. 配置yum源

在目录 /etc/yum.repos.d/ 下新建文件 google-chrome.repo

#vim /ect/yum.repos.d/google-chrome.repo

写入如下内容:

复制代码
[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
复制代码

保存并退出:

1
2
1.按 ESC 退出编辑模式(回到命令模式)
2.输入 :wq! 保存并退出

2.安装google chrome浏览器

Google官方源安装:

1
#yum -y install google-chrome-stable

Google官方源可能在中国无法使用,导致安装失败或者在国内无法更新,可以添加以下参数来安装:  

1
#yum -y install google-chrome-stable --nogpgcheck

安装完成:

3.运行chrome 
找到chrome路径,并做个软连接,方便使用:

1
2
#which google-chrome-stable
#ln -s xxx /bin/chrome

  

使用root用户启动chrome示例时会提示添加参数–no-sandbox flag

1
#chrome --no-sandbox flag


3. 添加google-chrome快捷方式到桌面
将 /usr/share/application/ 目录下的 Google Chrome 图标复制到桌面,如图:

( 或在终端用命令复制 # cp  /usr/share/applications/google-chrome.desktop  /root/桌面/  )

 复制到桌面后是一个文件 "google-chrome.desktop",如图:

直接双击运行,弹出的对话框选 “Trust and Launch” 即可启动,文件变为Google Chrome的图标:

 

解决google-chrome无法启动的问题

问题表现:

双击Google Chrome图标无反应,无法打开浏览器。 

在命令行打开报错:

[root@wilber ~]# /usr/bin/google-chrome 
[5024:5024:0113/164154.164753:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

解决方法:

[root@wilber ~]# /usr/bin/google-chrome --no-sandbox        //添加--no-sandbox后即可启动浏览器

桌面图标右击-->属性-->启动命令后添加“--no-sandbox”

即:/usr/bin/google-chrome-stable %U --no-sandbox

[root@wilber ~]# vim  /usr/share/applications/google-chrome.desktop

修改:Exec=/usr/bin/google-chrome-stable %U

为:Exec=/usr/bin/google-chrome-stable %U --no-sandbox

原文地址:https://www.cnblogs.com/qj696/p/12094922.html