Install Ruby on Rails Windows 10/11

Tram Ho

In this article, I will show everyone how to install and run on Windows without installing a virtual machine, Linux or on Ubuntu.

How to install Ruby on Rails Windows 10/11. With so many programming languages ​​in our IT environment, Ruby is one of them. It is quite powerful and used for many dynamic tasks but mainly web application development. Also there are many famous software built in this language. Therefore, today we will learn how to install Ruby on Windows 11. In this article we will set up a Ruby on Rails development environment on Windows 10/11.

Install Ruby on Rails on Windows 10/11

1. Install Git

Before you begin, you will need to install the Git software package on your system.
You can download it from the Git download page. https://git-scm.com/download/win

2. Install Ruby on Windows

First, go to the Ruby installer website and download the latest version of Ruby for your system. https://rubyinstaller.org/downloads/

After clicking Finish to install ruby, the window as shown below appears:

Press Enter to finish the installation.

3. Launch Ruby Shell

Open terminal : right click on home screen, press Terminal . Check the installed Ruby version with the command

It will appear as shown below:

Verify Gem installation and list all installed Gems, run the following command:

To update Gem, we use:

You will see the following page:

If you want to update Gem Ruby, run the following command:

4. Install Rails on Windows via Gem . command

Rails is one of the Ruby Gems and you can install it using the gem command as shown below:

After Rails is installed, you will see the following page:

Rails applications cannot function without a database. Rails supports MySQL or SQLite databases. SQLite3 is the default Rails database and it can be installed with the following command:

5. Create a Rails App

After installing Ruby and Rails, we will create a simple Rails application to test the installation of Ruby on Rails. Let’s create a simple application named app with the following command:

You will get some error related to tzinfo data. To fix this error, open the Gemfile located inside the applications folder using the NotePad editor.

  • Find the following line:

  • And, replace it with the following line:

  • Save and close the file then open Ruby shell .

 

Change directory to your application directory:

Next, update all Gems with the following command:

Now, start the Rails application using the following command:

When the application is started, you will get the following screen:

Press Ctrl+click on the address like the image above: http://127.0.0.1:3000 you will see the Rails application page on the following screen:

You can start developing your own Rails app now

~~ Conclusion: ~~

  • Ruby is a programming language and development environment for Web applications, data analysis, and general programming. In this post, we learned how to install Ruby on Rails on a Windows machine and learned how to create one. Simple Rails application.
  • After many days of programming on Windows, I recommend you to use it on Linux, Ubuntu and Mac CentOS. Why, because there are very few Rails learning materials on Windows, if there is an error, we have to learn for a long time to fix it, and the libraries on Win are not enough to fix the error.

Refer:

Share the news now

Source : Viblo