Three ways to install Ruby on an Ubuntu system

  • 2020-05-13 04:15:33
  • OfStack

Ruby is an open source dynamic programming language with elegant syntax for building scalable Web applications. ruby gems is a great way to increase the productivity of Ruby developers.

There are several ways to install Ruby on an Ubuntu system, each a few steps away.

Method 1: install using apt-get

You can install Ruby directly using two commands.


# sudo apt-get update
# sudo apt-get install ruby

or


# sudo apt-get install ruby2.0

Method 2: install using brightbox ppa warehouse


# 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 the version manager tool for Ruby.
1. Install RVM


# sudo apt-get curl
# curl -L https://get.rvm.io | bash -s stable
# source ~/.rvm/scripts/rvm

2. Install environment dependencies for RVM


# rvm requirements

3. Install Ruby


# rvm install ruby

If you want to install multiple versions of Ruby on Ubuntu, you can use the following command to specify rvm as the default version management of Ruby.


# rvm use ruby --default

Check the current successfully installed version of Ruby


# ruby -v

Install gems


# gem list
# gem install [gem-name]

So gem-name could be sass

To install gems locally, the command is as follows:


# gem install --local [path of gem file]

You can update the installed gems with the following command:


# sudo apt-get install ruby2.0
0

or


# sudo apt-get install ruby2.0
1

The original link: http: / / blog csdn. net/chszs/article/details / 42462517


Related articles: