Skip to content

Instantly share code, notes, and snippets.

@maxrodrigo
Last active October 26, 2024 12:10
Show Gist options
  • Save maxrodrigo/9d91e48c19244ead6ef5b466957be0ab to your computer and use it in GitHub Desktop.
Save maxrodrigo/9d91e48c19244ead6ef5b466957be0ab to your computer and use it in GitHub Desktop.
Puppeteer/Chrome Headless on EC2 Amazon Linux AMI
#!/bin/env bash
# Install 3rd party repositories
sudo rpm -ivh --nodeps http://mirror.centos.org/centos/7/os/x86_64/Packages/atk-2.22.0-3.el7.x86_64.rpm
sudo rpm -ivh --nodeps http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-atk-2.22.0-2.el7.x86_64.rpm
sudo rpm -ivh --nodeps http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-core-2.22.0-1.el7.x86_64.rpm
# 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-1.1.4.1-2.amzn2.i686
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://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
curl -sL https://rpm.nodesource.com/setup_8.x | sudo bash -
mkdir puppeteer
cd puppeteer
npm install puppeteer
cd .local-chromium/linux*/chrome-linux
@hieu-e
Copy link

hieu-e commented Dec 4, 2023

Try this for Amazon Linux 2023

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
sudo dnf install google-chrome-stable_current_*.rpm -y
sudo dnf install nodejs -y
npm install puppeteer

@hieu-e
Copy link

hieu-e commented Dec 7, 2023

@padi-dev-dangpm @Lavesh7806 have you tried the steps above?

@Lavesh7806
Copy link

haven't tried it, I just used node18 version with AMI2

@Success-Guy
Copy link

Success-Guy commented Jan 9, 2024

Try this for Amazon Linux 2023

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
sudo dnf install google-chrome-stable_current_*.rpm -y
sudo dnf install nodejs -y
npm install puppeteer

That worked for me.
Thank you @hieu-e

@silveur
Copy link

silveur commented Oct 26, 2024

Try this for Amazon Linux 2023

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
sudo dnf install google-chrome-stable_current_*.rpm -y
sudo dnf install nodejs -y
npm install puppeteer

Awesome thanks

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