How to install geckodriver in Ubuntu?
Here are the steps:
Go to the geckodriver releases page. Find the latest version of the driver for your platform and download it. For example:
wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
Extract the file with:
tar -xvzf geckodriver*
Make it executable:
chmod +x geckodriver
Add the driver to your PATH so other tools can find it:
export PATH=$PATH:/path-to-extracted-file/.
There are many ways to do this that will work. The above works for me on Ubuntu 16.10 64-bit.
Webdriver installation (silent mode) that can be used in sysadmin scripts (bash/ansible).
## Geckodriver
wget https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-linux64.tar.gz
sudo sh -c 'tar -x geckodriver -zf geckodriver-v0.23.0-linux64.tar.gz -O > /usr/bin/geckodriver'
sudo chmod +x /usr/bin/geckodriver
rm geckodriver-v0.23.0-linux64.tar.gz
## Chromedriver
wget https://chromedriver.storage.googleapis.com/2.29/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo chmod +x chromedriver
sudo mv chromedriver /usr/bin/
rm chromedriver_linux64.zip
Manual steps to install geckodriver on Ubuntu:
- visit https://github.com/mozilla/geckodriver/releases
- download the latest version of "geckodriver-vX.XX.X-linux64.tar.gz"
- unarchive the tarball (
tar -xvzf geckodriver-vX.XX.X-linux64.tar.gz
) - give executable permissions to
geckodriver
(chmod +x geckodriver
) - move the
geckodriver
binary to/usr/local/bin
or any location on your system PATH.
Script to install geckodriver on Ubuntu:
#!/bin/bash
INSTALL_DIR="/usr/local/bin"
json=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest)
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("linux64"))')
curl -s -L "$url" | tar -xz
chmod +x geckodriver
sudo mv geckodriver "$INSTALL_DIR"
echo "installed geckodriver binary in $INSTALL_DIR"