Suddenly I decided to start studying Ruby on Rails and decided to build an environment. Since it's a big deal, I'm going to build an environment with AWS Cloud9.
In this article, we will:
--AWS Cloud9 environment construction --Ruby environment construction --Installing and switching ruby version 2.5.1 using rvm --Rails environment construction --Installing rails version 5.2.1 using gem
Cloud9 is a service that allows you to use an IDE (Integrated Development Environment) in a cloud environment.
Since it runs on a browser, you can prepare a development environment with the same procedure even on PCs with different OSs and other environments. Features-AWS Cloud9 | AWS
Transit to the Cloud9 screen from the AWS Management Console.
Click Create enviroiment </ b>.
We will set up the Cloud9 environment to be created.
Give Name </ b> the name of your Cloud9 environment. It seems that you can decide freely, but this time I will use ruby-cloud9-env </ b>.
Click Next step </ b> when you are done.
Set the EC2 instance (virtual machine) </ b> used for the Cloud9 environment. All are fine by default.
Click Next step </ b>.
You can check the settings of the environment to be built. After confirming, click Create enviroiment </ b>.
Transit to the Cloud9 IDE screen. After a short wait, you will be able to operate it.
This completes the construction of the Cloud9 environment.
Next, change the settings suitable for development in Cloud9.
Visualize the space symbol.
Click the ⚙ gear mark </ b> at the bottom right of the text editor. The settings will be displayed. Click Show Invisibles </ b>.
From here, we will build the Ruby environment.
The terminal is displayed at the bottom of the Cloud9 screen. We will execute the command here.
First, update the library pre-installed in the OS. Basically, I don't think there will be any updates.
sudo yum update
This time, I would like to manage multiple versions of Ruby using RVM (Ruby Version Manager).
Clooud 9 comes with rvm pre-installed. Make sure rvm is installed just in case.
Check the version of Ruby that can be switched with rvm at this stage.
It seems that ruby-2.6.3 </ b> can be used. This time I want to use ruby-2.5.1 </ b>, so install it using rvm.
rvm install 2.5.1
Check the version of Ruby that you can switch to again when the installation is complete.
ruby-2.5.1 </ b> has been added and you can see that it is current.
Just in case, check it with the Ruby command.
You have now switched versions of Ruby using RVM. However, with the current settings, the ruby version will revert to 2.6.3 </ b> when the terminal is restarted.
Therefore, change the default version in RVM to 2.5.1 </ b>.
rvm --default use 2.5.1
Check the version of Ruby that can be switched.
You can see that ruby-2.5.1 </ b> is current && default.
This completes the ruby environment construction.
From here, we will build the Rails environment.
First, make sure that the rails command is installed.
You can see that it is not installed.
Rails is installed using the command gem </ b>. A gem is a package of Ruby applications and libraries.
Make sure gem is installed. You can use it if ruby is installed.
You can confirm that it is installed.
Now let's install rails using gem.
gem install rails -v 5.2.1 -N
You can use the -N option to skip the installation of various documents. (Installation will be faster)
Check the rails version when the installation is complete.
I was able to confirm that it was installed.
That's all for building the Rails environment.
Building an environment for Ruby on Rails had a rather annoying image, but using Cloud9 (especially Windows) makes it easy to build an environment. I'm going to build some simple systems using Ruby on Rails.