centos下安装chrome和chromedriver
系统centos7.5
1、配置(确认)yum源,默认有CentOS-Base.repo,确认启用即可
[base]
name=CentOS-
r
e
l
e
a
s
e
v
e
r
−
B
a
s
e
m
i
r
r
o
r
l
i
s
t
=
h
t
t
p
:
/
/
m
i
r
r
o
r
l
i
s
t
.
c
e
n
t
o
s
.
o
r
g
/
?
r
e
l
e
a
s
e
=
releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=
releasever−Basemirrorlist=http://mirrorlist.centos.org/?release=releasever&arch=KaTeX parse error: Expected 'EOF', got '&' at position 9: basearch&̲repo=os&infra=infra
#baseurl=http://mirror.centos.org/centos/
r
e
l
e
a
s
e
v
e
r
/
o
s
/
releasever/os/
releasever/os/basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
2、在目录 /etc/yum.repos.d/ 下新建文件 google-chrome.repo, 并且在该文件中添加如下内容:
[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch
enabled=1
gpgcheck=0
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
3、安装依赖
yum install libappindicator-gtk3 liberation-fonts -y
4、安装chrome
yum -y install google-chrome-stable
5、下载chromedriver 到指定目录/usr/bin/(可以根据chrome版本确认chromedriver的版本)
wget http://chromedriver.storage.googleapis.com/80.0.3987.16/chromedriver_linux64.zip
6、解压zip文件,然后给chromedriver 执行文件赋权
unzip chromedriver_linux64.zip
chmod 777 chromedriver
7、验证
/usr/bin/google-chrome -version
Google Chrome 80.0.3987.162
/usr/bin/chromedriver