I want to install ruby 2.0 using
我想使用ruby 2.0来安装
sudo apt-get install ruby2.0
But there isn't available package for ruby2.0
但是ruby2.0没有可用的包
I want to install it using apt-get install the same like ruby 1.9.1
我想使用apt-get安装来安装它,就像ruby 1.9.1一样
Any suggestions?
有什么建议吗?
6 个解决方案
#1
97
sudo apt-get -y update sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev cd /tmp wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p451.tar.gz tar -xvzf ruby-2.0.0-p451.tar.gz cd ruby-2.0.0-p451/ ./configure --prefix=/usr/local make sudo make install
from here How do I install ruby 2.0.0 correctly on Ubuntu 12.04?
从这里开始,如何在Ubuntu 12.04上正确安装ruby 2.0.0 ?
UPDATE
更新
for ruby 2.1.5
为ruby 2.1.5
sudo apt-get -y update sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev cd /tmp wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz tar -xvzf ruby-2.1.5.tar.gz cd ruby-2.1.5/ ./configure --prefix=/usr/local make sudo make install
if you are still seeing an older ruby check your symlink ls -la /usr/bin/ruby
from hector
如果您仍然看到一个老的ruby检查您的symlink ls -la /usr/bin/ruby从hector。
#2
55
sudo apt-add-repository ppa:brightbox/ruby-ng-experimental &&
sudo apt-get update &&
sudo apt-get install -y ruby2.0 ruby2.0-dev ruby2.0-doc
Easy to use ^ㅡ^
容易使用^ㅡ^
#3
42
# Adds Ruby 2.2 to Ubuntu 14.04
sudo apt-add-repository ppa:brightbox/ruby-ng
# Adds Ruby v1.9/2.0/2.1/2.2 to Ubuntu 14.04/15.04
# sudo add-apt-repository ppa:brightbox/ruby-ng-experimental
sudo apt-get update
sudo apt-get install ruby2.2 ruby2.2-dev
# http://*.com/a/1892889/2126990
# priority ruby: https://gist.github.com/brodock/7693207
sudo update-alternatives --remove ruby /usr/bin/ruby2.2
sudo update-alternatives --remove irb /usr/bin/irb2.2
sudo update-alternatives --remove gem /usr/bin/gem2.2
sudo update-alternatives \
--install /usr/bin/ruby ruby /usr/bin/ruby2.2 50 \
--slave /usr/bin/irb irb /usr/bin/irb2.2 \
--slave /usr/bin/rake rake /usr/bin/rake2.2 \
--slave /usr/bin/gem gem /usr/bin/gem2.2 \
--slave /usr/bin/rdoc rdoc /usr/bin/rdoc2.2 \
--slave /usr/bin/testrb testrb /usr/bin/testrb2.2 \
--slave /usr/bin/erb erb /usr/bin/erb2.2 \
--slave /usr/bin/ri ri /usr/bin/ri2.2
update-alternatives --config ruby
update-alternatives --display ruby
$ irb
irb(main):001:0> RUBY_VERSION
=> "2.2.0"
$ ruby --version
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux-gnu]
#4
21
Since this question was answered I have found a new alternative here:
自从这个问题得到回答后,我在这里找到了一个新的选择:
https://www.brightbox.com/docs/ruby/ubuntu/
https://www.brightbox.com/docs/ruby/ubuntu/
In short:
简而言之:
# For ubuntu >= 14.04 install software-properties-common
# instead of python-software-properties
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get -y install ruby2.2 ruby-switch
sudo ruby-switch --set ruby2.2
I must say that according to my tests this is faster than the alternatives shown here, because the compiling step is skipped.
我必须说,根据我的测试,这比这里显示的其他方法要快,因为编译步骤被跳过了。
#5
1
The better way to install ruby on ubuntu without RVM is to install it with rbenv in terminal as follows:
在没有RVM的情况下,在ubuntu上安装ruby更好的方式是在终端安装rbenv,如下所示:
$ sudo apt-get update
Install the rbenv and Ruby dependencies with apt-get:
使用apt-get安装rbenv和Ruby依赖项:
$ 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
Now run these commands as follows:
现在运行以下命令:
$ 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
Time to install ruby:
安装ruby:
$ rbenv install 2.3.3
which ever is the latest and stable version
哪一个是最新的和稳定的版本
$ rbenv global 2.3.3
To check the version
检查版本
$ ruby -v
To disable the local documentation, as this process can be lengthy:
要禁用本地文档,因为这个过程可能很长:
$ echo "gem: --no-document" > ~/.gemrc
Install the bundler gem, to manage your application dependencies:
安装bundler gem,管理应用程序依赖项:
$ gem install bundler
#6
0
I particularly like ruby-install, available here: https://github.com/postmodern/ruby-install
我特别喜欢ruby安装,这里有:https://github.com/postmodern/ruby安装
It will install ruby (any version), JRuby, etc., and has many other features besides.
它将安装ruby(任何版本)、JRuby等,并具有许多其他特性。
#1
97
sudo apt-get -y update sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev cd /tmp wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p451.tar.gz tar -xvzf ruby-2.0.0-p451.tar.gz cd ruby-2.0.0-p451/ ./configure --prefix=/usr/local make sudo make install
from here How do I install ruby 2.0.0 correctly on Ubuntu 12.04?
从这里开始,如何在Ubuntu 12.04上正确安装ruby 2.0.0 ?
UPDATE
更新
for ruby 2.1.5
为ruby 2.1.5
sudo apt-get -y update sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev cd /tmp wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz tar -xvzf ruby-2.1.5.tar.gz cd ruby-2.1.5/ ./configure --prefix=/usr/local make sudo make install
if you are still seeing an older ruby check your symlink ls -la /usr/bin/ruby
from hector
如果您仍然看到一个老的ruby检查您的symlink ls -la /usr/bin/ruby从hector。
#2
55
sudo apt-add-repository ppa:brightbox/ruby-ng-experimental &&
sudo apt-get update &&
sudo apt-get install -y ruby2.0 ruby2.0-dev ruby2.0-doc
Easy to use ^ㅡ^
容易使用^ㅡ^
#3
42
# Adds Ruby 2.2 to Ubuntu 14.04
sudo apt-add-repository ppa:brightbox/ruby-ng
# Adds Ruby v1.9/2.0/2.1/2.2 to Ubuntu 14.04/15.04
# sudo add-apt-repository ppa:brightbox/ruby-ng-experimental
sudo apt-get update
sudo apt-get install ruby2.2 ruby2.2-dev
# http://*.com/a/1892889/2126990
# priority ruby: https://gist.github.com/brodock/7693207
sudo update-alternatives --remove ruby /usr/bin/ruby2.2
sudo update-alternatives --remove irb /usr/bin/irb2.2
sudo update-alternatives --remove gem /usr/bin/gem2.2
sudo update-alternatives \
--install /usr/bin/ruby ruby /usr/bin/ruby2.2 50 \
--slave /usr/bin/irb irb /usr/bin/irb2.2 \
--slave /usr/bin/rake rake /usr/bin/rake2.2 \
--slave /usr/bin/gem gem /usr/bin/gem2.2 \
--slave /usr/bin/rdoc rdoc /usr/bin/rdoc2.2 \
--slave /usr/bin/testrb testrb /usr/bin/testrb2.2 \
--slave /usr/bin/erb erb /usr/bin/erb2.2 \
--slave /usr/bin/ri ri /usr/bin/ri2.2
update-alternatives --config ruby
update-alternatives --display ruby
$ irb
irb(main):001:0> RUBY_VERSION
=> "2.2.0"
$ ruby --version
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux-gnu]
#4
21
Since this question was answered I have found a new alternative here:
自从这个问题得到回答后,我在这里找到了一个新的选择:
https://www.brightbox.com/docs/ruby/ubuntu/
https://www.brightbox.com/docs/ruby/ubuntu/
In short:
简而言之:
# For ubuntu >= 14.04 install software-properties-common
# instead of python-software-properties
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get -y install ruby2.2 ruby-switch
sudo ruby-switch --set ruby2.2
I must say that according to my tests this is faster than the alternatives shown here, because the compiling step is skipped.
我必须说,根据我的测试,这比这里显示的其他方法要快,因为编译步骤被跳过了。
#5
1
The better way to install ruby on ubuntu without RVM is to install it with rbenv in terminal as follows:
在没有RVM的情况下,在ubuntu上安装ruby更好的方式是在终端安装rbenv,如下所示:
$ sudo apt-get update
Install the rbenv and Ruby dependencies with apt-get:
使用apt-get安装rbenv和Ruby依赖项:
$ 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
Now run these commands as follows:
现在运行以下命令:
$ 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
Time to install ruby:
安装ruby:
$ rbenv install 2.3.3
which ever is the latest and stable version
哪一个是最新的和稳定的版本
$ rbenv global 2.3.3
To check the version
检查版本
$ ruby -v
To disable the local documentation, as this process can be lengthy:
要禁用本地文档,因为这个过程可能很长:
$ echo "gem: --no-document" > ~/.gemrc
Install the bundler gem, to manage your application dependencies:
安装bundler gem,管理应用程序依赖项:
$ gem install bundler
#6
0
I particularly like ruby-install, available here: https://github.com/postmodern/ruby-install
我特别喜欢ruby安装,这里有:https://github.com/postmodern/ruby安装
It will install ruby (any version), JRuby, etc., and has many other features besides.
它将安装ruby(任何版本)、JRuby等,并具有许多其他特性。