10 ms·
Ubuntu, Ruby, RVM, Rails, and You
- aberkowitz 16y ago> Under no circumstance should you install Ruby, Rubygems or any Ruby-related packages from apt-get I really wish the RoR book I was reading had told me that before I spent multiple hours trying to properly setup Rails.
- mapleoin 16y agoI'm very skeptical about this sort of advice, especially when it is motivated by We do Ruby, we know what’s best. Trust us.
- aberkowitz 16y agoI'm not sure where your skepticism is coming from, but I can assure you that I would have saved countless hours had I begun with a more current version of Rubygems and Ruby.
- deleted 16y ago[deleted]
- bricestacey 16y agoYet it's very strong advice.
- eccp 16y agoI think the same way, I would expect something like the following from a book author: "Since we're going to install Rails 3 which is newer than the version packaged/available in Ubuntu 10.10, we will do a separate install which is not compatible with the package manager, etc."
- halostatue 16y agoDespite much effort from some Debian maintainers, packaged Ruby remains hopelessly broken on those systems. Some of the breakage is deliberate because Debian's policies.
- samdk 16y agoIt really is very good advice, and installing Ruby/RubyGems through the package manager is almost never a good idea (especially on Debian-based distros) for several reasons. Ruby is a language that moves very, very quickly. On "cutting-edge" distros like Fedora and Arch it's not nearly as much of an issue, but not having to wait to get new language versions is very convenient. More importantly, though, is that the version of RubyGems distributed through Debian's (and Debian descendents like Ubuntu's) package repositories is crippled. Gem normally includes a very important command called 'gem update --system' that lets you upgrade gem itself. The opinion of the Debian package maintainers is that all upgrades should be handled through the package manager. This makes sense from a system administration perspective, but it's a huge pain when you're trying to do Ruby development, because important gems like Rails often require a fairly new version of RubyGems. (And Ruby libraries get updated much more frequently than the language itself.) For the above reasons, doing Ruby stuff on Debian/Ubuntu without using RVM is a huge pain. Even if you manage to get everything working, an update to gem or something else may break it a week later. While RVM isn't as essential on other distros (like Fedora, which I did Ruby dev on for a long time before learning about RVM), it's still massively convenient. You can ensure that you have a consistent development environment across computers and operating systems (which I find is especially useful when deploying to a server, since I use different Linux distros for everyday use than I do for hosting things), you can easily switch between Ruby versions (I have one project still on 1.8.7, and I do the rest of my stuff on 1.9.x--switching between them is as simple as typing rvm $VERSION), and it deals with all of the icky bits of managing multiple versions of gems (to go with your multiple versions of Ruby) for you. RVM is awesome, and makes lots of the headaches that surround Ruby development go away. Use it.
- zppx 16y ago> "Ruby is a language that moves very, very quickly." and later > "This makes sense from a system administration perspective, but it's a huge pain when you're trying to do Ruby development" It's a developer's world. Having been a Rails programmer working on some internals projects in the company that I used to work, I like both Ruby and Rails. But now I'm' working as an operations guy (ie, a sysadmin) in a new company, we came short of adopting redmine and maybe opening the road for more ruby and rails software to be used, we already use puppet and so every sysadmin now knows ruby, so it would be good to include some more ruby to internal use, but it was just a pain in the ass to maintain the rails-based infrastructure, in both Debian and CentOS, the distributions that we use. Fedora and Arch is not used in the servers, so it cannot be used. This is old, and just touches one aspect of the problems (shared hosting, which I do not deal with), but it does have some good rants, specially the point 2 of "How it could be better": http://blog.dreamhost.com/2008/01/07/how-ruby-on-rails-could-be-much-better/ http://blog.dreamhost.com/2008/01/07/how-ruby-on-rails-could...
- tjogin 16y agoYeah, why would Rubyists know anything about setting up Ruby?
- SkyMarshal 16y agoIsn't installing Ruby from apt-get ok, since RVM just manages that as the 'system' ruby alongside all the other Ruby's RVM can install and manage? Not sure about gems or other packages though.
- telemachos 16y agoWhat the blogger probably meant was "don't use Ubuntu's Ruby" for any serious development (since it's out of date and crippled). As far as it goes, you can certainly install Ruby with apt-get or aptitude, but I think the response then would be "Why bother?", assuming you're not going to use it anyhow. One other thing: rvm doesn't really "manage" the system Ruby. You can issue the command 'rvm system', but what that really does is remove the rvm directories from your $PATH. rvm itself never touches the Ruby interpreter or libraries installed via APT.
- minouye 16y agoI also found the following tutorial invaluable for setting up rails on 10.04 (via RailsTutorial.org) http://toranbillups.com/blog/archive/2010/09/01/How-to-install-Rails-3.0-and-Ruby-1.9.2-on-Ubuntu http://toranbillups.com/blog/archive/2010/09/01/How-to-insta...
- Sapient 16y agoThis is a good start for setting up rails on your development box, but when it comes to deploying it to a clean server, just following these instructions will give you a headache fast. This tutorial, and some others on this guys blog helped me do just that. http://kris.me.uk/2010/08/30/rails3-hosting-all-in-one.html http://kris.me.uk/2010/08/30/rails3-hosting-all-in-one.html
- ryanbigg 16y agoCould you explain how these instructions would give you a "headache fast"?
- Sapient 16y agoI see you have added a section about the required libs in the post, it should give no problems now. If you could include a bit about installing rvm system wide and maybe setting up passenger, it would have saved me a lot of time and grief a week ago.
- fossuser 16y agoEdit: After recursively chowning the .gem folder in my home directory to my user it worked. I spent a good amount of time trying to get this to work a few days ago, but had issues with rvm. Thought this post might help, but in a fresh 10.10 install if rvm is used when trying gem install rails I get the following : While executing gem ... (Errno::EACCES) Permission denied It shouldn't be denied though since it's in the home directory. The only way I could get an up to date ruby and rails installed was by removing rvm (rvm implode) and manually installing 1.9.2 and then following the update-alternatives instructions located here: http://ubuntuforums.org/showthread.php?p=10274200#post10274200 http://ubuntuforums.org/showthread.php?p=10274200#post102742... Is anybody else successfully accomplishing it the way this blog suggests? The internet is relatively sparse with up to date instructions for installing rails without problems on Ubuntu, it makes me miss the rolling release model of arch where everything just worked instantly.
- Sapient 16y ago
- eccp 16y agoActually, this is one of the long lasting issues with RoR: most people want to try it on a recent version, but Linux distros try to package stable releases instead. You shouldn't blame the distros for not having the absolute bleeding edge version. If really need the absolute latest version of Rails go on, have a separate install compiled from source, but there's no need to be rude with the packagers. I'm trying to learn Rails 3 and I found that JRuby works really fine with Rails 3, and using Warbler gives me nices WAR files to deploy on Tomcat, and I don't mess my default Ruby install.
- FooBarWidget 16y agoRails 3.0 is hardly bleeding edge. People use it in production.
- zppx 16y agoIt's for the majority of sysadmins that I know...
- steveklabnik 16y agoAs a compliment to my sibling's Rails comment, they're still shipping Ruby 1.8 as well, which hasn't been the main version of Ruby since January of 2009.
- ryanbigg 16y agoRuby 1.9.2 and Rails 3.0.3 are now considered stable by what appears to be everyone but the packagers. apt installs Ruby using a non-standard configuration too, when you do `apt-get install ruby1.8`, the executable is `ruby1.8`. Nobody in their right minds these days would install it with the `1.8` suffix. Ruby version management is best taken care of with RVM, as that's better built for it than a general package manager such as apt.
- ryanbigg 16y agoAdditionally, apt also packages "ruby-1.9.1" which actually installs Ruby 1.9.2. More evidence that apt is fundamentally broken when it comes to Ruby package management.
- mark_l_watson 16y agoReally good advice about not installing Ruby using apt-get. I forgot and did this a few weeks ago and dropped back to building from source.
- viraptor 16y agoIt's surprising that with all that talk about how bad packaged ruby is, not many seem to be pushing for automation to fix this. CPAN situation is very similar to gems (apart from the speed of changes in the interpreters). Some perl modules are missing, some outdated, but `dh-make-perl --cpan Module::You::Want` brings you all you need almost every single time. There seems to be an old dh-make-ruby (dead ~2006), dh-make-gem seems to be in the works (early 0.3.0 version available). Even upstream doesn't seem to be interested that much. On the download page, there's: For example, on Debian or Ubuntu apt-get provides an easy and elegant solution: % sudo apt-get install ruby1.9.1-full It definitely is confusing / silly to the outside observer... There's rvm - how hard is it to automate package building reusing it's elements? If it's not - why isn't it done? If it is - why all the packages hate, instead of pressuring upstream to improve the situation?
- rohitarondekar 16y agoAbsolutely agree. Whenever you google for installing ruby on Ubuntu you get the package version. Also Linode's guides use the packages. RVM offers a nearly effortless solution to manage your rubies - and more importantly manage gemsets which is an awesome feature. Although I had to install more dependencies to get everything to work. I don't remember exactly what problems I had without some of the dependencies, but I had compiled them here: http://rohitarondekar.com/articles/installing-rails3-beta3-on-ubuntu-using-rvm http://rohitarondekar.com/articles/installing-rails3-beta3-o...
- deleted 16y ago[deleted]
- ryanbigg 16y agoHonestly, the setup isn't that complicated that it should take anybody who's following any kind of instructions any time at all. Even compiling from source is pretty straight forward... although there's a couple of "mystery packages" like libreadline that you have to have installed to get things like irb working. That's why there's guides out there to show you how to do this. My final run through of just copy-pasting the examples in the post took all of 20 minutes and most of that time was spent waiting for Ruby to compile.
- deleted 16y ago[deleted]
- cherring 16y agoWithout some kind of indication to the security issue doesn't this comment really just amount to FUD? Can you enlighten us to the security issue referred to?
- binbasti 16y agoBasing your choice of the framework and even the language for your project on some error during what seems to be your first installation ever of that specific stack is really not a good idea. Installation and deployment are well solved problems with both technologies, and there are so many other factors to consider depending on what you're building.
- skillachie 16y agoI just did this setup a few days ago, only problem is rvm did not work with root, still uses default ruby, however i suspect i need to configure the PATH In addition I used Passenger as well