I'll install Ruby on EC2 (Amazon Linux2) 2020

I had to install Ruby on an EC2 instance to use ServerSpec, but it was unexpectedly difficult, so I summarized the procedure. (Mainly as a memorandum.) I think you can install it quickly without getting caught!

Server environment

--EC2 instance


SSH connection when EC2 starts

Install rbenv

rbenv is a Ruby version control tool

1 Update for the time being

$ sudo yum update -y

2 Install git

$ sudo yum install git -y

3 Clone rbenv from repository

$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv

4 After cloning, put it in the rbenv PATH

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile

5 If the version of rbenv is displayed, the installation is successful.

$ rbenv -v

Install ruby-build

The rbenv plugin required when installing Ruby via rbenv. Ruby cannot be installed without this.

1 Clone from repository

$ git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

2 Perform installation

$ cd ~/.rbenv/plugins/ruby-build
$ sudo ./install.sh

3 If the list of installable Ruby versions is displayed, ruby-build installation is successful.

$ rbenv install -l

Ruby installation

1 Install the packages required for Ruby installation

$ sudo yum -y install gcc-c++ glibc-headers openssl-devel readline libyaml-devel readline-devel zlib zlib-devel libffi-devel libxml2 libxslt libxml2-devel libxslt-devel sqlite-devel

2 Install Ruby by specifying the version with rbenv (It takes a long time. The screen does not move at all, but the installation is proceeding)

$ rbenv install 2.7.0
$ #Version 2.7.Install 0

3 Specify the version of Ruby to be used in rbenv

$ rbenv global 2.7.0

4 Check the Ruby version (successful if the version you specified earlier is displayed ~> 2.7.0)

$ ruby -v


I think there are a lot of articles like this, but I got stuck somewhere, so I tried to raise the procedure that was successful again. I would be happy if it was helpful.

Recommended Posts

I'll install Ruby on EC2 (Amazon Linux2) 2020
Install pyenv on EC2 (Amazon Linux)
Install Python 3.8, Pip 3.8 on EC2 (Amazon Linux 2)
Install tomcat 5.5 on Amazon Linux.
Install Homebrew on Amazon Linux 2
Install strongSwan 5.9.1 on Amazon Linux 2
[AWS EC2] How to install Maven on Amazon Linux 2
Install Python Pillow on Amazon Linux
Install oracle java8 on amazon linux2
[Note] Install Imagick on Amazon Linux2
How to install Anisble on Amazon Linux 2
Install PHP 7 series on Amazon Linux 2 with Amazon Linux Extras
Install Python3 and Django on Amazon Linux (EC2) and run your web server
Install Minecraft on Arch Linux
Install Linux on your Chromebox
Install the JDK on Linux
Put jenv on Amazon Linux
Python --Install MySQLDB on EC2
Compile and install MySQL-python for python2.7 on amazon linux
Use sshpass on Amazon linux2
How to install git on Linux such as EC2
[AWS EC2] How to install only MySQL client on Amazon Linux 2 and connect to RDS
Install LAMP on Amazon Linux 2 and build a WordPress environment.
[AWS EC2] Settings you want to do on Amazon Linux 2
Launch NEM Symbol testnet node on AWS EC2 (Amazon Linux2)
Try installing OpenAM on Amazon Linux
Install CUDA on Linux Mint Mate 20
Install Arch Linux on DeskMini A300
How to install wkhtmltopdf (Amazon Linux2)
How to install VMware-Tools on Linux
[Note] Run Django on Amazon Linux 2
Run docker-compose on Amazon Linux2 on ARM64
Introduce Python 3.5.2 environment on Amazon Linux
Run cron on Amazon Linux (set on Linux)
Summary of installing PHP7.2 on EC2 (Amazon Linux 2) and setting php.ini
Install scipy on Linux without internet connection
How to install aws-session-manager-plugin on Manajro Linux
Install wsl2 and master linux on windows
Use Numpy, Scipy, scikit-learn on Amazon Linux
How to update php on Amazon linux 2
Install and launch k3s on Manjaro Linux
Build an LNPP environment on Amazon Linux 2
Install and Configure TigerVNC server on Linux
Learn sshd_config and authorized_keys (on Amazon Linux 2)
Upgraded mysql on Cloud9 (Amazon Linux) (5.5 to 5,7)
How to install packages on Alpine Linux
5 reasons to install Linux on your laptop.
Dockerfile: Install Docker on your Linux server
Install Mecab on Linux (CentOS) with brew
Run Keycloak on Amazon Linux 2 without Docker
How to install php7.4 on Linux (Ubuntu)
Install rJava on Linux in R3.6 environment.
Until you install Arch Linux on VMware
Linux "Install on / dev / sda" error resolution
A story I was addicted to trying to install LightFM on Amazon Linux
Run a batch of Python 2.7 with nohup on Amazon Linux AMI on EC2
Install debian on linux on Arrows tab Q584 / H
[2020 version] How to install Python3 on AWS EC2
Install Anydesk Linux version on Chromebook [Result NG]
[Note] Install wxPython 3.x on Linux Mint (Ubuntu)
EC2 (Amazon Linux) certbot-auto renew error /pkg_resources.DistributionNotFound: The'virtualenv == 15.1.0'