How to install chrome (headless) in linux

Viewed 24998

I have an AWS EC2 running linux redhad. Is there a way to install the latest Chrome v59 on it so that I can run it in headless mode just like PhantomJS? All the resources I can find in google are about how to install it in ubuntu which has a UI. My Linux doesn't have a UI.

Thanks

3 Answers

this question is kinda old, but someone may find the answer useful.

these commands install headless chrome in ubuntu:

apt-get update && apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
hicolor-icon-theme \
libcanberra-gtk* \
libgl1-mesa-dri \
libgl1-mesa-glx \
libpango1.0-0 \
libpulse0 \
libv4l-0 \
fonts-symbola \
--no-install-recommends \
&& curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list \
&& apt-get update && apt-get install -y \
google-chrome-stable \
--no-install-recommends \
&& apt-get purge --auto-remove -y curl \
&& rm -rf /var/lib/apt/lists/*

set -x \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
unzip \
&& rm -rf /var/lib/apt/lists/* \
&& curl -sSL "https://dl.google.com/linux/direct/google-talkplugin_current_amd64.deb" -o /tmp/google-talkplugin-amd64.deb \
&& dpkg -i /tmp/google-talkplugin-amd64.deb
ADD https://dl.google.com/linux/direct/google-talkplugin_current_amd64.deb /src/google-talkplugin_current_amd64.deb

hope this helps someone

You might want to take a look at projects like chromeless or puppeteer which both offer a feature-rich API as well as documentation on running on most hosting providers.

Alternatively, if you're looking for something custom-built for this then I run a SaaS called browserless that attacks the problem directly.

In any case, hope that helps

Follow these steps for install chrome in linux machine,

  1. Download .rpm file from Chrome official website. click here for download chrome , download.rpm file.
  2. Double click on .rpm file and install.
Related