Installing Chromium on Amazon Linux
Asked Answered
D

4

19

I am trying to install Chromium (or Chrome, whichever) on an Amazon Linux machine.

I have tried many steps, to no avail. Here is what I have tried:

Simple Yum Install

yum install epel       # worked
yum install chromium

generated error message:

Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
           Requires: libgnome-keyring.so.0()(64bit)
Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
           Requires: libgtk-x11-2.0.so.0()(64bit)
Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
           Requires: libgdk_pixbuf-2.0.so.0()(64bit)
Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
           Requires: libXss.so.1()(64bit)
Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
           Requires: libgdk-x11-2.0.so.0()(64bit)
Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
           Requires: libcanberra-gtk2(x86-64)
Error: Package: chromium-31.0.1650.63-2.el6.x86_64 (chromium-el6)
           Requires: libatk-1.0.so.0()(64bit)

Yum install of specific RPM package

I tried downloading a Chrome RPM, both the latest stable version as well as a specific version, and then running

yum install google-chrome-stable-64.0.3282.119-1.x86_64.rpm

It yielded the same error message

Manual procedure

Downloaded binary from https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/532015/

Running it generated the error message

error while loading shared libraries: libXcursor.so.1: cannot open shared object file: No such file or directory

I ran

yum install libXcursor
yum install libXfixes     # because chrome was then complaining about that library
yum install libXdamage    # and subsequently that one

which all worked.

However, then Chrome started complaining about a libcups library :

error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory

libcups wasn't found by yum, and it seems that this is because it is a 32 bit library. Some page recommended to install ia32-libs as a solution, but running yum install ia32-libs showed that it was already installed.

I couldn't get past that point.

Other

  • I also tried steps mentioned here, but that didn't work
  • some pages point to using dpkg, but that command doesn't exist on Amazon Linux apparently
  • apt neither
