How to Install Ruby on Rails with RVM in Ubuntu 22.04

How to Install Ruby on Rails with RVM in Ubuntu 22.04

Need to install ruby on rails with rvm on Ubuntu 22.04, Just open the terminal window and type rvm install ruby --latest command into it to install ruby and type gem install rails command into it to install rails with rvm.

How to Install Ruby on Rails with RVM on Ubuntu 22.04

Steps to install and uninstall ruby on rails with rvm on Linux ubuntu 22.04 using terminal:

Step 1 – Update System Dependencies

Press ctrl+alt+t on the keyboard to start a terminal window, and type the sudo apt update command in it to update system dependencies:

sudo apt update

Step 2 – Install Bundler

Ruby has some dependencies or packages, so you can use the sudo apt install curl gpg2 gcc make libssl-dev libreadline-dev zlib1g-dev libsqlite3-dev command to install them, type the command in the terminal window like this:

sudo apt install curl gpg2 gcc make libssl-dev libreadline-dev zlib1g-dev libsqlite3-dev

Step 3 – Install RVM

RVM is a package manager for Ruby, so to install it you need to use \curl -sSL | bash -s stable command:

\curl -sSL | bash -s stable

After installation, you need to load the RVM scripts or restart your terminal to use RVM:

source ~/.rvm/scripts/rvm

Step 4 – Install Ruby

To install the stable or latest version of Ruby, you can use rvm install ruby --latest command at the command line:

rvm install ruby --latest

After the installation is complete, set the installed Ruby version as the default:

rvm use ruby --default

Step 5 – Install Node.js

Rails requires a JavaScript runtime for some of its features. Install Node.js using NodeSource’s PPA:

curl -sL | sudo -E bash -
sudo apt install -y nodejs

Next, Yarn is a package manager for JavaScript used by Rails. Install it using npm (which comes with Node.js):

sudo npm install -g yarn

Step 6 – Install Rails

With Ruby and the required dependencies in place, you can install Ruby on Rails using the gem package manager:

gem install rails

Step 7 – Verify Installation

Confirm that Ruby and Rails have been installed successfully:

ruby --version

Step 8 – Uninstall Ruby on Ubuntu

If for any reason you want to completely uninstall or delete Ruby from your Ubuntu system, you can use sudo apt remove --autoremove ruby command for that:

sudo apt remove --autoremove ruby


Congratulations! You’ve successfully installed Ruby on Rails using RVM on your Ubuntu system. You can now start creating and working on Ruby on Rails applications.

Recommended Linux Ubuntu Tutorials


Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *