我不知道如何在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 rubyThen I tried to install the 2.0 version using
sudo apt-get install ruby2.0My 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-devThen 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 -vThen (optional) tell Rubygems to not install local documentation:
echo "gem: --no-ri --no-rdoc" > ~/.gemrcCredits: https://gorails.com/setup/ubuntu/14.10
Warning!!! There are issues with Gnome-Shell. See comment below.
更多推荐
发布评论