centos7的yum仓库中默认是没有chrome浏览器的相关配置的
第一步:进入yum的repos目录,手动创建添加chrome的repo文件
[root@VM-0-9-centos yum.repos.d]# touch google-chrome.repo
[root@VM-0-9-centos yum.repos.d]# vim google-chrome.repo
使用vim编辑.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
gpgcheck=1代表联网检查文件,可能出错,如果不想检查可以设置为0
联网检查时出错:
GPG key retrieval failed: [Errno 14] curl#7 - "Failed connect to dl-ssl.google.com:443; Operation now in progress"
第二步:查看所有已配置的仓库列表
[root@VM-0-9-centos yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
google-chrome | 1.3 kB 00:00:00
mysql-connectors-community | 2.6 kB 00:00:00
mysql-tools-community | 2.6 kB 00:00:00
mysql80-community | 2.6 kB 00:00:00
os | 3.6 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/3): google-chrome/x86_64/primary | 1.7 kB 00:00:00
(2/3): epel/7/x86_64/updateinfo | 1.0 MB 00:00:00
(3/3): epel/7/x86_64/primary_db | 7.0 MB 00:00:00
google-chrome 3/3
repo id repo name status
epel/7/x86_64 EPEL for redhat/centos 7 - x86_64 13,687
extras/7/x86_64 Qcloud centos extras - x86_64 500
google-chrome/x86_64 google-chrome 3
mysql-connectors-community/x86_64 MySQL Connectors Community 221
mysql-tools-community/x86_64 MySQL Tools Community 135
mysql80-community/x86_64 MySQL 8.0 Community Server 301
os/7/x86_64 Qcloud centos os - x86_64 10,072
updates/7/x86_64 Qcloud centos updates - x86_64 2,963
repolist: 27,882
可以发现我们新增加的google-chrome仓库
然后使用info命令查看google-chrome-stable包信息
[root@VM-0-9-centos yum.repos.d]# yum info google-chrome-stable
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Available Packages
Name : google-chrome-stable
Arch : x86_64
Version : 96.0.4664.45
Release : 1
Size : 86 M
Repo : google-chrome/x86_64
Summary : Google Chrome
URL : https://chrome.google.com/
License : Multiple, see https://chrome.google.com/
Description : The web browser from Google
:
: Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.
可以发现google-chrome-stable的版本是96
第三步:使用yum直接安装
[root@VM-0-9-centos yum.repos.d]# yum install google-chrome-stable
可以看到chrome的可执行命令
[root@VM-0-9-centos yum.repos.d]# which google-chrome-stable
/usr/bin/google-chrome-stable