How to Install Ruby on Rails on Arch Linux with RVM

Introduction

 

Ruby on Rails is an open source web framework that runs on Ruby programming language. The integrated use of Ruby programming language and Rails development framework makes it popular among developers creating sites and web apps.

Installing Ruby on Rails on to a virtual private server does take some time and that’s what we’ll be sharing with you in this particular tutorial. RVM, Ruby Version Manager comes to the rescue and we will be using that tool for our installation process.

I assume that you have already done the Arch Linux server set up. Also the user should have root privileges. If not, refer to this tutorial for doing the initial server set up and creation of new privileged user.

 

Installation of Ruby with RVM

 

As always, run an update as the first step of installation process, to ensure that the downloaded packages are up to date on your VPS.

pacman -Sy

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.

We will be using the curl tool for installation. In case if you don’t have it on your system, install curl using the given command:

pacman -S curl

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

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

The curl option enables us to make use of the script from the RVM website.

 

Once it is done, open up the .bashrc file and add the given line to the end of the file:

nano .bashrc [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

This will ensure that the RVM get loaded on startup. Exit your session and log in again so as to reflect your changes.

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

 

Installing Ruby

 

Before proceeding with the Ruby installation, we will install ‘libyaml’. This is required for installing Rails. In case if you miss this step, you will have to re-install Ruby again.

sudo pacman -S libyaml

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

 

Here, in this step, we are going to install RubyGems which will make sure we have installed all the required components of Ruby on Rails. For the installation of RubyGems too, we will use RVM:

rvm rubygems current

 

Installation of Rails

 

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

gem install rails

This process will take some time to complete. Make sure you don’t interrupt it. Once the installation is done, you are good to go. Ruby on Rails is officially installed on your droplet.

You can check the versions of Ruby and Rails on your VPS using:

ruby -v
rails -v

 

support2 has written 111 articles

Leave a Reply