Ruby Environment Manager (RVM) is a tool that will allow you to download and install multiple versions of Ruby, one of the programming languages that we teach at Flatiron School. Installing RVM is the first step in installing Ruby on your Ubuntu operating system.
- Open the "Ubuntu" application using the "Start" menu
- Type
sudo apt-get install software-properties-common
and press<Enter>
- You may be asked to enter your Ubuntu terminal password
- Type
sudo -E apt-add-repository -y ppa:rael-gc/rvm
and press<Enter>
- Type
sudo apt-get update
and press<Enter>
- Type
sudo apt-get install rvm
and press<Enter>
(Note: if you are asked "Do you want to continue [Y/n]", type "Y" and press<Enter>
) - Type
source /etc/profile.d/rvm.sh
and press<Enter>
- Type
curl -sSL https://raw.githubusercontent.com/flatiron-school/dotfiles/master/rvm-shell-script >> ~/.bashrc
and press<Enter>
- Close the "Ubuntu" application
- Open the "Ubuntu" application using the "Start" menu
- Type
rvm
and press<Enter>
If you see a long message ending in "For additional documentation, please visit
https://rvm.io", continue below. If rvm
is not found, check out the
troubleshooting steps in the Verify and Troubleshoot your WSL2 Environment
Setup lesson later on in this module.
For our Ruby labs and lessons, we expect that students use Ruby version 2.7.4 on Ubuntu. If Ruby Environment Manager (RVM) has been successfully installed, you can quickly install Ruby with a couple of commands.
- Open the "Ubuntu" application using the "Start" menu
- If the "Ubuntu" application is still open from the last step, close and re-open to prevent errors with running the next command.
- Type
rvm install 2.7.4 --default
and press<Enter>
- Enter your Ubuntu password if prompted
- Type
rvm list
and press<Enter>
If you see a message starting with =* ruby-2.7.4
, continue below.
Note: If you see that Ruby 2.7.4 is installed, but does not display
=*
before it, close and reopen the "Ubuntu" application, then runrvm use 2.7.4 --default
.
If you encounter issues installing a version of Ruby via RVM, try the following in Ubuntu:
- Run
rvm group add rvm $USER
- Close Ubuntu and reopen
- Run
rvm fix-permissions
After running the last command, try installing Ruby again with rvm install 2.7.4 --default
If you are continuing to have issues installing RVM, try running the following:
$ sudo usermod -a -G rvm $USER
After running, try installing Ruby again.
Ruby Gems are small programs written in Ruby that help you to code more easily in Ruby. The gems you will install today include: Bundler, which allows you to keep track of which gems your projects need to work, and Pry, which allows you to pause your Ruby code when it runs and inspect it.
- Open the "Ubuntu" application using the "Start" menu
- Type
gem update --system
and press<Enter>
- Type
gem install bundler
and press<Enter>
- Type
gem install pry
and press<Enter>
- Type
gem list | wc -l
and press<Enter>
If you are able to complete each step without any issues and you see an output of a number around or above 40 from the last command, continue to the next lesson, Configuring Git and GitHub on WSL2.