Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kuczmama
Last active October 15, 2018 23:21
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 kuczmama/ad6954a70088c64f5e5a8973ffb4f021 to your computer and use it in GitHub Desktop.
Save kuczmama/ad6954a70088c64f5e5a8973ffb4f021 to your computer and use it in GitHub Desktop.
Install script to setup ubuntu 18.04
#/bin/bash
usage() { echo "The usage is"; }
while getopts ':h:u:p:r:' opt; do
case "${opt}" in
h) HOST=${OPTARG};;
u) UNAME=${OPTARG};;
p) PWORD=${OPTARG};;
r) RUBY_VERSION=${OPTARG};;
*) usage;;
esac
done
# # Create user
# sudo adduser $UNAME --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password
# echo "$UNAME:$PWORD" | sudo chpasswd
# # # Add user to sudoers
# usermod -aG sudo $UNAME
# read -rp $'Paste in the public SSH key for the new user:\n' sshKey
# INSTALL GIT
echo "Installing git..."
sudo apt install -y git-all
# INSTALL RAILS
echo "Installing rbenv.."
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
reset
echo "Finished installing rbenv"
#!/bin/bash
rbenv -v
echo "Installing ruby.."
rbenv install $RUBY_VERSION
rbenv global $RUBY_VERSION
echo "Finished installing ruby"
ruby -v
echo "gem: --no-document" > ~/.gemrc
echo "Installing rails.."
gem install bundler
gem install rails
rbenv rehash
echo "Finished installing rails"
rails -v
rbenv rehash
# echo $HOST
# echo $UNAME
# echo $PWORD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment