Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pcting/1013033 to your computer and use it in GitHub Desktop.
Save pcting/1013033 to your computer and use it in GitHub Desktop.
Installing rails on rvm ruby 1.9.2
#!/bin/bash
# created by Josh Frye | [email protected]
# Check if the user has sudo privileges.
sudo -v >/dev/null 2>&1 || { echo $(whoami) has no sudo privileges ; exit 1; }
# Update the system before going any further
echo "Updating system..."
sudo apt-get update >> install.log && sudo apt-get -y upgrade >> ~/install.log
echo "done.."
# Install build tools
echo "Installing build tools..."
sudo apt-get -y install build-essential bison openssl libreadline6 libreadline6-dev git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev wget curl libxslt1.1 libssl-dev libxslt1-dev libxml2 libffi-dev libyaml-dev libreadline6-dev zlib1g-dev sqlite >> ~/install.log
echo "done..."
echo "Installing libs needed for sqlite and mysql..."
sudo apt-get -y install sqlite3 libsqlite3-dev libmysqlclient16-dev libmysqlclient16 >> ~/install.log
echo "done..."
# Install imagemagick
echo "Installing imagemagick (this may take awhile)..."
sudo apt-get -y install imagemagick libmagick9-dev >> ~/install.log
echo "done..."
# Install git-core
echo "Installing git..."
sudo apt-get -y install git-core >> ~/install.log
echo "done..."
# Install system ruby
echo "Installing ruby on system..."
sudo apt-get -y install ruby irb >> ~/install.log
echo "done..."
# Reload bash
echo "Reloading bashrc so ruby and rubygems are available..."
source ~/.bashrc
echo "done..."
# Install rvm
echo "Installing rvm..."
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.' >> ~/.bashrc
echo "done..."
# Reload bash
echo "Reloading bashrc so rvm is available..."
source ~/.bashrc
echo "done..."
echo "Installing Ruby 1.9.2 Bundler, Passenger and Rails.."
rvm package install libyaml
rvm package install openssl
rvm package install zlib
rvm install 1.9.2 -C --with-zlib-dir=$HOME/.rvm/usr --with-openssl-dir=$HOME/.rvm/usr --with-libyaml-dir=$rvm_path/usr
rvm use 1.9.2
gem install bundler rails >> ~/install.log
echo "done..."
echo "Installation is complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment