开发者

How to install ruby 1.9.2 on debian lenny? [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 10 years ago.

Improve this question

I would like to install the newest ruby and rails on my debian lenny server.

I found the package http://packages.debian.org/lenny-backports/ruby1.9.1-full but when I try to install it with I just get:

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

My sources.list looks like this:

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

What do I have to do to get it installed?


Stop. Go back. Install whatever version of Ruby Debian has, probably 1.8.7 or 1.8.7. Then install RVM. I have some directions for using RVM with Ubuntu (sorry, not Debian, but it's close). Seriously, RVM makes installing any version of Ruby easy. Then, use RVM to install Ruby 1.9.2, you don't want 1.9.1.

This will work depending on what you want to use Ruby for. For development purposes, using RVM works really well. For server purposes, I suppose it can be used, but you might have some problems. I think RVM gives you some scripts you can use to run Ruby scripts with init scripts and cron jobs.

Or, you can just install from source. It's not hard, and it's not the debian way, but it'll get the job done. This may be preferable to installing some third party packages, where you may have no idea what they did during compile time, and how to get speedy updates in the case of a security vulnerability. Using RVM or installing manually from source, you can update whenever it's needed.


First run this:

apt-get update

Then install Ruby

apt-get install ruby

Then you need rubygems

wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz

Untar rubygems...

tar xvf rubygems-1.3.5.tgz
cd rubygems-1.3.5
ruby setup.rb
ln -s /usr/bin/gem1.8 /usr/bin/gem

Now update rubygems

gem update --system

And now we can install rails

gem install rails

You can check if the install was succesfull with the following commands:

ruby -v
rails -v
gem -v

If you need more help let me know!

If you want Ruby 1.9.2 replace the following commands:

apt-get install ruby

with

apt-get install ruby1.9

If you need the dev headers you can just install ruby1.9-dev.

apt-get install ruby1.9-dev

If you cant install them this way you need to look at your apt-get sources.

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

I hope this helps.And i would suggest using RVM (but i didn't cover that here..)


RVM is a great solution, but not for production environments. Its $PATH magic is too finicky and breaks too often.

I'd suggest building a .deb for yourself. You compile Ruby from source, and then install it using checkinstall. Then you can distribute the .deb it creates to any machine, and install/uninstall it using dpkg like you would with any package.

Here's a tutorial that does this in Ubuntu; it should translate very easily to Debian.


Don't install any rubies by Debian, recently one of the main maintainer gives up on them: http://www.lucas-nussbaum.net/blog/?p=617 Debian's rubies used to be ugly and often broken, so the best way to install it is by now using rvm, a little program that manages gemset and different versions of rubies in the same machine.


If you want to install a package from the Lenny backports repository, you obviously need to have it in your sources.list:

deb http://Backports.Debian.Org/debian-backports lenny-backports main contrib non-free
deb-src http://Backports.Debian.Org/debian-backports lenny-backports main contrib non-free

Since the backports are not subject to the normal strict quality review that other packages are, they are disabled by default. If you want to install a package from the backports repository, you have to explicitly pass the distribution to apt-get or aptitude, just like with the experimental repository:

apt-get -t lenny-backports install ruby191-full # or
aptitude -t lenny-backports install ruby191-full

Since the backported packages are disabled by default, you won't even get security updates for them, unless you add a pinning in /etc/apt/preferences:

Package: *
Pin: release a=lenny-backports
Pin-Priority: 200

All of this is clearly spelled out on the Debian Backports website.

Note that you should be careful not to mix package management systems. You should either install all Ruby libraries via APT or via RubyGems, but it's generally not a good idea to mix them.

Also, if you use Debian's RubyGems package, you should only update it via APT, not via RubyGems's builtin update mechanism (gem update --system). Actually, I believe that in current versions, Debian has removed the update mechanism to prevent this, but it wasn't always the case.

Personally, I use the Debian Ruby packages without problems on a production server, and I don't use RubyGems at all, I only use the Ruby libraries provided by Debian.


was just going to add a comment to the original question, but I guess I haven't earned that priviledge yet...

Anyways, I found this helpful link and thought I would share it:

http://blog.binarybalance.com.au/2010/08/28/compiling-ruby-1-9-2-on-debian-lenny

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