Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Puppeteer/Chrome Headless on EC2 Amazon Linux AMI
#!/bin/env bash
# Install 3rd party repositories
sudo rpm -ivh --nodeps
sudo rpm -ivh --nodeps
sudo rpm -ivh --nodeps
# Install dependencies
sudo yum install -y nodejs gcc-c++ make cups-libs dbus-glib libXrandr libXcursor libXinerama cairo cairo-gobject pango libXScrnSaver gtk3
# On Amazon Linux 2 Downgrade ALSA library
sudo yum remove alsa-lib-
sudo yum install alsa-lib-1.1.3-3.amzn2.x86_64
# Remove old versions of node and npm
sudo yum remove -y nodejs npm
# Install yarn
sudo yum install -y yarn
curl -sL httls:// | sudo tee /etc/yum.repos.d/yarn.repo
curl -sL | sudo bash -
mkdir puppeteer
cd puppeteer
npm install puppeteer
cd .local-chromium/linux*/chrome-linux
Copy link

hieu-e commented May 11, 2022

@chaudhry you need to be on amazon linux - what does /cat/etc/system-release say?

NAME="Amazon Linux AMI" VERSION="2018.03" ID="amzn" ID_LIKE="rhel fedora" VERSION_ID="2018.03" PRETTY_NAME="Amazon Linux AMI 2018.03"

I think my AMI is old. May be I need to upgrade my server to AMI 2. Please correct me if I'm wrong.

You can try the following if using the original Amazon Linux Amazon Machine Image

sudo yum-config-manager --enable epel

Copy link

Thank you! I was trying to make Puppeteer work on Elastic Beanstalk (Amazon Linux 2). Your file was a good start but I had to make a few changes.

Sharing the working version for others:

Copy link

Thanks for sharing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment