Introduction
Ruby on Rails is a popular web application framework written in Ruby. rbenv is a lightweight Ruby version management tool that allows you to easily install and manage multiple Ruby versions. In this guide, we'll walk through the steps to install Ruby on Rails with rbenv on Ubuntu 22.04.
Prerequisites
Before proceeding, ensure you have:
- An Ubuntu 22.04 server or desktop environment
- Basic knowledge of using the command line
Steps to Install Ruby on Rails with rbenv
- Install rbenv: Install rbenv and its dependencies:
sudo apt update
sudo apt install rbenv ruby-build
- Set Up rbenv: Initialize rbenv by adding it to your shell's profile configuration:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
- Install Ruby: Use rbenv to install the desired version of Ruby:
rbenv install
- Set Global Ruby Version: Set the global Ruby version for your user:
rbenv global
- Install Rails: Install Ruby on Rails using the gem package manager:
gem install rails
- Verify Installation: Verify that Ruby and Rails have been installed correctly:
ruby -v
rails -v
Conclusion
Congratulations! You have successfully installed Ruby on Rails with rbenv on your Ubuntu 22.04 system. You can now start developing web applications using Ruby on Rails and leveraging its powerful features and ecosystem.