How to Install Ruby 1.9.2 and Rails 3.0 on Ubuntu 10.10
For better or worse, Ubuntu has become one of the most popular Linux variants on which to deploy Ruby and Rails apps. It was used for 84% of the 2010 Rails Rumble projects, for example. Back in 2009, I wrote a guide to installing a Ruby 1.8 stack on Ubuntu 8.10 so it was only a matter of time before I had to tackle 10.10 (Maverick Meerkat) and Ruby 1.9.
Tip: If you're still on 1.8, check out The Ruby 1.9 Walkthrough, a mega screencast aimed at Ruby 1.8.7 developers who want to learn all about what's new, what's gone, and what's different in Ruby 1.9.2 and 1.9.3.
A few days ago I needed to produce a screencast on installing Ruby 1.9.2 on Ubuntu 10.10 for students in my forthcoming Ruby class to use. It was a pleasant surprise, then, to discover that Ryan Bigg had posted Ubuntu, Ruby, RVM, Rails and You on Christmas Day. It's a written walkthrough of installing Ruby 1.9.2 and Rails 3.0 on Ubuntu 10.10. So if you want a written walkthrough, read his post.
I still needed a screencast though so I compared Ryan's technique to mine, made some minor tweaks, and followed his general process when making the following screencast. So if you prefer screencasts to blog posts, you're in luck. The video is available on YouTube as "How to Install Ruby 1.9.2 and Rails 3.0 on Ubuntu 10.10" or if you're on the Web, you can see it embedded below:
Errata: 1) The aspect ratio for the video is wrong. I don't tend to do HD uploads so I learned a lesson there. This doesn't affect the content, though. 2) I call Ryan Bigg "Ryan Biggs" once or twice. Curiously this seems to be a common mistake on Ruby blogs..
December 29, 2010 at 5:20 am
I highly doubt that "how to install" is a subject needs blogged. Especially on rubyinside.
The ruby and rails site should have plenty of instructions already.
No more spam like this, PLEASE. Do something valuable instead.
December 29, 2010 at 9:37 am
Hello Peter, you have the perfect voice for screencasts and podcasts! I have one comment and a question:
* in Ubuntu there is a return in the bashrc. The RVM installation instructions specifically recommend changing it to an if-statement (in the troubleshooting-section of http://rvm.beginrescueend.com/rvm/install/).
* Would you mind to mention what tools you are using for capturing and processing the screencast in Ubuntu?
December 29, 2010 at 9:51 am
@Isaiah P: Thanks for sharing that with me, but have you visited the official Ruby or Rails sites? They don't cover this stuff. The official Ruby download/install page merely advises to install a packaged version of a non-current version of Ruby (1.9.1) - next to useless advice (the official Ruby site is a quagmire of mostly out of date content on most fronts). The Rails site has nothing specific about installing Ruby beyond linking to a .tar.gz of Ruby 1.8.7 and a page that 404s.
Criticism is all well and good here, but a modicum of research before posting charged statements would be most appreciated.
December 29, 2010 at 9:53 am
@Michael: Thanks! I'm cheating. It's Ubuntu running under VMware Fusion on OS X. I then use the excellent ScreenFlow to capture it and edit together the video. Next time it'll be done at the right aspect ratio too ;-)
December 29, 2010 at 10:38 am
Good post Peter.
December 29, 2010 at 12:54 pm
@Michael: You can use http://recordmydesktop.sourceforge.net/about.php
December 29, 2010 at 5:12 pm
I was thinking "What kind of Internet speed does he have?" until I looked at the clock lol
Now a serious question, does Ubuntu 10.10 comes with ruby 1.8.7 installed? I don't see it on the notes but on Fedora 14 it says it's a requirement for compiling ruby 1.9.2
December 30, 2010 at 12:27 am
First off: Thanks Peter for mentioning the post I wrote and doing a screencast about it. There's some who would prefer this method to a Wall Of Text.
Isaiah: I agree with you, the http://ruby-lang.org and http://rubyonrails.org sites *should* have instructions for installing Ruby and Rails already that cover the variety of operating systems out there. However, the problem is that there are so many different permutations out there for doing this and so there is no One True Source for installation documentation.
Personally, I would *love* to see guides on the official Ruby on Rails page for installing Ruby on Mac, Linux and Windows so that the barrier of entry is lowered even further. But who would volunteer their time to write and maintain these? That is another reason why they don't exist yet.
As for whether or not this is valuable, it's quite subjective.
For new people using Ubuntu and attempting to get into Ruby and Rails (as we see happen quite frequently over this part of the year), it is exceptionally valuable. There's people out there who know the best way to do this and have written posts and screencasts to take these new people through this process. Imagine, as a new person, attempting to do all of this yourself. You wouldn't know what "no such file to load -- zlib" meant!
For experienced people, it's probably not all that valuable. It's a very low-level install guide for a setup that they probably have. But not every single post should be written for the people with experience, as that does not provide a welcoming environment for newbies.
December 30, 2010 at 7:09 am
But who would volunteer their time to write and maintain these? That is another reason why they don't exist yet.
That's what the Rails Activism team was about. While both of those guys are still doing a lot of work along those lines, it no longer seems to be on the official Rails site and on their own domains instead (I can't blame them either - better to own your own work).
Working on non-code stuff for projects like Ruby and Rails is a thankless task at the best of times. Code gets celebrated in a way that documentation almost never does. The best documentation tends to come from sources that get to profit from it in other ways (see Envy Labs and their Rails for Zombies work).
For experienced people, it's probably not all that valuable.
Speak for yourself ;-) I've been setting up Ruby installs for six years and I still tend to Google to see what the deal is on operating systems I'm not familiar with! I'd love to meet some of the Übermensch types who never look anything up one day though, but I don't even think they exist..
December 30, 2010 at 3:16 pm
@myself, nvm, I see it now.
Pingback: How do I learn Ruby? I'm a complete novice who has never programmed before. - Quora
December 30, 2010 at 6:38 pm
Thanks for putting this one together! I think that info on more advanced setup and installation is a bit weak in the Rails community. It's usually the first chapter in an introductory tutorial and ignores irritating environmental issues (such as Windows environment variables and Linux package managers). I'd love to see more on building up production environments for Rails on Linux and how to coax them to gracefully scale. Also how to instrument them so you know when the wheels are about to come flying off. Development environments for Rails aren't as intimidating, at least on Mac and Linux platforms.
If only the poor Windows users could be saved...
Pingback: How to Install Ruby 1.9.2 and Rails 3.0 on Ubuntu 10.10 | My playground!
January 1, 2011 at 10:58 am
(Feel free to re-format this if I've ballsed it up)
*it no longer seems to be on the official Rails site and on their own domains instead (I can't blame them either - better to own your own work)*
Whilst it's a good thing to "own your own work", sharing *is* caring too! Also, having it on their own sites isn't as good as having it on the official site because it's fragmenting the information. Personally, I prefer there being one central location I can go to and learn everything I need to. A lot of the newbies who I've helped have brought this up too: all the good information seems to be on blogs that they happen to stumble across whilst doing a Google search.
Put it all in one easy-to-find location, or if that's too hard (or you want to "own your own work"), then at least link to it from the central location.
January 4, 2011 at 2:09 pm
Hi guys,
Want to ask dummy question,
Do i need Apache or Nginx as Web Server ? I didn't see Peter install it in screen-cast or, is it Ruby doesn't need Web Server at all?
And i also didnt see Peter install mysql.
Anyone please enlighten me, im very new with Ruby.
Thanks.
January 4, 2011 at 2:17 pm
Hi Azmir,
The video is just to show setting up a basic Ruby and Rails development environment organized around the defaults/basics. The Rails 3 app shown will be using SQLite 3 which is installed. You could then extend further to installing MySQL and so forth. Also, you'd be using "rails server" to run a development version of your app in this case, rather than a full-blown deployed version on Apache or Nginx (though you could do the latter with gem install passenger and then passenger-install-nginx, I think).
The topics you mention would be for a further video/tutorial, but you can get going using merely what's been covered so far.
Pingback: How to Install Ruby 1.9.2 and Rails 3.0 on Ubuntu 10.10 | Ruby On Rails ニュース
January 4, 2011 at 11:54 pm
@Peter: Thank you so much :D
January 9, 2011 at 3:15 am
Thanks a lot for the tutorial. It is very clear and works! I really appreciate it.
January 13, 2011 at 6:28 pm
@Isaiah P.
As a newbie to Ruby and Rails I can say that there are fewer starting guides than you think. Combine that with the fact that RVM, Ruby 1.9 and Rails 3 are much more different than previous versions and you have a lot of confused new developers. If it was not for a friend of mine that helped me with the install it would have taken me awhile to locate a tutorial that was both accurate and current. This post is not SPAM and I wish I had it a few months ago when I was getting started.
@Peter
Thank you for this screencast. It answered many questions for me.
January 16, 2011 at 2:33 am
I would like to see a opposite way:
How to deinstall ruby on osx?
Why? I like after this to install ruby fresh only with RVM?
Context: i got a iMac with osx and there was Ruby 1.8.?? was preinstalled. I do some updates and later i do some installations with RVM. Sometimes i got bad results in not having the right ruby version with rails
So how i get rid of all this settings and i an then follow the good RVM path?
January 17, 2011 at 11:36 pm
It's late and I have just found this posting on Installing a Ruby - Rails stack on Ubuntu 10.1 I find I am gratfull for as it at least clears up some misunderstandings I had and it looks uncomplicated
I have spent several hors trying to set up a local host development stack on a freshish ubuntu 64bit server box ,,without success I have read many postings from arious bloggs mostly offical and some refered to from the officaldom non succesful to get me to a 1.9 2 + RAILS 3.0.3 working set up, nearest was 1.8 7 and rails 3 .0
tomorrow i will work carefully through " Mr Radars " instructions, one line at a time and report back on what happens
Pingback: Rails Ready: Ruby and Rails on Ubuntu in One Line
January 31, 2011 at 2:39 am
First, cheers for posting this. As a newbie to Ubuntu, Ruby and Rails I learned a lot. I followed your directions without any trouble. However, I later decided that I want to install Radiant. I see on GitHub that Radiant is recommended to be run on Ruby 1.8.6 or 1.8.7. I understand that RVM enables having different versions of Ruby installed. Thus, I suspect that I can use RVM to install the appropriate version of Ruby and use that with Radiant. I see also on GitHub that Radiant ships with its own version of Rails.
As a newbie, this leaves me a little concerned about whether RVM will keep everything straight for the combination of Ruby, Rails and Radiant. I appreciate that you provided a warning about using the packaged Ruby provided with Ubuntu. Yet, for use with Radiant, it seems it may work better to go with the packaged version of Ruby. At least that's what the Radiant installation wiki at GitHub seems to imply.
https://github.com/radiant/radiant/wiki/Installation
Resolving this issue likely seems trivial to people like Isaiah P., who called your post spam. However, other newbies like me who just installed Ubuntu, might like to know how to work with the latest versions of Ruby and Rails, but also have an installation of Radiant.
I realize that you posted this a month ago, but perhaps you could provide some helpful insight.
January 31, 2011 at 3:39 am
Update:
After reviewing your posted video again and reading the general intro to RVM, I got a better understanding about how to proceed. Radiant had failed to install when I tried to install it using the command normally used to install Radiant,
$sudo gem install radiant
That generated an error message saying "sudo: gem: command not found" and left me wishing I had not installed Ruby and Rails using RVM.
I had thought that the gem command failed because I had the wrong version of Ruby installed. I now understand better from your video that when we use RVM, we do not need to use sudo, because RVM works through our local home directory.
Finally, I used the following sequence of commands to successfully install Radiant using the recommended version 1.8.7 of Ruby.
$rvm install 1.8.7
$rvm 1.8.7
$ruby -v (to see that it worked)
$rvm --default use 1.8.7
$gem install radiant (without the sudo)
This experience helped me to understand the value of using RVM. It also helped me to appreciate your posting even more. Well done! Thanks.
January 31, 2011 at 4:25 am
Update again:
Although the install of Radiant worked. When I tried running Radiant, I ran into an error that I think must relate to the install. I will post a further update later.
January 31, 2011 at 6:05 am
Update: 3rd
I did not resolve the issue yet. I used RVM to remove the installed 1.8.7 version of Ruby, together with its gemset. Then I tried staying within RVM and using the Radiant installation command for Ubuntu as directed at GitHub. I noticed that it differed from the general installation command. The one for Ubuntu included rails.
$gem install rails radiant
I think possibly my Ubuntu uses rails 3.0 for this. Anyway, I see the same behavior. The radiant command succeeds, but it doesn't work when I try to follow the full sequence given in the video of the Radiant installation at this URL,
http://radiant.s3.amazonaws.com/screencasts/01_install.mov
When executing the command,
$rake production db:bootstrap
it leads to the message:
(in /home/dave/radtest/radtest)
rake aborted!
no such file to load -- sqlite3
Yet, I see sqlite3 using either of these commands
$which sqlite3
$sqlite3 --help
Since I didn't try installing Radiant before I installed RVM. I don't know if it fails because of using RVM or not. I suppose the next step will involve removing RVM and trying to install Radiant without it.
Oh well. I still value what I learned about using RVM to install Ruby and Rails. I'm sure it will come in handy.
Pingback: Installing Ruby 1.9.2 on Ubuntu « Atypical Coder
Pingback: Instando Ruby 1.9.2 e Rails 3 no Ubuntu 10.10 | Bonomini Blog
Pingback: sam j levy » Great video tutorial: Installing Ruby on Rails on Ubuntu
Pingback: Preparación de un entorno Ruby on Rails en Ubuntu – Reloaded | malev's blog