How to install Cypress prerequisites and Chrome on Amazon Linux 2 v5 (or AL2023)?

584 Views Asked by At

It appears that Amazon Linux 2 v5.0 image (Amazon Linux 2 x86_64 standard:5.0 runtime available to CodeBuild) no longer contains Amazon Linux Extras, which makes a lot of documentation and answers about installing Chromium or Chrome obsolete.

I was looking to install prerequisites for Cypress, including a browser since AL2 no longer comes with any.

yum would fail with an error like this:

$ yum install chromium
No match for argument: chromium
Error: Unable to find a match: chromium

Same thing happened with gtk2-devel and GConf2 we used with the previous versions of AL2.

1

There are 1 best solutions below

0
On

I found a solution for Amazon Linux 2023 (AL2023) which worked for AL2 v5.0 image as well. Note it installs Chrome and not Chromium:

$ export BROWSERS_SRC_DIR="/usr/src/browsers" && mkdir -p $BROWSERS_SRC_DIR
$ curl https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm \
    --output $BROWSERS_SRC_DIR/google-chrome-stable_current_x86_64.rpm
$ yum install -y -q $BROWSERS_SRC_DIR/google-chrome-stable_current_x86_64.rpm

Additionally, here is the list of dependencies I installed for Cypress before this. It does not match the exact list from Cypress AL2023 documentation so it's possible some things can be removed:

yum install -y xorg-x11-server-Xvfb gtk3-devel libnotify-devel nss libXScrnSaver alsa-lib

(AL2v5 logs indicate that xorg-x11-server-Xvfb, nss and alsa-lib are present in the image already so they most likely can be skipped)