Installing Ruby 1.9.1 on Ubuntu?

2019-01-30 08:30发布

I wonder about installing the latest version of Ruby on Ubuntu 9.04. Now I can run through the ./configure and make stuff fine, but what I wonder about: how to avoid conflicts with the packaging system? For example if some other package I install depends on Ruby, wouldn't the package manager install the (outdated) Ruby package and in the worst case overwrite my files?

So I think I need some way to tell Ubuntu that Ruby is in fact already installed?

8条回答
Evening l夕情丶
2楼-- · 2019-01-30 08:34

Looking through Synaptic it seems like you don't even have to deal with the Multiverse or third-party repositories. But since sudo apt-get install ruby currently installs an alias to ruby1.8, you should install ruby1.9 explicitly – manually or via the repositories – and create the alias ruby yourself.

You may want to put the binary in /usr/bin since that's where the distribution would put it anyway. Anywhere on your PATH is fine, though.

查看更多
贼婆χ
3楼-- · 2019-01-30 08:42

I got the Ruby specific info from this site. You can install most software in a different directory with the --prefix=/path switch. And it is common to install in /opt/ for everyone on your pc, or in $HOME if it is only for you.

For installing in /opt:

$ ./configure –prefix=/opt/ruby
$ make install

If you want to use the /opt installed ruby, edit you ~/.bashrc and add

export PATH=/opt/ruby/bin/:$PATH

If you don't want to have the custom Ruby build as default, you can add this to your ~/.bashrc instead of the former command

function setupruby {
     export PATH=/opt/ruby/bin/:$PATH
}
查看更多
啃猪蹄的小仙女
4楼-- · 2019-01-30 08:45

I created a launchpad ppa for ruby 1.9.2. Details in the links below

http://www.humbug.in/2010/launchpad-ppa-for-ruby-1-9-2-and-some-ruby-bindings/

sudo add-apt-repository ppa:pratikmsinha/ruby192+bindings
cd /etc/apt/sources.list.d/; sudo mv pratikmsinha-ruby192+bindings-lucid.list pratikmsinha-ruby192bindings-lucid.list
sudo aptitude update
sudo aptitude install ruby1.9.2
查看更多
孤傲高冷的网名
5楼-- · 2019-01-30 08:48

After running

sudo apt-get install ruby1.9.1-full

It's solution is to run the following command:

sudo update-alternatives --config ruby

Then you will get this output:

   There are 2 choices for the alternative ruby (providing /usr/bin/ruby).

     Selection    Path                Priority   Status
   ------------------------------------------------------------
   * 0            /usr/bin/ruby1.8     50        auto mode
     1            /usr/bin/ruby1.8     50        manual mode
     2            /usr/bin/ruby1.9.1   10        manual mode

   Press enter to keep the current choice[*], or type selection number: 2
   update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in    manual mode.
   $ ruby --version
   ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

Credit for this solution goes to person who answered https://askubuntu.com/questions/91693/how-do-you-uninstall-ruby-1-8-7-and-install-ruby-1-9-2 . Currently the ruby1.9.1 package is actually ruby 1.9.2.

查看更多
萌系小妹纸
6楼-- · 2019-01-30 08:50
sudo apt-get install ruby1.9.1-full

(http://www.ruby-lang.org/en/downloads/)

查看更多
唯我独甜
7楼-- · 2019-01-30 08:54

Here is a short and convenient way to install 1.9.1 and to make it default: http://michalf.me/blog:make-ruby-1-9-default-on-ubuntu-9-10-karmic-koala

查看更多
登录 后发表回答