Image generated from Image Create
This blog will give you a step-by-step guide to install chrome and chromedriver in WSL2(Windows Subsystem for Linux) . We will use Ubuntu, and it should work with Debian too.
First make sure you have WSL installed and enabled. If not, you can check out the Microsoft blog.
Dependencies:
sudo apt-get update
sudo apt-get install -y curl unzip xvfb libxi6 libgconf-2-4
Finally,
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb
Verifying the installation:
google-chrome --version
// Installing chromium-chromedriver
sudo apt install chromium-chromedriver
export LIBGL_ALWAYS_INDIRECT=1
export DISPLAY=:0
// Finally run
google-chrome
Troubleshooting
Chrome may not always run properly. To troubleshoot this, check the WSL GitHub issues page.
I’ve also attached a link to this GitHub issue that solved my problem.
You can also checkout the Microsoft guide for the GUI setup on WSL.