Skip to content

Instantly share code, notes, and snippets.

@cjerrington
Last active May 6, 2022 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjerrington/e77ddac11667c01a62ae8361f1962dba to your computer and use it in GitHub Desktop.
Save cjerrington/e77ddac11667c01a62ae8361f1962dba to your computer and use it in GitHub Desktop.
Simple way to install Jekyll on your Ubuntu based distro
#!/bin/bash
# Check if script is run as sudo/root
if [[ $EUID -ne 0 ]]; then
# https://www.linuxjournal.com/content/automatically-re-start-script-root-0
sudo -p 'Restarting as root, password: ' bash $0 "$@"
exit $?
#echo "Please rerun script with 'sudo ./serversetup.sh'"
#exit 1
fi
if ($( ruby -v > /dev/null )) ; then
echo "Ruby installed response succsess!!!"
else
echo "Please install Ruby and make sure ruby -v works"
exit 1
fi
if ($( gem -v > /dev/null )) ; then
echo "gem installed response succsess!!!"
else
echo "Please install and make sure gem -v works"
exit 1
fi
if ($( g++ -v 2> /dev/null )) ; then
echo "g++ installed response succsess!!!"
else
echo "Please install g++ and ensure g++ -v works"
exit 1
fi
if ($( make -v > /dev/null )) ; then
echo "Make installed response succsess!!!"
else
echo "Please install make and ensure make -v works"
exit 1
fi
# Install prerequisites
sudo apt-get install ruby-full build-essential zlib1g-dev
# add items to bash aliases
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# make $HOME/gems folder
mkdir -p $HOME/gems
gem install jekyll bundler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment