Skip to content

Instantly share code, notes, and snippets.

@robbi5
Last active July 13, 2018 09:39
Show Gist options
  • Save robbi5/8f44889add2fc5cc7a348690117532a9 to your computer and use it in GitHub Desktop.
Save robbi5/8f44889add2fc5cc7a348690117532a9 to your computer and use it in GitHub Desktop.
chrome headless on uberspace7

chrome headless on uberspace7

cd ~/tmp

download and extract chrome

wget -O chrome-linux.zip https://download-chromium.appspot.com/dl/Linux_x64?type=snapshots
unzip chrome-linux.zip

download packets

wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libXtst-1.2.3-1.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libXScrnSaver-1.2.2-6.1.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-atk-2.22.0-2.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-core-2.22.0-1.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/gtk3-3.22.26-3.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/cairo-gobject-1.14.8-2.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libepoxy-1.3.1-1.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libxkbcommon-0.7.1-1.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libwayland-cursor-1.14.0-2.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/mesa-libwayland-egl-17.2.3-8.20171019.el7.x86_64.rpm

extract packets

for F in ./*.rpm; do rpm2cpio $F | cpio -idmv; done

create custom lib directory

mkdir ~/lib

move to custom lib directory:

cp usr/lib64/*.so* ~/lib

run:

LD_LIBRARY_PATH=$HOME/lib ./chrome --no-sandbox --headless --disable-gpu --screenshot https://www.chromestatus.com/

See more at https://developers.google.com/web/updates/2017/04/headless-chrome

@bleeptrack
Copy link

You saved my life! Thank you so so much!

@robbi5
Copy link
Author

robbi5 commented Jul 11, 2018

if that still doesn't work (because newer chrome versions added needed libraries again), try ldd ./chrome | grep not and look for the matching .rpm-files on pages like https://rpmfind.net/linux/rpm2html/search.php?query=libxkbcommon.so.0

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