How To Install Ruby on Ubuntu & Debian
Abstract: install the stable version of rvm on your system. curl -sSL httpsStep 3 – Installing Ruby on Ubuntu & Debian RVM is useful for the installation of mul
Ruby is a popular programming language among a large number of developers. Rails are the framework to run the ruby language. Ruby language was created by Yukihiro 「Matz」 Matsumoto and first published in 1995. This article will help you to install ruby on rails on Ubuntu and LinuxMint Linux systems using RVM. RVM is the Ruby Version Manager that helps for installing and managing Ruby language on systems.
In this blog post, you will get instructions to install Ruby on a Ubuntu and Debian system.
Step 1 – Installing RVMFirst of all, install the latest stable version of RVM on your system using the following command. This command will automatically download all required files and install them on your system.
- Make sure that the curl command line utility is installed on your system
sudo apt install curl gnupg2
- Import the required GPG keys to your system.
curl -sSL https://rvm.io/mpapis.asc | sudo gpg2 --import -
curl -sSL https://rvm.io/pkuczynski.asc | sudo gpg2 --import -
- Now, install the stable version of rvm on your system.
curl -sSL https://get.rvm.io | sudo bash -s stable
- After installing RVM first we need to set up rvm environment using below command. so that current shell takes new environment settings.
source /etc/profile.d/rvm.sh
- Install all the dependencies for installing Ruby automatically on the system. Run below command on terminal.
rvm requirements
Get a list of available versions of Ruby language. You can install any version of your choice or requirements shown on the list.
rvm list known
Output # MRI Rubies [ruby-]1.8.6[-p420] [ruby-]1.8.7[-head] # security released on head [ruby-]1.9.1[-p431] [ruby-]1.9.2[-p330] [ruby-]1.9.3[-p551] [ruby-]2.0.0[-p648] [ruby-]2.1[.10] [ruby-]2.2[.10] [ruby-]2.3[.8] [ruby-]2.4[.10] [ruby-]2.5[.8] [ruby-]2.6[.6] [ruby-]2.7[.2] [ruby-]3[.0.0] ruby-headStep 3 – Installing Ruby on Ubuntu & Debian
RVM is useful for the installation of multiple Ruby versions on a single system. Use the following command to install the required Ruby on your system.
Use one of the below commands to install a specific version of Ruby on your system.
- Installing Ruby 3.0
rvm install 3.0
- Installing Ruby 2.7
rvm install 2.7
Use the rvm command to set up the default ruby version to be used by applications. You can install multiple versions as defined in the above step. Now select which version you want to use.
rvm use 3.0 --default
Using /usr/local/rvm/gems/ruby-3.0.0
Step 5 – Check Ruby Version
Using the following command you can check the current ruby version is used.
ruby --version
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
Step 6 – Install Rails
You can install the latest stable release version of Rails by running the following command. It will install Rails in global Gemset So that all applications share the same version of Rails.
gem install rails
Or we can get a specific version of Rails by defining –version during installation. Visit here to get available rails versions.
gem install rails --version=7.0.3
Conclusion
Congratulation’s, You have successfully installed Ruby on your system. Read our next articles to deploy Ruby with Apache or Ruby with Nginx web server with simple steps.