How to Install Ruby on Rails on Windows and Linux?
Ruby on Rails or just known as rails, is free and open-source software written in Ruby language under the MIT license. It is a server-side web application development framework, designed to make programming web applications easier by making assumptions about what every developer needs to get started. Rails is a model–view–controller (MVC) framework that allows one to write less code while accomplishing more than many other frameworks. Rails itself provides the structure for a database, web pages, and a web service. Being object-oriented and a high-level programming language, it is gaining much popularity.
Downloading and Installation
Before you install Ruby on Rails, make sure SQLite3 and Ruby are installed on your computer. To know whether you have SQLite3 and Ruby installed in your system, type the following command in your command line:
$ ruby –version $ sqlite3 --version
If they are not installed, first we need to install them.
- For installation of Ruby on Windows, visit How to install Ruby on Windows?
- For installation of Ruby on Linux, visit How to install Ruby on Linux?
- For installation of SQLite3 on Windows, visit How to Install SQLite3 on Windows and Linux?
Now that you have SQLite3 and Ruby installed in your system, it’s time to install Rails, for installation and setting up of Rails, follow the steps given below:
Step 1: Type the following command in the ruby terminal:
$ gem install rails
This will install rails in both Windows and Linux operating systems.
Step 2: To verify that rails have been installed, type the following command and it should report its version.
$ rails --version
Step 3: To make your first web application in rails type the following command in the command line:
$ rails new project
where project is the name of your application.
It will show something like this:
Step 4: It will create a Rails application called project. Then, cd into that project using the following command:
$ cd project
Step 5: To start up your web server, type the following command:
$ bin/rails server
or just
$ rails server
Step 6: Now navigate to the localhost 3000 and you will be able to see the following output:
Please Login to comment...