William Matheson (nova_one) wrote,
William Matheson

Whacking Moles: Getting Ruby 2.0 and Rails 4.0.0 going on OpenSUSE 12.3

To do this, I started with a fresh OpenSUSE 12.3 virtual machine running under VMWare Workstation 9. Besides letting the updates install, the only significant thing I did was install VMWare Tools, which is another boatload of pain covered here. Of course, you could follow the rest of this on a native operating system. But doing things like this virtually means you can revert to a previous snapshot/state when (not if) you screw up. Anyway, I installed all the available updates too, after I installed VMWare Tools, and then I took a snapshot.

Some of this may apply to other Linux distros, so don't dismiss this straight away if you're not running OpenSUSE.

Also, I am not using RVM. It's one of those things that makes your life easier... by first introducing another level of complexity and general screwing-around. If you care about switching versions of Ruby and Rails and having different versions of Ruby and Rails for different projects, then I am sorry about your life something like RVM is the way to go. This is for the rest of us. (Actually, it's not so bad. I think I got lost because I was sudoing things that I shouldn't have been. Which, with RVM, is everything. See below if you want to just use RVM.)

OK, first you have to get Ruby. But the one you'd get in YaST is 1.9.3 or something. So go to software.opensuse.org, and look for "ruby":


Click on "Show Other Versions" under the green button at the bottom. Click "Show Unstable Packages" under OpenSUSE 12.3. Find the 2.0 version of Ruby from devel:languages:ruby, and click on "1 Click Install" and accept everything.

So now it's just "gem install rails", right? Ha-ha! No.

Go to YaST and get the package "ruby-devel". And there's more you'll need too: sqlite3 (a database engine) and nodejs (a JavaScript engine). Get all three packages.

Now you could do "gem install rails" but you will get weird errors related to the documentation. So do "gem install rdoc" first. Then do "gem install rails". Wait 2 to 45 minutes.

And now you can build your first test app! But for me even typing rails -v gets me "If 'rails' is not a typo..." What gives?

Well, as this video says at 29 minutes in, since I installed rails as root, the command for Rails is not 'rails' but 'rails2.0'. Say what?

Good news, though: if you don't want to type 'rails2.0' over and over, you don't have to. Add the following line to the end of the hidden .bashrc file in your home directory. You can use the "Control" drop-down in the Dolphin file manager, pick "Show Hidden Files", then open .bashrc in KWrite (under "Open With").

alias rails='rails2.0'

Note that this'll only apply to your home user, not to anything you do when you switch to the superuser inside a terminal session.

At last, you're ready to Get Started!


Update: New problems emerged, so I finally did it the RVM way. Wasn't hard at all. Don't use sudo.

\curl -L https://get.rvm.io | bash

Then /bin/bash --login

Then the install and use stuff:

rvm install 2.0.0
rvm use 2.0.0
gem install rails

I presently have to type the binbashlogin and rvmuse parts every time I roll up my sleeves, but it works, it finally blessedly works. I mean, works again. Sigh.

Update Update: OK, you can set a default ruby to use like this:

rvm alias create default 2.0.0
Tags: opensuse, programming, rails, ruby, ruby on rails
  • Post a new comment


    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.