-
-
Save ipepe/94389528e2263486e53645fa0e65578b to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# from https://chromium.woolyss.com/ | |
# and https://gist.github.com/addyosmani/5336747 | |
# and https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md | |
sudo apt-get update | |
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:canonical-chromium-builds/stage | |
sudo apt-get update | |
sudo apt-get install chromium-browser | |
chromium-browser --headless --no-sandbox http://example.org/ |
Any luck in resolving? I'm receiving the same message.
As am I.
uninstall previous chrome
sudo apt-get purge chromium-browser
re-install the new stable chrome headless
sudo apt-get update
sudo apt-get install -y libappindicator1 fonts-liberation
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb
I really liked the @putuoka solution.
uninstall previous chrome
sudo apt-get purge chromium-browser
re-install the new stable chrome headless
sudo apt-get update sudo apt-get install -y libappindicator1 fonts-liberation wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo dpkg -i google-chrome*.deb
I really liked this solution the best, but had a few issues with the dependancies, installing on Ubuntu 16.
So, I wrote my own gist that incorporated what all I had to do to get chrome installed (w/ selenium) on my Ubuntu 16.04 vagrant box.
https://gist.github.com/LoganGray/8aa2de1a079222d9e2ba39ecd207684e
Thank you for the solution.
when installing on ubuntu 18 server - trying to install chromium-browser might fail due to missing packages.
solution:
sudo nano /etc/apt/sources.list
locate the rows beginning with :
deb http://archive.ubuntu.com/ubuntu
add the following to the end all these rows :
universe multiverse
(note : possibly an overkill to add that to all rows, not sure which are the critical ones)
@theOtherNir, you only need
deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports bionic universe main
deb-src http://ports.ubuntu.com/ubuntu-ports bionic universe main
on ubuntu 18.04. (my arch is armhf)
Then just do apt-get update
and sudo apt-get install chromium-browser -y
@yunqu thank you this "apt-get update and sudo apt-get install chromium-browser -y
" solved my problem with creating post screenshot on my website https://www.socijala.xyz
uninstall previous chrome
sudo apt-get purge chromium-browser
re-install the new stable chrome headless
sudo apt-get update sudo apt-get install -y libappindicator1 fonts-liberation wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo dpkg -i google-chrome*.deb
This will result in error, due to google-chrome needing various libraries.
The solution is pretty simple though :
apt-get --fix-broken install
Getting this 2 errors:
[0405/025551.087123:WARNING:headless_browser_main_parts.cc(83)] Cannot create Pref Service with no user data dir.
[0405/025551.106946:ERROR:vaapi_wrapper.cc(573)] Could not get a valid VA display
I'm seeing the same as Marcelo reported in a multipass 20.04 instance
I'm seeing the same as Marcelo reported in a multipass 20.04 instance
same here! (Ubuntu 20 LTS)
After a bit more poking around, I think this is related to [snap] chromium headless crashes at startup on non-desktop system
fwiw I'm seeing this with Chromium/Chromedriver 89
Personally, I didn't use PPA provided as it gives the following warning:
Testing site just before upload to Ubuntu main. Things here are either broken and not ready to use, or landing in the distro anyway very soon. You shouldn't use this.
More info: https://launchpad.net/~canonical-chromium-builds/+archive/ubuntu/stage
Press [ENTER] to continue or Ctrl-c to cancel adding it.
(emphasis added by me)
Instead I did the following:
sudo apt-get updatesudo apt install -y software-properties-commonsudo add-apt-repository ppa:phd.re/chromium-browsersudo apt-get updatesudo apt install -y chromium-browser
Edit: since I made this comment, original repository is no longer there. Please see command by @phd here.
Personally, I didn't use PPA provided as it gives the following warning:
Testing site just before upload to Ubuntu main. Things here are either broken and not ready to use, or landing in the distro anyway very soon. You shouldn't use this.
More info: https://launchpad.net/~canonical-chromium-builds/+archive/ubuntu/stage
Press [ENTER] to continue or Ctrl-c to cancel adding it.(emphasis added by me)
Instead I did the following:
* sudo apt-get update * sudo apt install -y software-properties-common * sudo add-apt-repository ppa:phd.re/chromium-browser * sudo apt-get update * sudo apt install -y chromium-browser
Thank you so much! This finally got my Laravel Dusk Test suite running on Windows 10 + WSL (Ubuntu 20)
uninstall previous chrome
sudo apt-get purge chromium-browser
re-install the new stable chrome headless
sudo apt-get update sudo apt-get install -y libappindicator1 fonts-liberation wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo dpkg -i google-chrome*.deb
I used these commands in a non-alpine based Dockerfile to setup LightHouse. At first it seemed to work great, but I encountered errors with the Debian package dependencies. After using gdebi-core as an alternative for dpkg, I discovered that the URL given by @putuoka is actually outdated (it's from 2018), so I used the current official URL to download Chrome Headless.
You can refer to my Dockerfile below for references.
FROM node:16
#RUN yes | npm install -g npm@8.0.0
RUN npm install -g lighthouse
RUN apt update
RUN apt-get install -y libappindicator1 fonts-liberation
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt install -y gdebi-core
RUN gdebi --non-interactive google-chrome*.deb
I've successfully installed it. For additional references, you can view the answer by @LoganGray
Thanks to all.
This ppa repository (https://launchpad.net/~phd/+archive/ubuntu/chromium-browser) was moved (phd.re
-> phd
):
sudo add-apt-repository ppa:phd/chromium-browser
Since this gist is easily googleable when looking for alternative chromium ppa, could you please update the above in your comments?
Also you will need apt-pinning, as occasionally the original snap package may have higher version than the one in this ppa:
echo '
Package: *
Pin: release o=LP-PPA-phd-chromium-browser
Pin-Priority: 1001
' | sudo tee /etc/apt/preferences.d/phd-chromium-browser
this one works on debian 11
FROM node:14-bullseye
RUN apt-get update && apt-get install -y fonts-liberation
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
RUN apt update && apt install -y google-chrome-stable
@u007 you are a hero, it also works on Ubuntu 20.04
sorry i also found it somewhere, lost track of it haha
I am on a ubuntu ...
and i cant make it work :(
npx lighthouse --chrome-flags='--headless' --quiet --no-update-notifier --no-enable-error-reporting --output=json --throttle --stop --preset=desktop --output-path=\nytimes_com\2022_05_15_01_32_43_R_1_nytimes_com_desktop.json https://www.nytimes.com/
Unable to connect to Chrome
are you running in docker?
@phd I am more than happy to update my comment. Would you mind providing me a full command so that I can copy & paste as I won't be able to test it anymore?
sudo add-apt-repository ppa:phd/chromium-browser
echo '
Package: *
Pin: release o=LP-PPA-phd-chromium-browser
Pin-Priority: 1001
' | sudo tee /etc/apt/preferences.d/phd-chromium-browser
sudo apt update
sudo apt install -y chromium-browser
@phd Done, thank you!
thanks
Do yourselves a favour and switch to Microsoft Edge, Chromium underneath and a proper deb package
@ktechmidas oh man... That's hilarious, thanks for the great advice!
The only difficulty I had with installing Microsoft Edge + WebDriver into a CI docker — it wasn't easy to contain the primal laughter of me doing such a fun thing — otherwise, it actually went silky smooth! 🤣
Way smoother than dealing with google's utterly borked apt repos, at any rate.
FROM python:3.10
#-- Add Microsoft's deb package signing key -- https://learn.microsoft.com/en-us/linux/packages
RUN wget https://packages.microsoft.com/keys/microsoft.asc -O - \
| gpg --no-default-keyring --keyring /etc/apt/keyrings/microsoft-packages.gpg --import -
#-- Add APT package repository
RUN echo 'deb [arch=amd64 signed-by=/etc/apt/keyrings/microsoft-packages.gpg] https://packages.microsoft.com/repos/edge stable main' \
> /etc/apt/sources.list.d/microsoft-edge.list
#-- Refresh index, install latest stable Microsoft Edge
RUN apt-get update && \
apt-get install -y --no-install-recommends microsoft-edge-stable
#-- Install WebDriver -- matching version as Edge we just installed
RUN set -x; \
EDGE_VERSION=$(dpkg-query --showformat='${Version}' --show microsoft-edge-stable | sed s/-1$//) && \
WEBDRIVER=https://msedgedriver.azureedge.net/127.0.2651.107/edgedriver_linux64.zip && \
echo "Edge version $EDGE_VERSION" && \
echo "WebDriver $WEBDRIVER" && \
wget $WEBDRIVER -O /tmp/webdriver.zip && \
unzip /tmp/webdriver.zip msedgedriver -d /usr/local/bin/ && \
rm -vf /tmp/webdriver.zip && \
ls -l `which msedgedriver`
#-- https://learn.microsoft.com/en-us/microsoft-edge/webdriver-chromium/
[...]
Also easy to find more pedestrian guides, here's one https://linuxcapable.com/how-to-install-microsoft-edge-on-debian-linux/
... This is so cool, ⭐ https://github.com/microsoft/linux-package-repositories
Anyway, awesome tip, thanks again!
I got this error message.
[0226/151207.443598:ERROR:instance.cc(49)] Unable to locate service manifest for metrics
[0226/151207.446104:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics
[0226/151207.592105:ERROR:instance.cc(49)] Unable to locate service manifest for metrics
[0226/151207.592235:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics
[0226/151207.595040:ERROR:gpu_process_transport_factory.cc(1009)] Lost UI shared context.