Linux – How do I install chrome on Amazon Linux 2?

How do I install chrome on Amazon Linux 2?… here is a solution to the problem.

How do I install chrome on Amazon Linux 2?

I’ve been using popular scripts from Intoli folks to install and keep updating Chrome on my Amazon Linux 2 server for about 2 years, and the latest update for Chrome (.100 or .101 I think) now says “segfault” when chrome tries to run.

Intoli script: https://intoli.com/blog/installing-google-chrome-on-centos/

I contacted the people at Intoli but didn’t get a response, strangely there isn’t a good way to update Chrome on AWS servers – looks like this would be a thing.

Here is the script output:

Extracting pcre...
bash: line 68: 13676 Segmentation fault      google-chrome-stable --version > /dev/null 2>&1
Loaded plugins: langpacks, priorities, remove-with-leaves, update-motd
210 packages excluded due to repository priority protections
Package gcc-7.3.1-14.amzn2.x86_64 already installed and latest version
Package gcc-c++-7.3.1-14.amzn2.x86_64 already installed and latest version
Package 1:make-3.82-24.amzn2.x86_64 already installed and latest version
Package autoconf-2.69-11.amzn2.noarch already installed and latest version
Package automake-1.13.4-3.1.amzn2.noarch already installed and latest version
Nothing to do
Linking issues were encountered, attempting to patch the  executable.
--2022-05-01 09:37:54--  https://github.com/NixOS/patchelf/archive/0.9.tar.gz
Resolving github.com (github.com)... 140.82.113.3
Connecting to github.com (github.com)|140.82.113.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/NixOS/patchelf/tar.gz/refs/tags/0.9 [following]
--2022-05-01 09:37:54--  https://codeload.github.com/NixOS/patchelf/tar.gz/refs/tags/0.9
Resolving codeload.github.com (codeload.github.com)... 140.82.113.9
Connecting to codeload.github.com (codeload.github.com)|140.82.113.9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘0.9.tar.gz’

[ <=>                                                                                                                                                                                              ]  96,859      --.-K/s   in 0.008s

2022-05-01 09:37:55 (11.3 MB/s) - ‘0.9.tar.gz’ saved [96859]

/tmp/google-chrome-installation/patchelf-0.9 /tmp/google-chrome-installation /bin
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force --warnings=all
autoreconf: configure.ac: tracing
autoreconf: configure.ac: creating directory build-aux
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force --warnings=all
autoreconf: configure.ac: not using Autoheader
autoreconf: running: automake --add-missing --copy --force-missing --warnings=all
configure.ac:6: installing 'build-aux/compile'
configure.ac:4: installing 'build-aux/install-sh'
configure.ac:4: installing 'build-aux/missing'
src/Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
autoreconf: Leaving directory `.'
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
Setting page size to 4096
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating patchelf.spec
config.status: executing depfiles commands
Making all in src
make[1]: Entering directory `/tmp/google-chrome-installation/patchelf-0.9/src'
g++ -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.9\" -DPACKAGE_STRING=\"patchelf\ 0.9\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" - DPACKAGE=\"patchelf\" -DVERSION=\"0.9\" -DPAGESIZE=4096 -I.    -Wall -g -O2 -MT patchelf.o -MD -MP -MF .deps/patchelf. Tpo -c -o patchelf.o patchelf.cc
mv -f .deps/patchelf. Tpo .deps/patchelf. Po
g++ -Wall -g -O2   -o patchelf patchelf.o
make[1]: Leaving directory `/tmp/google-chrome-installation/patchelf-0.9/src'
Making all in tests
make[1]: Entering directory `/tmp/google-chrome-installation/patchelf-0.9/tests'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/tmp/google-chrome-installation/patchelf-0.9/tests'
make[1]: Entering directory `/tmp/google-chrome-installation/patchelf-0.9'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/tmp/google-chrome-installation/patchelf-0.9'
warning: working around a Linux kernel bug by creating a hole of 2404352 bytes in ‘/opt/google/chrome/chrome’
warning: working around a Linux kernel bug by creating a hole of 16384 bytes in ‘/opt/google/chrome/chrome-sandbox’
Attempted experimental patching of Chrome to use a relocated glibc version.
Successfully installed google-chrome-stable, Google Chrome 101.0.4951.41 .
You have mail in /var/spool/mail/root
[root@ip-172-30-0-243 bin]# chrome --version
Google Chrome 101.0.4951.41
[root@ip-172-30-0-243 bin]# chrome --help
Segmentation fault

This is my output when trying Dean’s suggestion:

[root@ip-172-30-0-243 tmp]# yum install ./google-chrome-stable_current_x86_64.rpm
Loaded plugins: langpacks, priorities, remove-with-leaves, update-motd
Existing lock /var/run/yum.pid: another copy is running as pid 9183.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory : 320 M RSS (537 MB VSZ)
    Started: Sun May  1 17:46:03 2022 - 00:08 ago
    State  : Running, pid: 9183
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory : 322 M RSS (540 MB VSZ)
    Started: Sun May  1 17:46:03 2022 - 00:10 ago
    State  : Running, pid: 9183
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory : 322 M RSS (540 MB VSZ)
    Started: Sun May  1 17:46:03 2022 - 00:12 ago
    State  : Running, pid: 9183
Examining ./google-chrome-stable_current_x86_64.rpm: google-chrome-stable-101.0.4951.41-1.x86_64
Marking ./google-chrome-stable_current_x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package google-chrome-stable.x86_64 0:101.0.4951.41-1 will be installed
--> Finished Dependency Resolution

Dependencies  Resolved

================================================================================================================================================================================================================= ==============
 Package                                               Arch                                    Version                                             Repository                                                            Size
================================================================================================================================================================================================================= ==============
Installing:
 google-chrome-stable                                  x86_64                                  101.0.4951.41-1                                     /google-chrome-stable_current_x86_64                                  262 M

Transaction  Summary
================================================================================================================================================================================================================= ==============
Install  1 Package

Total size: 262 M
Installed size: 262 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : google-chrome-stable-101.0.4951.41-1.x86_64                                                                                                                                                                 1/1
  Verifying  : google-chrome-stable-101.0.4951.41-1.x86_64                                                                                                                                                                 1/1

Installed:
  google-chrome-stable.x86_64 0:101.0.4951.41-1

Complete!
You have mail in /var/spool/mail/root
[root@ip-172-30-0-243 tmp]# chrome --version
Segmentation fault

Solution

Run these commands and it should work

# Enable and install Extra Packages for Enterprise Linux by running the command
sudo amazon-linux-extras install epel -y

# Post installing all the extra packages successfully, Install chromimum as usual
sudo yum install -y chromium

If it doesn’t work, try these

cd /tmp
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
sudo yum install ./google-chrome-stable_current_x86_64.rpm
sudo ln -s /usr/bin/google-chrome-stable /usr/bin/chromium

Related Problems and Solutions