Ruby is an open source and dynamic language with an elegant syntax. It is used to build scalable web applications. Ruby is required for web developers because with the help of ruby gems we can enhance our productivity. To install ruby on Ubuntu follow below steps.
Method A – Using apt-get install
You can directly use two commands and install ruby on ubuntu machine.
#1. Quick update packages
sudo apt-get update
#2. Install ruby on ubuntu
sudo apt-get install ruby OR sudo apt-get install ruby2.0
Method B – Using brightbox ppa repository
sudo apt-get install python-software-properties
#1. Adds Ruby 2.1 to Ubuntu package list
sudo apt-add-repository ppa:brightbox/ruby-ng
#2. Now install Ruby
sudo apt-get update
sudo apt-get install ruby2.1 ruby2.1-dev
Method C – Using RVM(Ruby version manager)
#1. To install ruby using RVM follow below steps.
sudo apt-get install
#2. if you have not installed curl in your system install it using
sudo apt-get install curl
#3. Now install RVM
\curl -L https://get.rvm.io | bash -s stable
#4. Load RVM in new terminal/shell session. Close your terminal and open new one
source ~/.rvm/scripts/rvm
#5. Install RVM dependencies use below command
rvm requirements
#6. Now install RUBY(Below command will install latest version of ruby)
rvm install ruby
#7. If you have multiple versions of ruby installed in your machine then you can set just installed ruby using rvm as default ruby version using below command
rvm use ruby --default
#8. Check your ruby version if all the above steps are successful.
ruby -v
Now you have done with installation process. Now you can do some extra.
#9. You can check already installed gems using below command
gem list
#10. You can install new gems online using below command
gem install [gem-name] eg. gem install sass
#11. If you want to install gem from locally(From downloaded file) use below command
gem install --local [path of gem file]
#12. You can update you installed gems using below command
gem update --system OR gem update