Ruby is an open source dynamic programming language with beautiful syntax for building scalable web applications. Ruby gems can greatly enhance the development efficiency of Ruby developers.
There are several ways to install Ruby on Ubuntu system, each of which can be done in just a few steps.
Method 1: Use apt-get to install
You can directly use two commands to complete the installation of Ruby.
Copy the codeThe code is as follows:
# sudo apt-get update
# sudo apt-get install ruby
or
Copy the codeThe code is as follows:
# sudo apt-get install ruby2.0
Method 2: Use brightbox ppa warehouse to install
Copy the codeThe code is as follows:
# sudo apt-get install python-software-properties
# sudo apt-add-repository ppa:brightbox/ruby-ng
# sudo apt-get update
# sudo apt-get install ruby2.1 ruby2.1-dev
Method 3: Install using RVM
RVM is a version manager tool for Ruby.
1. Install RVM
Copy the codeThe code is as follows:
# sudo apt-get curl
# curl -L | bash -s stable
# source ~/.rvm/scripts/rvm
2. Environment dependencies for installing RVM
Copy the codeThe code is as follows:
# rvm requirements
3. Install Ruby
Copy the codeThe code is as follows:
# rvm install ruby
If you want to install multiple Ruby versions on Ubuntu, you can use the following command to specify the use of rvm as the default Ruby version management.
Copy the codeThe code is as follows:
# rvm use ruby --default
Check the currently successfully installed Ruby version
Copy the codeThe code is as follows:
# ruby -v
Install gems
Copy the codeThe code is as follows:
# gem list
# gem install [gem-name]
For example, gem-name can write sass
If you want to install gems from locally, the command is as follows:
Copy the codeThe code is as follows:
# gem install --local [path of gem file]
You can use the command to update the installed gems, the command is as follows:
Copy the codeThe code is as follows:
# gem update --system
or
Copy the codeThe code is as follows:
# gem update