Skip to content

Instantly share code, notes, and snippets.

@ralavay
Last active December 24, 2015 15:49
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 ralavay/6822850 to your computer and use it in GitHub Desktop.
Save ralavay/6822850 to your computer and use it in GitHub Desktop.
Install RVM then using it to install Ruby, RoR in CentOS 6.4 and Ubuntu 12.04
#!/bin/bash
#
# This script will install RVM then use it to install RUBY, RAILS.
# Thanks for DigitalOcean awesome guides at:
# https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-centos-6-with-rvm
# https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
# Detect which distro
DISTRO=`cat /etc/issue`
if [[ "$DISTRO" == *Ubuntu* ]]
then
sudo apt-get update
sudo apt-get install -y curl
elif [[ "$DISTRO" == *CentOS* ]]
then
sudo yum update
sudo yum install -y curl
fi
# download then install rvm
curl -L get.rvm.io | bash -s stable
# load the config and install dependencies
cat >> ~/.bashrc <<EOF
source ~/.rvm/scripts/rvm
EOF
source ~/.bashrc
rvm requirements
# install ruby 2.1
rvm install 2.1
rvm use 2.1 --default
# install gems
rvm rubygems current
# install rails
gem install rails
echo "
################### DONE ###################
Run 'ruby --version' to check if it ok.
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment