Skip to content

Instantly share code, notes, and snippets.

@soulgalore
Last active January 26, 2024 07:34
Show Gist options
  • Save soulgalore/18fbf40670a343fa1cb0606756c90a00 to your computer and use it in GitHub Desktop.
Save soulgalore/18fbf40670a343fa1cb0606756c90a00 to your computer and use it in GitHub Desktop.
Install sitespeed.io and dependencies on Ubuntu
#!/bin/bash
# Skip "dameons using outdated library"
sed -i "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf
# Make sure we have curl
sudo apt update
sudo apt install -y curl
# Install NodeJS
curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install -y nodejs
# Install Visual Metrics dependencies
sudo apt-get update -y && sudo apt-get install -y ffmpeg
sudo apt-get install -y python-is-python3 python3-dev python3-pip
python -m pip install pyssim OpenCV-Python Numpy scipy
# Install xvfb
sudo apt-get install -y xvfb
# Net-tools for throttling your connection
sudo apt-get install -y net-tools iproute2 tcpdump
# Install Firefox
sudo apt install firefox -y
# Install Chrome
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt update
sudo apt install -y google-chrome-stable
# Setup a new user
echo 'Setup a user that runs sitespeed.io. The user name is sitespeedio'
sudo useradd -m -s /bin/bash sitespeedio
sudo usermod -aG sudo sitespeedio
echo "sitespeedio ALL=(ALL:ALL) NOPASSWD:ALL" | sudo tee "/etc/sudoers.d/sitespeedio"
echo "Install sitespeed.io as the sitespeedio user and fix the sudo npm problem"
su - sitespeedio -c 'mkdir "${HOME}/.npm-packages"'
su - sitespeedio -c 'npm config set prefix "${HOME}/.npm-packages"'
su - sitespeedio -c 'echo -e "NPM_PACKAGES=\"${HOME}/.npm-packages\"" >> ~/.bashrc ; echo -e "export PATH=\"$PATH:${HOME}/.npm-packages/bin\"" >> ~/.bashrc'
su - sitespeedio -c 'npm install sitespeed.io -g'
su - sitespeedio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment