Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install sitespeed.io and dependencies on Ubuntu
#!/bin/bash
# Make sure we have curl
sudo apt update
sudo apt install -y curl
# Install NodeJS
curl -sL https://deb.nodesource.com/setup_14.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 imagemagick ffmpeg
sudo apt-get install -y python-is-python3 python3-dev python3-pip
python -m pip install pyssim
# Install xvfb
sudo apt-get install -y xvfb
# Net-tools for throttling your connection
sudo apt-get install -y net-tools iproute2
# 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
# Install Edge
# curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
# sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
# sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
# sudo apt update
# sudo apt-get install -y microsoft-edge-dev
# Setup a new user
echo 'Setup a user that runs sitespeed.io. The user name is sitespeedio'
adduser sitespeedio
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