• 5

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I have successfully installed Ruby 1.8.7 on Ubuntu 14.04 by downloading the package, building locally and installing. The command ruby -v, outputs Ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-Linux] as expected, this is the same output on another server running Ubuntu 12.04 where my application is working as expected.

The output of which ruby is /usr/local/bin/ruby on Ubuntu 14.04 and /usr/bin/ruby on Ubuntu 12.04. This gives me the impression that Ruby 1.8 (which is what my application needs) is installed.

However, when I try to install the rails gem: gem install rails (logged in as root; I also installed ruby as root), I get the following error:

The program 'gem' can be found in the following packages:
* ruby
* rubygems 
Try: apt-get install <selected package>

While running apt-get install ruby will fix this, it will install ruby 1.9.x which is not the version I need. I already have the required version installed as stated above.

Running apt-get install ruby1.8 which will work on Ubuntu 12.04, throws up an error on 14.04 because ruby1.8 is a bit outdated and has been removed from the official ubuntu 14.04 repositories, but my application is yet to be ported to the newer ruby versions.

So the question is, how do I install rubygems, specifically version 1.3.7 manually? Please don't suggest adding the Ubuntu 12.04 repositories back to 14.04, that's a terrible solution and can break the system moving forward. I also don't want to use RVM to accomplish this. I will prefer to manually configure the system to execute the gem commands under the currently installed 1.8 version located at /usr/local/bin/ruby.

Any help is appreciated.

Download the version you need from Rubygems.org. (1.3.7) Unpack the file and install to your Ruby $PREFIX;

ruby setup.rb --prefix=/usr/local

(That might actually be the default $PREFIX so specifying may be redundant..)

For more information see: Download RubyGems. Scroll down to this section;

If you don't have any RubyGems installed, there is still the pre-gem approach to getting software, doing it manually:

  • 1
Reply Report
      • 1
    • Thank you very much for your answer, Aaron. It's gotten me a step further. After running the command ruby setup.rb --prefix=/usr/local, gem -v doesn't work. However, running ruby setup.rb --prefix=/usr/local does it as gem -v now outputs 1.3.7. I can't explain why this happened. I tried to install rails with gem install rails and I got the following error:
    • /usr/local/lib/ruby1.8/timeout.rb:60: [BUG] Segmentation fault --linebreak-- ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-linux] -linebreak-- Aborted (core dumped)
      • 2
    • The problem was with the version of gcc/g++ used to compile the ruby package. I will post a detailed answer later. Thanks for the help, @Aaron Copley.

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags