Introduction

Ruby on Rails is a popular web application framework written in Ruby. This guide will walk you through the process of installing Ruby and Ruby on Rails on Debian 12.

Prerequisites

Before you begin, ensure you have:

  1. A Debian 12 server or desktop system
  2. Root or sudo privileges

Step 1: Install Ruby

Update the package index and install dependencies:

sudo apt update
sudo apt install -y curl gnupg2

Download and add the GPG key for the official Ruby repository:

curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -

Install RVM (Ruby Version Manager) to manage Ruby versions:

curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm

Install Ruby using RVM:

rvm install ruby

Set the default Ruby version:

rvm use ruby --default

Step 2: Install Node.js

Ruby on Rails requires a JavaScript runtime. Install Node.js using NodeSource:

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs

Step 3: Install Ruby on Rails

Install Ruby on Rails using RubyGems:

gem install rails

Step 4: Verify Installation

Verify the installation of Ruby and Ruby on Rails:

ruby --version
rails --version

You should see the installed versions of Ruby and Ruby on Rails.

Conclusion

Congratulations! You have successfully installed Ruby and Ruby on Rails on Debian 12. You can now start developing web applications using Ruby on Rails.

Was this answer helpful? 0 Users Found This Useful (0 Votes)