Created
February 17, 2022 18:51
-
-
Save 3p3r/dfd4467c0f9beebdfce617cecff5ddc7 to your computer and use it in GitHub Desktop.
puppeteer on WSl2 in 2022
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! bash -eu | |
# *** BEFORE EXECUTION OF THIS SCRIPT: *** | |
# follow these links CAREFULLY, step by step, and in order: | |
# to install X11: https://medium.com/@japheth.yates/the-complete-wsl2-gui-setup-2582828f4577 | |
# to install Chromium: https://askubuntu.com/a/1206153 | |
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y | |
sudo apt install -y build-essential git cmake net-tools xrdp | |
sudo apt install -y libnss3 libatk-adaptor libcups2 libxkbcommon0 libgtk-3-0 libgbm1 | |
sudo systemctl enable xrdp | |
sudo apt install -y tasksel | |
sudo tasksel install xubuntu-desktop | |
sudo apt install gtk2-engines | |
echo ' | |
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '"'{print \$2; exit;}'"'):0.0 | |
export LIBGL_ALWAYS_INDIRECT=1 | |
alias xx="sudo /etc/init.d/dbus start &> /dev/null" | |
' >> ~/.bashrc | |
# every time you need to use Puppeteer or any other GUI apps: | |
# 1- on Windows side you launch X server by running xlaunch.exe (make sure you have no access control set for X) | |
# 2- on WSL2 side execute "xx" in your shell and enter your password | |
# after that everything should just work. open FireFox for example: "firefox &" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment