How to install Ruby on an EC2 instance on AWS

Introduction

AWS is an abbreviation for Amazon Web Servises, which is a cloud server service provided by Amazon. We will output what we have learned in order to improve our understanding of AWS.

This flow

Install Ruby on the instance created by EC2 on AWS.

It is assumed that you have created an instance.

Install Ruby on your EC2 instance

① Log in to the instance

Terminal


% ssh -i key pair name.pem ec2-user@<Public IP>

(2) Install the packages required to build the environment While logged in to the instance

Terminal


First, update the package.
[instance]$ sudo yum -y update

Install the package.
[instance]$ sudo yum -y install git make gcc-c++ patch libicu-devel readline-devel libxml2-devel libxslt-devel ImageMagick ImageMagick-devel openssl-devel libcurl-devel curl

③ Install Node.js (so that JavaScript can run)

Terminal


[instance]$ sudo curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash -
[instance]$ sudo yum install -y nodejs

③ Install Yarn (package manager for managing JavaScript packages)

Terminal


[instance]$ sudo yum install -y wget
[instance]$ sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
[instance]$ sudo yum install -y yarn

④ Install rbenv and ruby-build rbenv: A tool that switches Ruby versions ruby-build: A rbenv plugin that provides the rbenv install command for compiling and installing different versions of Ruby on UNIX-like systems.

Install rbenv
[instance]$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv

Pass through
[instance]$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
[instance]$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

.bash_Load profile
[instance]$ source .bash_profile

ruby-install build
[instance]git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build

rehash(Make commands available)
[instance]$ rbenv rehash

⑤ Install Ruby

Ruby 2.6.Install 5
[instance]$ rbenv install 2.6.5

Specify the version of Ruby to use in the instance
[instance]$ rbenv global 2.6.5

rehash(Make commands available)
[instance]$ rbenv rehash

Finally

We hope that this post will help beginners review.

Recommended Posts

How to install Ruby on an EC2 instance on AWS
How to create an application server on an EC2 instance on AWS
How to create a web server on an EC2 instance on AWS
How to install and use Composer on an ECS instance on Ubuntu 16.04
How to publish an application using AWS (3) EC2 instance environment construction
[Ruby on Rails] How to install Bootstrap in Rails
Install docker on AWS EC2
How to handle an instance
Install docker-compose on a Graviton 2 instance of AWS EC2
How to install ImageMagick on Windows 10
How to install ruby through rbenv
How to use Ruby on Rails
How to install Bootstrap in Ruby
How to install MariaDB 10.4 on CentOS 8
How to install WildFly on Ubuntu 18.04
[Ruby on Rails] How to use CarrierWave
How to install Eclipse (Photon) on Mac
How to publish an application on Heroku
How to install production Metabase on Ubuntu
How to install beta php8.0 on CentOS8
[Ruby on Rails] How to use redirect_to
[Ruby on Rails] How to use kaminari
How to install kafkacat on Amazon Linux2
How to send push notifications on AWS
[Ruby on Rails] How to display error messages
How to deploy a container on AWS Lambda
How to add / remove Ruby on Rails columns
How to install network drivers on standalone Ubuntu
Error installing ruby execution environment on EC2 instance
How to save images on Heroku to S3 on AWS
How to install NVIDIA driver on Ubuntu 18.04 (Note)
Build a Laravel environment on an AWS instance
How to install multiple JDKs on Ubuntu 18.04 LTS
I tried installing docker on an EC2 instance
[Ruby on Rails] How to use session method
Install Ruby on Ubuntu 20.04
How to install Docker
How to install docker-machine
How to install MySQL
How to install ngrok
How to check if an instance variable is defined in a Ruby class
Memo to build a Servlet environment on AWS EC2
[Ruby on Rails] How to write enum in Japanese
Deploy laravel using docker on EC2 on AWS ① (Create EC2 instance)
List how to learn from Docker to AKS on AWS
[Ruby on Rails] How to change the column name
How to install NVIDIA driver on Ubuntu ssh destination
[Ruby On Rails] How to reset DB in Heroku
Install MySQL 5.6 on CentOS6 [How to specify the version]
(Ruby on Rails6) How to create models and tables
[AWS] How to check logs
How to use Ruby return
[Rails] How to install devise
How to deploy on heroku
[Ruby] How to comment out
How to install Boots Faces
[Ruby] What is an instance?
Ruby: How to use cookies
Install Ruby 2.7 on RHEL 8 (AppStream)
[Ruby] How to write blocks
Install Ruby 2.7 on CentOS 7 (SCL)