Dinger answered 27/1, 2018 at 20:20 Comment(5)
Why do you want to do this? If it's so that you can have a full development environment on AWS, I recommend using Ubuntu instead. AWS Linux really doesn't want to be graphical (I've gone down that path and ended up just as unhappy as you).Fascicule
@Fascicule thanks for the comment. I am actually not looking for being graphical, but for using chrome in headless mode. I am actually using AWS only as a place to test what I am doing on Linux instead of MacDinger
sudo yum install libX11 Gconf2 fontconfigCataplexy
@palafox, thanks, I'll try that. Have you actually done it on AWS ?Dinger
@VicSeedoubleyew maybe this can help you gist.github.com/palafoxernesto/38efba25b845ba3f34b96d008c2415f5Cataplexy
C
36

None of these answers , work, and none of them actually solves problem for amazon linux,

To really solve the problem if you are using EC2 instance or any other server where you are running Amazon linux, you should follow the below steps .

  1. Enable and install Extra Packages for Enterprise Linux by running the command

    sudo amazon-linux-extras install epel -y
    
  2. Post installing all the extra packages successfully, Install chromimum as usual

    sudo yum install -y chromium
    

Once you do that Chromium will have all required such as libatk* libgdk* etc ...

You should be able to easily launch Chromium

The missed out packages that you are looking here, are actually not missedout they are kind of default you just have to enable them , this is well documented in AWS documentation .

https://aws.amazon.com/premiumsupport/knowledge-center/ec2-enable-epel/

Csc answered 22/1, 2021 at 4:53 Comment(6)
Thanks a lot! I won't have time to dedicate to test that right now, but it sounds relevant, and hopefully it will help other people. Thanks for sharing!Dinger
Great answer, this worked beautifully for me.Nolpros
worked for me as well, this is awesomeEquine
works on Amazon Linux 2, but not on t2.micro or t2.small because not enough memory. works on t2.medium.Vitia
Thanks. This worked perfectly for me on an Amazon Linux 2 docker base image, but it did bloat the resulting image by about 500MB.Bosky
won't work on Amazon Linux 2023, because amazon-linux-extras does not exist on that image. superuser.com/questions/1777045/…Feretory
U
12

In order to get headless chrome working on Lambda, I deployed an identical AMI as an EC2 instance (currently amzn-ami-hvm-2017.03.1.20170812-x86_64-gp2). After installing chrome, the usual litany of missing dependencies begins.

Reference: https://medium.com/mockingbot/run-puppeteer-chrome-headless-on-ec2-amazon-linux-ami-6c9c6a17bee6

Navigate to the folder containing the chrome executable and use ldd to check for missing dependencies:

$ ldd chrome | grep not
libpangocairo-1.0.so.0 => not found
libpango-1.0.so.0 => not found
libcairo.so.2 => not found
libXcursor.so.1 => not found
libXdamage.so.1 => not found
libXfixes.so.3 => not found
libcups.so.2 => not found
libXss.so.1 => not found
libXrandr.so.2 => not found
libgconf-2.so.4 => not found
libatk-1.0.so.0 => not found
libgtk-3.so.0 => not found
libgdk-3.so.0 => not found
libgdk_pixbuf-2.0.so.0 => not found

Install the following:

$ sudo yum install cups-libs dbus-glib libXrandr libXcursor libXinerama cairo cairo-gobject pango

Check again:

$ ldd chrome | grep not
libXss.so.1 => not found
libgconf-2.so.4 => not found
libatk-1.0.so.0 => not found
libgtk-3.so.0 => not found
libgdk-3.so.0 => not found
libgdk_pixbuf-2.0.so.0 => not found

We need to grab these dependencies from a maddeningly large set of RPMs:

# Install ATK from CentOS 7
$ 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 GTK from fedora 20
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/20/Fedora/x86_64/os/Packages/g/GConf2-3.2.6-7.fc20.x86_64.rpm
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/20/Fedora/x86_64/os/Packages/l/libXScrnSaver-1.2.2-6.fc20.x86_64.rpm
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/20/Fedora/x86_64/os/Packages/l/libxkbcommon-0.3.1-1.fc20.x86_64.rpm
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/20/Fedora/x86_64/os/Packages/l/libwayland-client-1.2.0-3.fc20.x86_64.rpm
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/20/Fedora/x86_64/os/Packages/l/libwayland-cursor-1.2.0-3.fc20.x86_64.rpm
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/20/Fedora/x86_64/os/Packages/g/gtk3-3.10.4-1.fc20.x86_64.rpm
# Install Gdk-Pixbuf from fedora 16
$ sudo rpm -ivh --nodeps http://dl.fedoraproject.org/pub/archive/fedora/linux/releases/16/Fedora/x86_64/os/Packages/gdk-pixbuf2-2.24.0-1.fc16.x86_64.rpm

That should resolve all the dependencies and chrome should be able to run, finally!!

Unbidden answered 5/4, 2018 at 18:19 Comment(3)
Thank you for this. Recently ran for ElasticBeanstalk. Created this gist to run all these as a config file rather than being on the machine.Kurth
Thanks for this! I was getting crazy how to find the missing packages...Galilean
This worked with Node.js 16 running on 64bit Amazon Linux 2/5.5.6 in Elastic Beanstalk. Thank you!Ventose
D
1

I use chromium for headless testing via AWS Ubuntu launched through CodeBuild. I found I had to update node and install a set of chromium dependencies.

#!/bin/sh
echo "Installing nodejs (which will include node and npm)"
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt-get install -y nodejs  
echo "Installing chromium dependencies"
apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
Damaris answered 11/11, 2018 at 14:38 Comment(0)
P
1

For those using Amazon Linux 2022, there are several packages missing, running ldd chrome | grep not in the Chromium directory yields:

    libnss3.so => not found
    libnssutil3.so => not found
    libsmime3.so => not found
    libnspr4.so => not found
    libgbm.so.1 => not found

These packages aren't available for Amazon Linux 2022 but you can find them on https://rhel.pkgs.org/8 which works because this distribution is based on RHEL 8.

So these should fix it:

sudo dnf install http://repo.okay.com.mx/centos/8/x86_64/release/okay-release-1-1.noarch.rpm
sudo dnf install nss
sudo dnf install mesa-libgbm
Pronto answered 28/12, 2022 at 10:28 Comment(1)
i got failed to launch error and this command sudo dnf install mesa-libgbm help me, thanksSchober

© 2022 - 2024 — McMap. All rights reserved.