Install Ruby with RVM on Ubuntu 18.04 and 19.10
source link: https://www.vultr.com/docs/install-ruby-with-rvm-on-ubuntu-18-04-and-19-10
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Introduction
This tutorial explains how to install Ruby, using RVM, on Ubuntu 18.04 and Ubuntu 19.10. Ruby is a popular development language. RVM manages multiple Ruby environments and allows you to switch between them.
Requirements
- A Vultr instance running Ubuntu 18.04 or 19.10.
RVM Installation
Install GPG
$ sudo apt install gnupg
Import RVM Signing Key
Import the RVM code-signing keys. The command below is an example, please verify the keys at https://rvm.io/rvm/security.
$ gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Step 2: Download and install RVM
Go to the /tmp
folder
$ cd /tmp
Download a stable version of the RVM script.
$ sudo apt-get update && apt-get install curl && curl -sSL https://get.rvm.io | bash -s stable
Add your user account to the rvm group.
$ sudo usermod -a -G rvm username
Log out of your terminal, then log back in again. Group memberships are only evaluated at login time.
Check the RVM version.
$ rvm -v
rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
Manage your Ruby Environment
Example: List the known Ruby versions
$ rvm list known
Example: Install a specific version of Ruby.
$ rvm install ruby-2.7.0
$ rvm --default use ruby-2.7.0
Example: Remove a specific version of Ruby.
$ rvm remove ruby-2.7.0
Example: Check the Ruby versions installed with RVM.
$ rvm list
Example: Check the Ruby version.
$ ruby -v
Example: Remove a specific version of Ruby.
$ rvm remove ruby-2.7.0
Uninstall RVM
Remove RVM with:
$ sudo rvm implode $ sudo rm -rf ~/.rvm $ sudo rm -rf /etc/rvmrc $ sudo rm -rf ~/.rvmrc $ sudo groupdel rvm
Delete RVM source lines from all
.bashrc
,.bash_profile
,.profile
, and.zshrc
files.- Reboot
Conclusion
RVM is a simple way to manage multiple Ruby environments. For more information, see the RVM homepage.
Want to contribute?
You could earn up to $600 by adding new articles
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK