如何在Ubuntu 14.04上安装Ruby 2.1.4(How to install Ruby 2.1.4 on Ubuntu 14.04)

编程入门 行业动态 更新时间:2024-10-24 14:27:50
如何在Ubuntu 14.04上安装Ruby 2.1.4(How to install Ruby 2.1.4 on Ubuntu 14.04)

我不知道如何在Ubuntu上安装最新的Ruby。

首先我安装了默认的Ruby 1.9.3,使用

sudo apt-get install ruby

然后我试图安装2.0版本使用

sudo apt-get install ruby2.0

我的Ruby版本还是“ruby 1.9.3p484(2013-11-22修订版43786)[x86_64-linux])”

我该怎么办?

I dont know how to install the latest Ruby on Ubuntu.

First I installed the default Ruby 1.9.3, using

sudo apt-get install ruby

Then I tried to install the 2.0 version using

sudo apt-get install ruby2.0

My version of Ruby is still "ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux])"

What should I do?

最满意答案

首先安装必备库:

sudo apt-get update sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

然后安装rbenv,用于安装Ruby:

cd git clone https://github.com/rbenv/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc exec $SHELL git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc exec $SHELL rbenv install 2.3.1 rbenv global 2.3.1 ruby -v

然后(可选)告诉Rubygems不安装本地文档:

echo "gem: --no-ri --no-rdoc" > ~/.gemrc

学分: https : //gorails.com/setup/ubuntu/14.10

警告!!! Gnome-Shell有问题。 见下面的评论。

First of all, install the prerequisite libraries:

sudo apt-get update sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

Then install rbenv, which is used to install Ruby:

cd git clone https://github.com/rbenv/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc exec $SHELL git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc exec $SHELL rbenv install 2.3.1 rbenv global 2.3.1 ruby -v

Then (optional) tell Rubygems to not install local documentation:

echo "gem: --no-ri --no-rdoc" > ~/.gemrc

Credits: https://gorails.com/setup/ubuntu/14.10

Warning!!! There are issues with Gnome-Shell. See comment below.

更多推荐

本文发布于:2023-07-24 01:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1240144.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   Ubuntu   install   Ruby

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!