My ubuntu 18.04 machine will not install ruby version 2.7

1.1k views Asked by At

My machine has simply capped at ruby version 2.5, ruby -v outputs ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]. I have tried sudo apt update && sudo apt upgrade, and sudo apt-get install ruby-full, but non of which have seemed to work.

2

There are 2 answers

0
jackBrown On

from: https://phoenixnap.com/kb/how-to-install-ruby-on-ubuntu-18-04 there are other ways, just visit the link to watch some of them

Example 2: By using rbenv

sudo apt install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev

sudo apt install rbenv

echo 'export PATH="$HOME/ .rbenv/bin:$PATH"' >> ~/.bashrc

echo 'eval "$(rbenv init –)"' >> ~/.bashrc 


rbenv install --list

and from the list select the one you want and install it

ex:
rbenv install rbx-2.7
0
duykhoa On

The supported version is usually not up to date.

A common way is using any of those Ruby version management tools, such as:

Here is the list of ruby version management tools on the official site.

If this isn't what you aren't looking for, try to install the Ruby from source.

Lastly, you can use a Ruby Docker image to run the Ruby script.