Linux MintUbuntu Based

How To Install Ruby on Rails on Linux Mint 21

Install Ruby on Rails on Linux Mint 21

In this tutorial, we will show you how to install Ruby on Rails on Linux Mint 21. Ruby on Rails, often simply Rails, is a server-side web application framework written in Ruby under the MIT License. It is a model-view-controller (MVC) framework, that provides default structures for a database, a web service, and web pages. Its emphasis on convention over configuration (CoC), and the rapid application development (RAD) principle, makes it a favorite among many developers.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Ruby on Rails on a Linux Mint 21.


  • A server running one of the following operating systems: Linux Mint 21.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • While we’ll guide you through the process, a basic understanding of the command line will be beneficial. If you’re new to the CLI, you might want to acquaint yourself with some fundamental commands.
  • An active internet connection.
  • Administrative privileges are essential for installing and configuring software on your system. Ensure that you have superuser or sudo access.

Install Ruby on Rails on Linux Mint 21

Step 1. Before installing Rails, it’s crucial to update your Linux system. This ensures that you have the latest security patches and system software. Depending on your Linux distribution, you can update your system using the following commands:

sudo apt update
sudo apt upgrade
sudo apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev

Step 2.Installing Ruby.

There are several ways to install Ruby on your Linux system. You can install it directly from the apt repository, or you can use a version manager like RVM or rbenv.

  • Install Ruby using APT

To install Ruby using APT, run the following command:

sudo apt install ruby
  • Install Ruby using RVM

RVM (Ruby Version Manager) is a command-line tool that allows you to install, manage, and work with multiple Ruby environments. To install Ruby using RVM, follow these steps:

\curl -sSL | bash -s stable

Load RVM into your shell sessions:

source ~/.rvm/scripts/rvm

Install Ruby:

rvm install ruby

Set the default Ruby version:

rvm use ruby --default
  • Install Ruby using rbenv

rbenv is another Ruby version manager. It’s lightweight and simpler than RVM. To install Ruby using rbenv, follow these steps:

git clone ~/.rbenv

Add rbenv to bash:

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc

Install ruby-build as an rbenv plugin:

git clone ~/.rbenv/plugins/ruby-build

Install Ruby:

rbenv install 2.6.3

Set the default Ruby version:

rbenv global 2.6.3

Step 3. Installing Rails.

After installing Ruby, you can install Rails. To install the latest version of Rails, run the following command:

gem install rails

To install a specific version of Rails, use the -v option. For example, to install Rails 5.2.0, run:

gem install rails -v 5.2.0

Step 4. Create Sample Rails Application.

With Ruby on Rails installed, you’re now ready to create your first Rails application. Here’s how you can do it:

cd /path/to/your/directory

Create a new Rails application:

rails new myapp

Navigate into your new application’s directory:

cd myapp

Start your Rails server:

rails server

You should now have a running Rails application on your local server.

Install Ruby on Rails on Linux Mint 21

Congratulations! You have successfully installed Ruby on Rails. Thanks for using this tutorial to install the latest version of Ruby on Rails on the Linux Mint system. For additional help or useful information, we recommend you check the official Ruby on Rails website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button