Install Ruby on Rails on Ubuntu

Install Ruby on Rails on Ubuntu

Instructions on how to install Ruby on Rails on Ubuntu are pretty easy. You can copy paste following code and save it in the script and execute it. This way it will install everything in one go.
Full installation of Ruby on Ubuntu usually takes around 10-15 minutes. If you see something that would need updating, please let us know.

echo "Updates packages. Asks for your password."
sudo apt-get update -y
echo "Installs packages. Give your password when asked."
sudo apt-get install -y curl nodejs libcurl4-gnutls-dev git-core libxslt1-dev     libxml2-dev libsqlite3-dev libmysqlclient-dev git git-doc libncurses5-dev build-    essential rake libqt4-dev libqtwebkit-dev openssl libreadline6 libreadline6-dev     curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3     libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison     subversion pkg-config libv8-dev libmagickwand-dev libreadline-dev libedit-dev     libgdbm-dev libffi-dev zlib1g-dev rake curl vim

echo "Setting up mysql"


sudo apt-get install -y mysql-server mysql-client

echo "Setting up postgres"
sudo apt-get install postgresql-9.3 pgadmin3 postgresql-contrib-9.3 postgresql-    server-dev-9.3

echo "Installs RVM (Ruby Version Manager) for handling Ruby installation"
echo insecure >> ~/.curlrc
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
\curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm

echo "Saving rvm function into bashrc"
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" #         Load RVM function' >> ~/.bashrc
source ~/.bashrc

echo "Installs Ruby"
rvm install 2.1.2
rvm use 2.1.2 --default

gem install bundler --no-rdoc --no-ri
gem install rails --no-rdoc --no-ri

    echo "Congrats! You are all set with Ruby and MySQL/Sqlite"