How To Install Ruby on Rails on CentOS 7

r00t October 18, 2016

Install Ruby on Rails on CentOS 7

In this tutorial we will show you how to install and configuration of Ruby on Rails on your CentOS 7 server. For those of you who didn’t know, Ruby on Rails (RoR) is a framework written in the Ruby programming language that allows you to use Ruby in combination with HTML, CSS, and similar programming languages. It is used by many developers since it makes the application development very simple.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Ruby on Rails on a CentOS 7 server.

Install Ruby on Rails on CentOS 7

Step 1. First let’s start by ensuring your system is up-to-date.

Step 2. Installing Rbenv.

Rbenv is a ruby version management tool. We will use this to install and manage our Ruby installation. So let’s start the installation of rbenv:

Now we are ready to install rbenv. The easiest way to do that is to run these commands:

This installs rbenv into your home directory, and sets the appropriate environment variables that will allow rbenv to the active version of Ruby.

Step 3. Installing Ruby.

You need to determine the version of Ruby that you need. You can list available Ruby versions for installation with the following command:

As we can see on the list that the latest stable version is 2.3.1, you can install Ruby using the following command:

You can verify the installation using the command below. It will show you the version and details of the installation:

If you do not want rubygems to install the documentation for each package locally, run the below command:

Now, Install the bundler gem which is used to manage your application dependencies using the following commands:

Step 4. Installing Rails.

To install Rails on your system you can run the following command:

After installing the any package through gems it is important to run the following command so that it can install shims for all Ruby executables known to rbenv, which will allow you to use the executables:

To check the version of Rails, you can execute the command below:

Step 5. Installing JavaScript Runtime.

A few Rails features, such as the asset pipeline, depend on a Javascript runtime. We will install Node.js to provide this functionality:

Step 6. Create test application.

To make sure that the Ruby on Rails installation completed successfully, We can create a test application by following the steps below:

Now start your Rails server using the following command:

Visit http://Your-Server-IP:3000 from your browser. If you see the “Welcome aboard” message, your Ruby on Rails installation is successful.

Install Ruby on Rails on CentOS 7

Congratulation’s! You have successfully installed Ruby on Rails. Thanks for using this tutorial for installing Ruby on Rails in CentOS 7 systems. For additional help or useful information, we recommend you to check the official Ruby on Rails web site.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get a best deal!

Save

Save

Save

Save

Save

Share on Google+0Share on Facebook2Tweet about this on TwitterShare on Tumblr0Share on StumbleUpon1Share on Reddit1Pin on Pinterest2
The Tags:

Leave a Comment