20

I have developed ruby application using padrino ruby framework. And I would like to deploy it on Amazon.

I used this image. Amazon Linux AMI 2017.09.1 (HVM), SSD Volume Type

And image description was:

"The Amazon Linux AMI is an EBS-backed, AWS-supported image. The default image includes AWS command line tools, Python, Ruby, Perl, and Java. The repositories include Docker, PHP, MySQL, PostgreSQL, and other packages."

After launching instance, I tested ruby version and it was ruby 2.0.0p648 (2015-12-16) [x86_64-linux] but I need ruby2.4 to deploy padrino framework. I tried to update ruby version with no success for whole day. console says current version is latest version and there is no ruby2.4 How to solve this?(I updated gem version to 2.7.2)

engineersmnky
  • 25,495
  • 2
  • 36
  • 52
Nomura Nori
  • 4,689
  • 8
  • 47
  • 85
  • 1
    Remove the preinstalled ruby and then use any ruby version manager, like https://rvm.io or https://github.com/rbenv/rbenv or https://github.com/postmodern/chruby . _Sidenote:_ **never ever** use the preinstalled ruby version that comes with an operating system, neither for development nor for production. – Aleksei Matiushkin Nov 10 '17 at 16:49

2 Answers2

33

If you are running Amazon Linux 2, later versions of popular software packages (including Ruby) are installed using the Extras Library. To see the latest available version:

$ amazon-linux-extras list

You'll need sudo privileges to install:

$ sudo amazon-linux-extras install ruby2.6
idoimaging
  • 764
  • 1
  • 7
  • 14
21

To install ruby 2.4 do this, sudo yum install -y ruby24.

And to make 2.4 the default version (the old version will still be there) do this, sudo alternatives --set ruby /usr/bin/ruby2.4.

dr_dave
  • 345
  • 1
  • 10