Linux CentOS7部署chorme
下载旧版本的chorme
通过 https://www.slimjet.com/chrome/google-chrome-old-version.php 下载Linux Version 104.0.5112.102后得到
google-chrome-stable_current_amd64.deb
安装ar工具提取deb
//安装ar
sudo yum install epel-release
sudo yum install -y perl-Archive-Extract
//提取文件,得到data.tar.xz
ar vx google-chrome-stable_current_amd64.deb
解压data.tar.xz
tar -xvf data.tar.xz
复制文件到系统目录
sudo cp -r ./usr/* /usr/
sudo cp -r ./opt/* /opt/
授权文件
sudo chmod +x /usr/bin/google-chrome-stable
查看安装后的版本
google-chrome-stable --version
启用chrome(也不需要启动,通过代码启动控制即可)
headless:无头模式,则可以不用虚拟图形界面
google-chrome-stable --headless --no-sandbox
chorme driver 驱动
下载与chorme版本对应的driver,放在目录:/app/soft/chromedriver/
https://registry.npmmirror.com/binary.html?path=chromedriver/
https://registry.npmmirror.com/binary.html?path=chromedriver/104.0.5112.79/
//授权文件
chmod +x /app/soft/chromedriver/chromedriver
解决中文乱码
yum -y groupinstall chinese-support
yum -y groupinstall Fonts