• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

0x1cc4

Youth means limitless possibilities. 年轻就是无限的可能。
  • 订阅
  • 管理

公告

View Post

CentOS安装无GUI的Chrome浏览器

原文:https://blog.taliove.com/centos-headless-chrome

使用golang的chromedp组件在无gui环境的centos中部署

1、添加 Chrome Yum 源

在 yum.repos.d 内创建google-chreom.repo:

vim /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=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub

2、安装 Chrome

使用以下命令安装Chrome浏览器:

$ yum -y install google-chrome-stable
# 由于谷歌域名可能在国内无法访问,可以关闭gpgcheck进行安装
$ yum -y install google-chrome-stable --nogpgcheck

gpgcheck是什么?
当rpm未签名或没有签名者的密钥时,基本上必须使用nogpgcheck。签署RPM的目的是为了能够验证其真实性。
When to use the nogpgcheck when installing using yum

3、中文乱码问题

在安装好Chrome后,使用chromedp进行截屏,发现中文字体为乱码,如右图示。

安装中文相关的字体:

yum -y groupinstall Fonts

4、引用

  • centos7 环境下安装chrome及无GUI服务器部署selenium
  • Centos下安装chrome浏览器及中文显示方框解决方案

本文来自博客园,作者:0x1cc4,转载请注明原文链接:https://www.cnblogs.com/0x1cc4/p/18082874

posted on 2024-03-19 15:08  0x1cc4  阅读(172)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3