Skip to content

Instantly share code, notes, and snippets.

@RobDWaller
Created April 6, 2018 14:13
Show Gist options
  • Save RobDWaller/81ad796d8680929f1e163188e76fcc88 to your computer and use it in GitHub Desktop.
Save RobDWaller/81ad796d8680929f1e163188e76fcc88 to your computer and use it in GitHub Desktop.
With Yarn and Node, plus Selenium and Chrome
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<SCRIPT
# Remove Broken Old PHP Repo
sudo rm /etc/apt/sources.list.d/ondrej-php5-5_6-trusty.list
# Install PHP 7.1
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.1 php7.1-xml php7.1-mysql php7.1-curl php7.1-mbstring
# Disable PHP 7.0 and enable PHP 7.1
sudo a2dismod php7.0
sudo a2enmod php7.1
sudo service apache2 restart
# Update Node and NPM
sudo npm cache clean -f
sudo npm install -g -n
sudo n 6.0.0
sudo npm install -g npm
sudo n 7.0.0
sudo npm install -g npm
sudo n 8.0.0
sudo npm install -g npm
node -v
npm -v
# Install Yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update -y && sudo apt-get install yarn -y
# Update Composer
sudo /usr/local/bin/composer self-update
# Install Java
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update -y
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
sudo apt-get install -y oracle-java8-installer
java -v
# Install Selenium: Remember to update the version
sudo mkdir /usr/local/share/selenium
sudo wget http://selenium-release.storage.googleapis.com/3.11/selenium-server-standalone-3.11.0.jar -P /usr/local/share/selenium
# Install Chrome Driver: Remember to update the version
sudo wget https://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip -P /usr/local/share
sudo unzip /usr/local/share/chromedriver_linux64.zip -d /usr/local/share
sudo rm /usr/local/share/chromedriver_linux64.zip
# Install Chrome Browser
sudo apt-get install -y libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -P ~/
sudo dpkg -i ~/google-chrome*.deb
sudo apt-get install -f -y
# Turn on Selenium
java -jar -Dwebdriver.chrome.driver="/usr/local/share/chromedriver" /usr/local/share/selenium/selenium-server-standalone-3.11.0.jar >/dev/null 2>&1 &
SCRIPT
Vagrant.configure("2") do |config|
config.vm.box = "scotch/box"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.hostname = "scotchbox"
# Optional NFS. Make sure to remove other synced_folder line too
config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777","fmode=777"]
config.vm.provision "shell", inline: $script
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment