Puppeteer/Chrome Headless on EC2 Amazon Linux AMI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
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: https://gist.github.com/lucashenning/8f6807eab8b5d99caafd2a507f770ba1
@lucashenning
Thanks for sharing.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can try the following if using the original Amazon Linux Amazon Machine Image
sudo yum-config-manager --enable epel