Home  »  ArticlesGuidesHow ToProgrammingTechnologyTools   »   Mastering Ruby: A Guide to Installing Ruby on Ubuntu 22.04

Mastering Ruby: A Guide to Installing Ruby on Ubuntu 22.04

Ruby, a dynamic and object-oriented programming language, powers countless web applications and software projects. In this tutorial, we’ll walk you through the step-by-step process of installing Ruby on Ubuntu 22.04, empowering you to embark on your journey with this versatile language.

Step 1: Update Package Index

Before installing Ruby, ensure your system’s package index is up-to-date. Execute the following command:

$ sudo apt update

Step 2: Install Ruby Version Manager (RVM)

RVM simplifies Ruby installation and management. Install it with:

$ sudo apt install curl gpg

Then, install RVM using curl:

$ curl -sSL https://get.rvm.io | bash -s stable

Step 3: Load RVM Script

Load RVM script to start using it in the current shell session:

$ source ~/.rvm/scripts/rvm

Step 4: Install Ruby

Install the desired version of Ruby using RVM. For example, to install Ruby 3.0:

$ rvm install 3.0

Step 5: Set Default Ruby Version

Set the newly installed Ruby version as the default:

$ rvm use 3.0 --default

Step 6: Verify Ruby Installation

Ensure Ruby is installed correctly by checking its version:

$ ruby --version

Conclusion

Congratulations! You’ve successfully installed Ruby on Ubuntu 22.04 using RVM. With Ruby at your fingertips, you’re ready to dive into the world of web development and software engineering. Explore Ruby’s expressive syntax and vast ecosystem to build powerful and innovative projects.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.