我不知道如何在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])”
我该怎么办?
首先,安装必备库:
原文链接:https://www.f2er.com/ubuntu/352333.htmlsudo 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有问题。见下面的注释。