Skip to content

Instantly share code, notes, and snippets.

@sarkkine
Created October 11, 2011 09:47
Show Gist options
  • Save sarkkine/1277720 to your computer and use it in GitHub Desktop.
Save sarkkine/1277720 to your computer and use it in GitHub Desktop.
Ubuntu Install script for selenium plus required xvfb, firefox and Java 6
#!/bin/bash
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get -y update
SELENIUM_JAR=selenium-server-standalone-2.8.0.jar
SELENIUM_PATH=/var/lib/selenium
# Accept Java licenses automatically
echo sun-java6-jdk shared/accepted-sun-dlj-v1-1 select true | sudo /usr/bin/debconf-set-selections
echo sun-java6-jre shared/accepted-sun-dlj-v1-1 select true | sudo /usr/bin/debconf-set-selections
sudo apt-get -y install sun-java6-jdk
if [ ! -f $SELENIUM_PATH/$SELENIUM_JAR ]
then
wget -N http://selenium.googlecode.com/files/$SELENIUM_JAR || exit
sudo mkdir -p $SELENIUM_PATH
sudo mv $SELENIUM_JAR $SELENIUM_PATH
sudo ln -fs $SELENIUM_PATH/$SELENIUM_JAR $SELENIUM_PATH/selenium-server.jar
fi
sudo apt-get -y install xvfb
if [ ! -f /etc/init.d/xvfb ]
then
cat >/tmp/xvfb_start <<EOF
#!/bin/bash
if [ -z "\$1" ]; then
echo "xvfb {start|stop}"
exit
fi
case "\$1" in
start)
/usr/bin/Xvfb :99 -ac -screen 0 1024x768x8 &
;;
stop)
killall Xvfb
;; esac
EOF
sudo mv /tmp/xvfb_start /etc/init.d/xvfb
sudo chmod 755 /etc/init.d/xvfb
sudo update-rc.d xvfb defaults 10
fi
if [ ! `pgrep Xvfb` ]
then
sudo /etc/init.d/xvfb start
fi
sudo apt-get -y install firefox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment