Saturday, May 20, 2017

How to install Ruby on Lubuntu 16.04

How to install Ruby on Lubuntu 16.04

Ruby is an object oriented programming language for general purpose, in this article i will show you how to install ruby on lubuntu 16.04. If you want to learn about ruby language you might want to read this.

If you want to learn about ruby, of course you need to install it on your computer, unfortunately installing ruby is not that simple, most tutorial in the internet suggest you to use rbenv or even rvm to install ruby.

I already tried to install ruby using rbenv and rvm but none of them are working, luckily i found a solution, there is a PPA repo that can help us installing ruby, with this PPA repo we can install different kind of ruby version.


Step by step how to install ruby 2.4 on lubuntu 16.04
  • open command line on your lubuntu (press CTRL + ALT + T)
  • install software-properties-common package
  • sudo apt-get install software-properties-common
  • run this command to add the PPA repo for ruby
  • sudo apt-add-repository ppa:brightbox/ruby-ng
  • run update command
  • sudo apt-get update
  • install ruby 2.4
  • sudo apt-get install ruby2.4 ruby2.4-dev

Install different version of ruby
If you prefer to use an older version of ruby, you can do that too, simply install using apt-get install command, for example you want to install ruby version 2.2, then you do this:
sudo apt-get install ruby2.2 ruby2.2-dev

How to switch between different version of ruby?
To switch between different version of ruby we need to install another program called ruby switch (it's based on the PPA repo above).
  • install ruby switch
  • sudo apt-get install ruby-switch
  • show list of ruby version installed
  • ruby-switch --list
  • switch to specific ruby version
  • sudo ruby-switch --set ruby2.2
  • check the currently active ruby version
  • ruby -v

Now you can start coding in ruby, happy coding!

No comments:

Post a Comment