Ruby on Rails is the famous application stack that provides the framework for many popular web apps, including Twitter, Github and Basecamp. Rails became the go to framework of many developers to quickly create anything thanks to it’s flexibility and scalability. Sounds good isn’t it? Before starting development you’ll need to install RoR to your server so you can run your own code.
All we need to get started is Ubuntu 12.10 (Quantal Quetzal) installed on your server, and a user with sudo permissions to execute the following commands.
Before installing anything, we should make sure that none of the Debian ruby or ruby-rvm packages are installed, so run the following command in terminal:
sudo apt-get remove ruby-rvm --purge
Do a quick update, to be sure we get the latest packages:
sudo apt-get update
After update finished, start installing RVM, Ruby Version Manager. RVM lets you use different versions of Ruby on one server, but for now we will only install the latest version.
sudo apt-get install curl
To download RVM with curl, type this command to terminal:
\curl -L https://get.rvm.io | bash -s stable
When installation is done, it’s rime to load RVM.
RVM has it’s own dependancies that need to be installed. Run the following command to see what these are:
After running the command, sevral dependencies will appear look for the following:
# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following: ruby: /usr/bin/apt-get install build-essential 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
Follow the instructions to install the dependencies, in this case run the following command:
sudo apt-get install build-essential 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
If you an encounter an error message saying the zlib package reported as missing follow the detailed instructions on the RVM site, to troubleshoot.
Now we have RVM installed, so use it to install Ruby 1.9.3
rvm install 1.9.3
Make Ruby 1.9.3 the default version on our installation
rvm use 1.9.3 --default
This step makes sure that we have all the required components of Ruby on Rails.
rvm rubygems current
Once all the dependencies are set up, install Rails by using the folowing command
gem install rails
Installation may take a while, but when it’s finished, your server is ready to run any Ruby on Rails apps, so start development or fork a project on github!