13

I've spent a few hours this morning trying to setup Rails on a fresh instance of Ubuntu and I noticed that the process is incredibly more convoluted than on Windows. On Windows I go to rubyinstaller.org, run the executable (I was specifically interested in 1.9.2-p180) and then adjust the system path accordingly. Rails also requires no additional steps, I can clone a git repository and start cranking away.

On Ubuntu I had to install the RVM (which I could have done for Windows as well), install the prereqs that is listed, have the apt-get fail because a bunch of those packages were no longer available. I then finally ran rvm install only to find out that make wasn't going to work, so I had to manually comment out a bunch of dependencies on openssl from one of the .c files and rebuild it, then it finally installed. Rails was still far from done though, so I had to install another bunch of prerequisites, edit some extra file in the ruby source and execute it, and then I could finally get rails console to even start.

Is this pretty normal? Should I pretty much expect everything to take a couple of extra hours on ubuntu if I'm going to be developing Rails applications? I had to consult at least 3-4 guides for 11.04 and at least 5 different stack overflow posts to get the thing running, it seems like a very traumatic user experience to me.

3
  • 1
    Which guide where you following? Nov 5, 2011 at 22:36
  • It's always a hassle, but it's not too bad -- use RVM. IMHO rails should be removed from apt because it just causes versioning pain. (Or has the potential to.)
    – Thufir
    Aug 29, 2013 at 7:51
  • By comparison, installing Meteor.js is a breeze. Mar 12, 2015 at 7:17

2 Answers 2

4

Regarding why your experience was difficult I'm not sure that can be answered without more knowledge of what exactly you did. Regarding your question of "is this pretty normal?" I'm not sure it can be answered definitively but I can relay my experience in hope that it's helpful!

I've been developing on Rails with Ubuntu for over two years and can say that I never had to deal with broken packages or touch/rebuild code in any of the required packages. I completely reinstall with every release and my experience has been that it's easier to setup my Rails environment with each release (likely due to growing experience). In general, after a clean install of Ubuntu, I would say that it takes me under an hour (at times much less) to get my environment to the stage where it was before the clean install.

A couple days ago I followed the linked tutorial to completely re-setup my Rails development environment on 11.10. I previously was using package manager Ruby packages, which worked fine until I needed to run multiple versions of Ruby. Note that relying on the package manager packages for Ruby development is generally considered not the best way to develop Ruby on Ubuntu (see the linked article for details) but it has always worked fine for me in the past (when you only need one version of Ruby, Rails and Gems).

I think one thing that differentiates Linux from some other OS's is the ability to go about doing something in many different ways, while in some other OS's it may only be possible in one particular way. This is true of setting up your development environment (there are multiple ways to do it) and it's easy to see this leading to confusion and the need to consult different guides. From my limited experience, using the RVM bash install script in the linked article has been the easiest (that is, considering the major benefits of RVM, if RVM is of no benefit to you then there may be easier ways such as the package manager).

If you are more familiar with developing in Windows and are setting up Ubuntu for development for the first time I think it's reasonable to expect it to take longer simply because many things take longer the first time we learn to do them. If it ends up being "traumatic" then I just hope you can find the experience and knowledge that you gained valuable :)

http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

3
  • Thanks for that guide, I'll refer to it next time. I have to point out that it's somewhat silly, because first it warns you about never using apt-get, and then it proceeds to download a dozen or so ruby dependencies from it :| In any case, it's possible some of my pain was caused by having to specifically use 1.9.2-p180, future versions had Ubuntu-specific fixes that had to be addressed manually for that version. Great answer overall, gives me more confidence about sticking to the OS for future work. Nov 6, 2011 at 2:19
  • Here's the issue I was encountering, among many others: digitaldisorder.posterous.com/ruby-rvm-and-debian-sid-problems Nov 6, 2011 at 8:07
  • If you liked this answer, click "This answer is useful" in addition to thank who responded. This is also a demonstration of appreciation for those who took the trouble to research and answer the question. :) Dec 24, 2012 at 18:12
1

Just FYI: I just finished a complete RoR setup on Ubuntu 12.04 in five minutes.

  • sudo apt-get install git git-svn postgresql-9.1 libpq-dev ruby1.9.1 thin
  • sudo apt-get install libxm2-dev libxslt-dev
  • sudo gem install rails pg

libxm2-dev and libxslt-dev are only for Nokogiri (if you need it) and postgresql-9.1, libpq-dev and pg are only for PostgresSQL database (if you need it).

After that I was able to run bundle install in my Rails project directories to get all required Gems up and running and everything worked. No need for rvm and I never encountered broken packages. OK, so I wasn't interested in one specific build of Ruby, but then why were you?

Maybe you encountered one of the (unfortunately many) "Ruby-manual-hack-installation-du-jour" websites which tell you to scrap all package management systems and compile everything by yourself.

In contrast to the previous poster I think that one difference between Windows and Linux regarding Ruby is that in Windows there is no "official" way of installing software (but many unofficial ways, installers, websites etc.), but in Linux there is an "official" way (the distributor's package) and that usually works best but limits your choices somewhat.

And since Linux software tends to share much more (code, functionality, etc) as Windows software, and the distinction between the "OS" and the "applications" is much more blurry than in Windows, if you begin manually compiling and installing software in Linux expect to have to care much more about dependancies, libraries and so on than in Windows.

The best way is always to get the distributors packages (my experience).

10
  • the problem with this approach, 'sudo gem install rails pg' is that not all gems are available that way. Which is the appeal for RVM (which then has its own drawbacks).
    – Thufir
    Aug 27, 2013 at 19:43
  • Thufir, what gems are missing specifically? And why is this a problem (since you can always add more gem sources, using either gem or bundler)?
    – Jens
    Aug 29, 2013 at 7:43
  • correct me if wrong, but gem is a package manager akin to apt-get. What you're suggesting is to use yum alongside apt-get, so to speak. Just sounds like chaos to me, even if nothing goes wrong. (what if there's a versioning conflict between what apt-get has and what gem has?) There are many, many gems which are available via gem which are not in apt-get.
    – Thufir
    Aug 29, 2013 at 7:48
  • This is why I draw a line at 'rails'. I use apt-get to install everything including Ruby, then use gem to install Bundler, and bundler to install the required Rails version and all required gems for one specific Rails apps according to its Gemfile. To get started, I usually install the current Rails version via 'gem install' system-wide also (this doesn't hurt but isn't necessary). Yes, this gives you only one Ruby version to work with but that hasn't been a problem so far.
    – Jens
    Aug 30, 2013 at 12:34
  • 1
    Thufir, read my post again. I am not using apt for gems in rails apps. I use Bundler, with a separate gem set for each app.
    – Jens
    Aug 31, 2013 at 17:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .