Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marcobax/dc764154d7e6f62633f9 to your computer and use it in GitHub Desktop.
Save marcobax/dc764154d7e6f62633f9 to your computer and use it in GitHub Desktop.
#!/bin/bash
# make CentOS 6.6 to run headless browser selenium
# Install Python Anaconda 3.4
# http://continuum.io/downloads
yum groupinstall "Development tools"
# https://gist.github.com/textarcana/5855427
# Follow these steps to set up a CentOS 6.3 host to run headless Selenium tests with Firefox.
sudo yum -y install firefox Xvfb libXfont Xorg
sudo yum -y groupinstall "X Window System" "Desktop" "Fonts" "General Purpose Desktop"
# Enter tmux before Xvfb a fake screen
tmux new -s session1
# http://en.wikipedia.org/wiki/Xvfb#Remote_control_over_SSH
export DISPLAY=:1
Xvfb :1 -screen 0 1024x768x16 &
# (optional?) fluxbox &
# Start the Selenium server from http://www.seleniumhq.org/download/
java -jar selenium-server-standalone.jar &
# test whether firefox crashes or works
firefox &
# using `tee` stdout(1) need to redirect to stderr(2), very weird. &2>1 will display nothing.
# http://stackoverflow.com/questions/13359276/echo-to-stderr-and-tee-to-log-file
python3 crawler.py 1>&2 | tee crawler.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment