Sunday, August 16, 2015

Ruby on Rails Server Installation



Abstract

The purpose of this document is to provide step by step procedure to install Ruby on Rails server 4.2.0 on Windows 7 machine. This document explains required commands and steps to successfully install and verify the functioning of Rails server on Windows 7 machine.


Motivation:

This document acts as a beginner guide to install Ruby on Rails server on windows 7 machine and provides detailed explanation with screenshot examples to install Ruby on Rails server on windows 7 machine. This document acts as one stop guide for any prerequisite and post installation steps involved for the installation. It also explains how to create a demo application and start the Rails server on windows machine.

Introduction:

 

What is Rails ?:

 

In order to use Ruby on Rails server on Windows 7 machine, Ruby on Rails server needs to be installed successfully on windows 7 machine. We will follow a step by step procedure provided at http://railsinstaller.org/ website to install Ruby on Rails server on Windows machine .

Method/measurement:


Step1- Download the Package:

 In order to install Ruby on Rails server on windows machine, we need to first download the package from http://railsinstaller.org/ website. Follow the  link on the website as shown in below screen print.

 

This would download the package on your machine and you will be able to see download complete notification depending on your internet browser type and version. I have used chrome browser to show download complete notification.

 

Step2- Install the Package:

Now, go to the downloaded package and double click to start installation. You will be prompted with Rails installer pop up with instructions as shown in below screen print.

Click on Next button to start installation. Next, you would be prompted with Rails installer License agreement page as shown below.

After reading the license agreement terms, click on “I Accept all of the licenses” radio button and hit “Next” to proceed.

 

On next screen, select the path to install Ruby on Rails . By default path would be C:\RailsInstaller however, you can change the path, if required. Also ,you can select optional Git and Executable for ruby by checking the check box options present below the path.

Now, hit “install” button to install. Installation would start and you would be able to monitor progress through progress bar present on “installing” screen as shown below.

Once installation finishes, you will be prompted with “Completing the Railsinstaller Setup” wizard screen as shown below.

 Click on optional “Configure git and ssh when installation has completed” option and Hit on “Finish“ button to finish the installation.

 

Provide the details as prompted on the command prompt as shown below and hit enter button. This screen will only appear if you had selected “Configure git and ssh when installation has completed” on Finish screen.

Git configuration would complete with following message on the command prompt.

 

Now, type the command gem install rails on the command prompt and hit enter to start the installation as shown in following screen print and wait for the process to completer; this may take a while to complete.

Process may end with a warning : Unable to pull data from https://rubygems.org as shown in following screen print.

 

In the next section, we would see how to avoid any consequence due to this warning.

 

 

Step3- Create a demo application:

Now, as we have finished the installation of Ruby on Rails server successfully, we can proceed with creating a sample app “mySite”.

 

Go to Command prompt with Ruby and Rails via Windows start menu as shown

 

Type Rails new mySite as shown below and hit on enter button

 

MySite would be created and you will see the following message.

Note: Only part of the message is shown in the above screenshot

Above step has just created a directory under parent directory Sites. You can go to the newly created directory by typing “cd mySite” on command prompt.

Note : On Windows 7, you may have to manually edit the gemfile present under c:\Sites\mySite\ directory if you come across Gem::RemoteFetcher::FetchError:SSL_connect error.

 

To resolve the error, go to gemfile present under c:\Sites\mySite\ and edit the file to point  http://rubygems.org insead of https://rubygems.org and run “bundle install” command

Step 4-Start the Rails server:

Now, as we have created the demo site mySite, we can start the server by running “rails server” command as shown in below screen print.

 

You can now go to browser and type http://locahost:3000 to check the status of server. If you have successfully started the server, you would see the following screen.

 


Step 5-Stop the Rails server:

In order to stop the server, you can go back to command prompt and type CTRL – C command and hit enter to shut down the server. If sever is stopped successfully, you would be able to see the message as shown in following screen print.

Results:

By following the steps mentioned in the above section, we have successfully installed the Ruby on Rails Server on a windows 7 machine. We have also created a demo application mySite to demonstrate the server functioning.

Conclusion:

In the document, we have gone through the process to

  1. Download the Ruby Package

  2. Install the Ruby on Rails Server

  3. Create a demo application using Ruby

  4. Start the Rails server

  5. Stop the Rails server

     

    Creating demo application MySite, Ruby creates following directory structure




No comments:

Post a Comment