Code Monkey home page Code Monkey logo

wsl2-env-ruby's Introduction

Installing Ruby on WSL2

Install Ruby Environment Manager (RVM) on Ubuntu

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.

Action Item

  1. Open the "Ubuntu" application using the "Start" menu
  2. Type sudo apt-get install software-properties-common and press <Enter>
  3. You may be asked to enter your Ubuntu terminal password
  4. Type sudo -E apt-add-repository -y ppa:rael-gc/rvm and press <Enter>
  5. Type sudo apt-get update and press <Enter>
  6. 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>)
  7. Type source /etc/profile.d/rvm.sh and press <Enter>
  8. Type curl -sSL https://raw.githubusercontent.com/flatiron-school/dotfiles/master/rvm-shell-script >> ~/.bashrc and press <Enter>
  9. Close the "Ubuntu" application
  10. Open the "Ubuntu" application using the "Start" menu
  11. Type rvm and press <Enter>

Check Your Work

<iframe width="560" height="315" src="https://www.youtube.com/embed/GErkBvGIGu0" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

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.

Install Ruby Version 2.6.1 on Ubuntu

For our Ruby labs and lessons, we expect that students use Ruby version 2.6.1 on Ubuntu. If Ruby Environment Manager (RVM) has been successfully installed, you can quickly install Ruby with a couple of commands.

Action Item

  1. Open the "Ubuntu" application using the "Start" menu
  2. If the "Ubuntu" application is still open from the last step, close and re-open to prevent errors with running the next command.
  3. Type rvm install "ruby-2.6.1" and press <Enter>
  4. Type rvm list and press <Enter>

Check Your Work

<iframe width="560" height="315" src="https://www.youtube.com/embed/RVwo7RPviNI" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

If you see a message starting with =* ruby-2.6.1, continue below.

Note: If you see that Ruby 2.6.1 is installed, but does not display =* before it, close and reopen the "Ubuntu" application, then run rvm use 2.6.1 --default.

Troubleshooting Ruby Installs

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.6.1 --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.

Install Ruby Gems on Ubuntu

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; Pry, which allows you to pause your code when it runs and inspect it; Nokogiri, which allows you to read and pick apart HTML pages; and Ruby on Rails, which allows you to easily create a web application with Ruby.

Action Item

  1. Open the "Ubuntu" application using the "Start" menu
  2. Type gem update --system and press <Enter>
  3. Type gem install bundler and press <Enter>
  4. Type gem install pry and press <Enter>
  5. Type gem install nokogiri and press <Enter> (Note: this gem typically takes longer than the others to install)
  6. Type gem install rails and press <Enter>
  7. Type gem install learn-co and press <Enter>
  8. Type gem list | wc -l and press <Enter>

Check Your Work

<iframe width="560" height="315" src="https://www.youtube.com/embed/pRz92UepujE" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

If you are able to complete each step without any issues and you see an output of a number around or above 100 from the last command, continue to the next lesson, Installing Databases on WSL2.

wsl2-env-ruby's People

Contributors

graciemcguire avatar ihollander avatar maxwellbenton avatar rawanddev avatar timothylevi avatar timothylevi-test avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wsl2-env-ruby's Issues

This line appears necessary.

Canvas Link

https://learning.flatironschool.com/courses/2067/pages/installing-ruby-on-wsl2?module_item_id=90680

Concern

Ubuntu throws an error when installing rvm. This line solved my problem and may help others.

Additional Context

I found that this line helped prevent a mkdir error.

Suggested Changes

Install Ruby Version 2.6.1 on Ubuntu
For our Ruby labs and lessons, we expect that students use Ruby version 2.6.1 on Ubuntu. If Ruby Environment Manager (RVM) has been successfully installed, you can quickly install Ruby with a couple of commands.

Action Item

  1. Open the "Ubuntu" application using the "Start" menu
  2. If the "Ubuntu" application is still open from the last step, close and re-open to prevent errors with running the next command.
    **** Proposed additon ****** Type rvm group add rvm "$USER"
  3. Type rvm install 2.6.1 and press
  4. Type rvm list and press

Ruby 2.6.1 installation on WSL - permission denied

ruby error

I was unable to install Ruby 2.6.1 in Ubuntu on Windows 10 as I received an "cannot create directory: Permission denied" error during installation. I resolved this problem by changing ownership of the rvm directory to my own user group as follows:

cd /usr/share/rvm
sudo chown -Rv root:$USER .

I noticed that by default the rvm directory is owned by "rvm", and the rvm install 2.6.1 command from the installation instructions does not run with superuser permission and it does not work with sudo. After changing ownership the rvm install 2.6.1 command and installation process completed successfully.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.