如何在debian lenny上安装ruby 1.9.2?

Jee*_*ena 14 ruby debian

我想在我的debian lenny服务器上安装最新的ruby和rails.

我找到了包http://packages.debian.org/lenny-backports/ruby1.9.1-full但是当我尝试安装它时,我得到:

atlas:~# apt-get install ruby1.9.1-full
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Couldn't find package ruby1.9.1-full
Run Code Online (Sandbox Code Playgroud)

我的sources.list看起来像这样:

atlas:~# cat /etc/apt/sources.list

deb http://ftp.se.debian.org/debian/ lenny main non-free contrib
deb-src http://ftp.se.debian.org/debian/ lenny main non-free contrib

deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-free

deb http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
deb-src http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
Run Code Online (Sandbox Code Playgroud)

如何安装它需要做什么?

Abo*_*uby 17

停止.回去.安装Ruby Debian的任何版本,可能是1.8.7或1.8.7.然后安装RVM.我有一些使用RVM和Ubuntu的方向(对不起,不是Debian,但它很接近).说真的,RVM可以轻松安装任何版本的Ruby.然后,使用RVM安装Ruby 1.9.2,你不需要1.9.1.

这将取决于您想要使用Ruby的内容.出于开发目的,使用RVM非常有效.出于服务器目的,我认为可以使用它,但是您可能会遇到一些问题.我认为RVM为您提供了一些脚本,您可以使用它们来运行带有init脚本和cron作业的Ruby脚本.

或者,您可以从源代码安装.这并不难,也不是debian方式,但它会完成工作.这可能比安装一些第三方软件包更好,您可能不知道他们在编译期间做了什么,以及如何在出现安全漏洞的情况下获得快速更新.使用RVM或从源手动安装,您可以随时更新.

  • 我觉得我应该为未来的读者指出这一点 - Debian中的ruby1.9.1包实际上包含Ruby 1.9.2. (2认同)

Dan*_*urg 8

首先运行这个:

apt-get update
Run Code Online (Sandbox Code Playgroud)

然后安装Ruby

apt-get install ruby
Run Code Online (Sandbox Code Playgroud)

那你需要rubygems

wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
Run Code Online (Sandbox Code Playgroud)

Untar ruby​​gems ...

tar xvf rubygems-1.3.5.tgz
cd rubygems-1.3.5
ruby setup.rb
ln -s /usr/bin/gem1.8 /usr/bin/gem
Run Code Online (Sandbox Code Playgroud)

现在更新rubygems

gem update --system
Run Code Online (Sandbox Code Playgroud)

现在我们可以安装rails了

gem install rails
Run Code Online (Sandbox Code Playgroud)

您可以使用以下命令检查安装是否成功:

ruby -v
rails -v
gem -v
Run Code Online (Sandbox Code Playgroud)

如果您需要更多帮助,请告诉我们!

如果您想要Ruby 1.9.2,请替换以下命令:

apt-get install ruby
Run Code Online (Sandbox Code Playgroud)

apt-get install ruby1.9
Run Code Online (Sandbox Code Playgroud)

如果你需要dev头文件,你可以安装ruby1.9-dev.

apt-get install ruby1.9-dev
Run Code Online (Sandbox Code Playgroud)

如果你不能以这种方式安装它们,你需要查看你的apt-get源代码.

apt-cache search ruby1.9

libhtree-ruby1.9 - HTML/XML tree library for Ruby 1.9
....
libinotify-ruby1.9 - Ruby interface to Linux's inotify system
....
libdbm-ruby1.9 - DBM interface for Ruby 1.9
libgdbm-ruby1.9 - GDBM interface for Ruby 1.9
....
**ruby1.9-dev** - Header files for compiling extension modules for the Ruby 1.9
ruby1.9-elisp - ruby-mode for Emacsen
ruby1.9-examples - Examples for Ruby 1.9
**ruby1.9** - Interpreter of object-oriented scripting language Ruby 1.9
libstfl-ruby1.9 - Ruby bindings for the structured terminal forms language/library
Run Code Online (Sandbox Code Playgroud)

我希望这会有所帮助.我建议使用RVM(但我没有在这里介绍..)

  • 这将安装ruby 1.8,我需要ruby 1.9.2 (2认同)