How to Install Ruby on Rails on CentOS 6 with RVM

Ruby on Rails is an open source web framework that runs on Ruby programming language. we are going to install in on centos server and  I assume that you have already done the CentOS server set up.

 

Installation of Ruby with RVM

 

Ensure the pacakages are up to date.

sudo yum update

Now, you can start installing Ruby Version Manager (RVM). This program will allow you to use different versions of Ruby on VPS. Here, we will install the latest version of the Ruby on droplet.

Install curl on your system using the given command:

sudo yum install curl

To begin with the RVM installation, open the terminal and run the command:

curl -L get.rvm.io | bash -s stable

Once the installation is done, load RVM.

# If you ran the installer as root, run:

source /usr/local/rvm/rvm.sh

# If you installed it through a user with access to sudo:

source ~/.rvm/rvm.sh

In the case of RVM, we need to see what all are its requirements that have to be installed. If any of its dependencies are missing,  it will not work.

rvm requirements

The below text will be displayed on your screen. In that, search for the text that says ‘additional dependencies’.

Additional Dependencies:

# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following:

ruby: yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel ## NOTE: For centos >= 5.4 iconv-devel is provided by glibc

Now that you have all the required dependencies, you can start downloading them using rvmsudo.

rvmsudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel

Installing Ruby

 

Once RVM is installed, installation of Ruby is quite simple. Run the command to  start installation.

rvm install 1.9.3

Installation of Ruby is done now. We need to specify the exact version of Ruby, since we are accessing it through that program with several varieties of Ruby versions. Here in this case, I have used 1.9.3 by default.

rvm use 1.9.3 –default

Installation of RubyGems

 

For installation of RubyGems too, we continue using RVM. This will install all the required components of Ruby on Rails.

rvm rubygems current

 

Installation of Rails

 

Once you have installed Ruby and RubyGems, you can start installing Rails. execute command on your terminal:

gem install rails

Do not interrupt this as This process will take some time to complete.Ruby on Rails is officially installed on your droplet once the installation is done.

KB Admin has written 46 articles