Installing Ruby on Xubuntu (My Notes from The Odin Project)
Before jumping into Ruby on Rails, we first need to set up Ruby itself.
It sounds simple, but trust me — this step can get messy if you skip details.
I went through this recently while following The Odin Project, and here’s a cleaner, beginner-friendly walkthrough based on my own experience.
Why You Need Ruby First
Rails runs on Ruby, so before creating your first app, you need the correct Ruby version and a version manager to switch between them easily.
I’ll be using rbenv, which helps install and manage Ruby versions safely without touching system files.
Step 1: Update Your System
Always start fresh!
Open your terminal (Ctrl + Alt + T on Xubuntu) and update existing packages:
sudo apt update && sudo apt upgrade
This ensures your system’s libraries are current.
You’ll be asked for your password and to confirm updates — press Y when prompted.
Step 2: Install Required Dependencies
Ruby needs a few libraries and tools to build properly:
sudo apt install gcc make libssl-dev libreadline-dev zlib1g-dev libsqlite3-dev libyaml-dev
💡 Linux Tip:
Ctrl + Shift + C → Copy from terminal
Ctrl + Shift + V → Paste into terminal
Step 3: Install rbenv
rbenv lets you install and switch between Ruby versions easily.
Clone it from GitHub:
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
Then initialize it:
~/.rbenv/bin/rbenv init
Now close your terminal and reopen it to refresh your environment variables.
Verify installation:
rbenv -v
You should see something like:
rbenv 1.x.x
Step 4: Add ruby-build Plugin
This plugin helps rbenv compile and install Ruby versions.
mkdir -p "$(rbenv root)"/plugins
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
Now rbenv can handle Ruby installations.
Step 5: Install Ruby
We’re finally ready! Run:
rbenv install 3.4.2 --verbose
⏳ This might take 10–15 minutes.
The --verbose flag lets you see progress so you know it hasn’t frozen.
If you get an error like:
ruby-build: definition not found: 3.4.2
Update ruby-build and try again:
git -C "$(rbenv root)"/plugins/ruby-build pull
Step 6: Set Default Ruby Version
Once installation completes, set it as your global Ruby version:
rbenv global 3.4.2
Verify with:
ruby -v
If everything worked, you’ll see something like:
ruby 3.4.2pXXX (20XX-XX-XX revision XXXXX) [x86_64-linux]
🎉 Congrats — you’ve officially installed Ruby!
What’s Next
With Ruby set up, you’re ready to install Rails and start building your first app.
You can also watch my video walkthrough of this process here 🎥 — [YouTube Link].
Credits
This post is inspired by The Odin Project’s “Installing Ruby” lesson.
I followed their guidance but rewrote this post based on my own notes and experience using Xubuntu Linux.
Top comments (0)