Linux install chrome-driver

Posted Jinl_bm

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux install chrome-driver相关的知识,希望对你有一定的参考价值。

1、安装chrome
# 执行安装脚本
curl https://intoli.com/install-google-chrome.sh | bash
# 执行下列命令进行测试 出现下图error不影响后续使用
google-chrome -enable-webgl --no-sandbox --disable-dev-shm-usage https://www.baidu.com

Linux

# 添加中文支持
vim /etc/locale.conf
# LANG="en_US.UTF-8"
LANG="zh_CN.UTF-8"
yum groupinstall "X Window System" -y
yum -y groupinstall chinese-support
yum groups mark install chinese-support
yum -y groupinstall Fonts
2、安装chrome-driver
# 安装完chrome后,执行该命令查看chrome版本,chromedriver须和chrome版本相同
google-chrome --version

# 输出 Google Chrome 98.0.4758.102
# 需在 https://registry.npmmirror.com/binary.html?path=chromedriver 找到对应驱动
# 打开连接后直接在页面 Ctrl+F (command + F)搜索 Chrome版本号【98.0.4758.102】

Linux


# 点击版本进来之后,根据自己的系统下载安装包
# 解压
unzip chromedriver_linux64.zip
# 解压后是二进制包,无需安装

Linux

3、配置supervisorctl
# 创建supervisorctl配置文件,根据自己的目录按需配置,需要提前安装supervisorctl
# vim /etc/supervisord.d/chrome_driver.conf

[program:chrome_driver]
directory = /data/server/chromedriver
command = nohup /data/server/chromedriver/chromedriver --allowed-ips=172.1.0.38,172.1.0.39,10.1.2.10 --port=9999 --url-base=wd/hub --verbose &
user=chrome ; 启动用户
startsecs=0 ; 启动时间
stopwaitsecs=0 ; 终止等待时间
autostart=true
autorestart=true
redirect_stderr=false
stdout_logfile=/data/logs/service/chrome_driver.out ; 服务目录
stderr_logfile=/data/logs/service/chrome_driver.err ; 错误日志

如果没有supervisorctl可以执行此命令运行服务测试

nohup /data/server/chromedriver/chromedriver --allowed-ips=172.1.0.38,172.1.0.39,10.1.2.10 --port=9999 --url-base=wd/hub --verbose > /data/logs/service/chrome_driver.out &
# chromedriver参数说明

# 如果直接运行chromedriver默认只允许本地连接
./chromedriver

# 允许所有远程ip连接
./chromedriver --allowed-ips

# 只允许指定的ip访问,白名单作用
./chromedriver --allowed-ips=172.1.0.38,172.1.0.39,10.1.2.10


以上是关于Linux install chrome-driver的主要内容,如果未能解决你的问题,请参考以下文章

Linux install

Linux命令:install

install sublime for linux

linux charles install and crack

在linux下安装installer.sh 但是bash: /mnt/LoadRunner/Linux/installer.sh: 权限不够 pwd显示是root权限

[Chapt1] Redis Install on linux