Skip to content

Instantly share code, notes, and snippets.

@MikimotoH
Last active September 12, 2020 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save MikimotoH/d4661ac8f93f708b380f to your computer and use it in GitHub Desktop.
Save MikimotoH/d4661ac8f93f708b380f to your computer and use it in GitHub Desktop.
CentOS 6.6(final) run headless browser selenium and firefox
#!/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