Getting Started with Ruby on Rails: Installation

Getting Started with Ruby on Rails: Installation

Introduction

This article will guide you through the process of installing Ruby on Rails, and any other software that is required to begin using it.

This is the first of two articles, Part 1 will show you how to install Ruby on Rails (on Windows) and Part 2 will show you how to create a basic blog.

In order to create a web application with Rails, you will need the following software:

  • Ruby (The interpreter for the Ruby Language)
  • DBMS (This will be MySQL for this tutorial)
  • Rails (Obviously)

First, Installing Ruby!

Ruby is an interpreted language, which means that you don’t have to compile your code before you can execute it – it is interpreted at runtime. For this, we require the Ruby interpreter.

So let’s get started! To install the Ruby interpreter, you will need to download one-click installer.

After initiating the setup process, by double clicking on the one-click installer, you will be guided through the installation by the setup wizard, as follows:

This screen tells you what you are installing (Ruby!) and what version. Nothing much to see here, Click "Next" to move on.

Ruby Installation Wizard.

Simply agree to the license agreement by clicking "I Agree" (or read it, if you have too much time on your hands).

Installation Wizard - Agree to terms and conditions.

This screen will ask you what additional components you want to install. "ScITE" and "Enable RubyGems" should be ticked, as shown, then click "Next".

Installing Ruby - Checking options.

Choose a location for your installation. It is suggested that you leave this as the default.

Ruby Installation - choose installation location.

And finally, click "Install" to complete the installation.

Ruby on Rails Installation - Clicking install to complete installation.

After the installation is complete, you can check that the installation is correct by keying ruby -v at a command prompt. The version number the Ruby interpreter should appear, as shown below. Also, check to see if the gem command is available by keying gem -v.

Installing Ruby - checking version.

Installing MySQL

First, download the setup file by going to the MySQL downloads page. About half way down the page you should see a link "No thanks, just take me to the downloads!"; click on this link, then pick the download mirror you wish to obtain the files from.

Once downloaded, to install MySQL, you can follow any of the helpful tutorials out there. This one, at Global Nerdy, will do just fine.

Important: Remember to take a note of your root password when you create it!

Installing Rails

Installing Rails is simple using the RubyGems package manager (which should be installed along with the Ruby interpreter). Simply key the following at a command prompt:

> gem install rails

Installing Rails - checking version number.

Once this command has finished executing, you can check that it has installed correctly by keying rails -v at a command prompt:

Note: don’t worry too much about the version number. As long as it’s 2.2.2 or above, you’re fine.

That’s it! You are now ready to write Ruby on Rails web applications.

In Part 2 of this tutorial, you will learn how to create a basic blog from scratch.

Other Useful Resources for Getting Started

Here are a handful of excellent resources on Ruby on Rails that we recommend.

Other Ruby on Rails Installation Tutorials

The Ruby Language

Editors

Blogs

Screencasts

The "Getting Started with Ruby on Rails" Series

This is a two-part article series that is aimed at getting beginner’s up and running with Rails. Stay tuned by subscribing to the RSS feed so that you can be notified when part two is published.

Related content

About the Author

Phil McClure is a Software Developer from Belfast, Northern Ireland. His main interests are software architecture, design patterns and how these can be applied to web development. Phil blogs at theRailWorld.com. Follow him on Twitter.