P. 1
install-rails-ubuntu

install-rails-ubuntu

4.0

|Views: 705|Likes:
Published by labanux
Tutorial installing Rails on Ubuntu
Tutorial installing Rails on Ubuntu

More info:

Published by: labanux on Sep 10, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/09/2014

pdf

text

original

Slicehost Articles: Ubuntu Hardy - Ruby on Rails

http://articles.slicehost.com/2008/4/30/ubuntu-hardy-r...

EBOOKS

LINUX DISTROS

SERVERS

FRAMEWORKS

SLICE ADMIN

OTHER

Ubuntu Hardy - Ruby on Rails
In the Ubuntu Hardy setup articles (page 1 and page 2) we secured, updated and personalised the install ready to add some working software. We also installed the build-essential package. Now we can go ahead and install Ruby on Rails.

Update
This articles has been updated to use the latest (at the time of writing) version of rubygems which is v1.2.0. This version of rubygems has finally fixed the memory issues seen on smaller Slices. You can now install, update and administer all your rubygems from within a 256Slice with no issues.

Process
The process will involve a mix of installation methods - the main ruby packages and dependencies will be installed using the 'aptitude' package manager but rubygems will be install from source. The reason for this is that it is important to get the latest and most stable version of rubygems onto the Slice and the easiest way to do that is by installing from source.

Ruby
Let's go ahead and install ruby. Note the install command shown below includes the sqlite3 db package. Rails version 2.0+ uses sqlite3 as its default database - you can, of course, use other databases and indeed, there will be articles specifically aimed at other databases. However, for now, we'll stick to the basics and get the main Ruby on Rails packages installed:

Symlink
We need to create some symlinks from the install to locations every programme would look:

1 of 9

08/15/2008 07:43 PM

Slicehost Articles: Ubuntu Hardy - Ruby on Rails

http://articles.slicehost.com/2008/4/30/ubuntu-hardy-r...

Version
Once done, we can have a look at the Ruby version:

Good, now we can move onto installing rubygems for our Rails installation.

Rubygems
As mentioned, we're going to install rubygems from source.

Source
Let's go ahead and download the source code into our sources directory. If you haven't got a sources directory, you can simply create one:

At the time of writing the latest rubygems version is v1.2.0. As mentioned above, this release fixes the memory issues found with earlier versions of rubygems. As normal, please check for the latest release on the rubygems homepage. Let's download v1.2.0:

Now unpack it and move into the newly created folder:

Now we can go through the simple process of compiling it and creating a symlink:

Version
Once done, we can check the gem version with a:

2 of 9

08/15/2008 07:43 PM

Slicehost Articles: Ubuntu Hardy - Ruby on Rails

http://articles.slicehost.com/2008/4/30/ubuntu-hardy-r...

Good.

Update
We need to do a quick update to rubygems:

Although nothing will change as we have installed the latest version, a '--system' update will ensure everything is the latest and greatest:

Rails
Continuing with the Rails installation, we can go ahead and install it:

Once completed, you can check what gems were installed with a:

Which gives the following (from a fresh Slice and no other gems installed):

Done.

sqlite3 test
Now we can do a simple test to see if the sqlite3 module is working:

If the result does not return 'true' the you may have missed a step.

3 of 9

08/15/2008 07:43 PM

Slicehost Articles: Ubuntu Hardy - Ruby on Rails

http://articles.slicehost.com/2008/4/30/ubuntu-hardy-r...

Postfix and subversion
Finally, we need to install postfix and subversion so we can 'check-out' plugins and send mail from our Rails applications:

Answer the postfix questions as you see fit but the defaults usually suffice for our purposes as we are only using it to send emails and not for receiving mail.

That's it
You now have a Ruby on Rails and postfix/subversion stack setup and ready to roll. Now you are ready to install the server of your choice whether that be Litespeed, Nginx or Apache. PickledOnion.

PeterG commented Thu May 01 20:48:40 UTC 2008 ago: I did sudo gem install rails without the following --no-rdoc --no-ri how do I now remove rdoc and ri

PickledOnion commented Fri May 02 09:20:30 UTC 2008 ago: Peter, You don't need to remove them if they are installed. When you add the --no-rdoc and --no-ri options to the install all it does is leave those parts out so the main rails gems can be installed on smaller Slices. Having them installed is a good thing so you don't need to worry. PickledOnion

Daniel Nogues commented Thu May 08 10:07:17 UTC 2008 ago: To install Rmagick I run these commands: sudo aptitude install libmagick9-dev ... sudo gem install rmagick To test the installation I run: irb irb(main):001:0>require 'RMagick' However, instead of true I get: LoadError: no such file to load -- RMagick Despite this error, I can run my site which requires rmagick. Why the error then?

4 of 9

08/15/2008 07:43 PM

Slicehost Articles: Ubuntu Hardy - Ruby on Rails

http://articles.slicehost.com/2008/4/30/ubuntu-hardy-r...

PickledOnion commented Thu May 08 10:09:21 UTC 2008 ago: Hi Daniel, I am not sure: this articles doesn't tackle installing rmagick so isn't related to what I have written here. You may be better off with a forum post. PickledOnion

giorgi commented Fri May 09 13:30:27 UTC 2008 ago: Hi Daniel, try this way: irb -r rubygems require 'RMagick' => true or irb require 'rubygems' => true require 'RMagick' => true

Randy commented Mon May 12 22:59:27 UTC 2008 ago: I was able to get rmagick to install on Ubuntu 8.0.4 using these instructions. https://bugs.launchpad.net/ubuntu/+source/librmagick-ruby/+bug/220811/comments/9

Peter commented Tue May 13 15:09:33 UTC 2008 ago: I got Rmagick going using these simple instructions: sudo apt-get install imagemagick sudo apt-get install libmagick9-dev sudo gem install rmagick From http://www.enrailed.net/2008/05/02/installing-imagemagick-rmagick-on-ubuntuhardy-heron/

Daniel Nogues commented Tue May 13 21:55:29 UTC 2008 ago: Thank you for all comments. Giorgi solution worked for me.

arthur commented Thu May 22 03:41:43 UTC 2008 ago: sudo aptitude install postfix subversion -y My installation of postfix and subversion fails after I am popped into a postfix configuration application that neither allows me to make a selection, nor exit gracefully. Am I using the wrong interface (Putty from a PC)? Any thoughts?

Joc commented Sat May 24 09:10:18 UTC 2008 ago: Hi, I have installed Hardy on my slice and set it up as per your instructions for the purpose of running rails apps with mod_rails. Everything is running great apart from the app (redmine) doesn't seem to be sending emails. I tried to look through the PostFix documentation but it's gibberish to the likes of me. Any ideas?

Melvin Ram commented Fri May 30 06:34:34 UTC 2008 ago:

5 of 9

08/15/2008 07:43 PM

Slicehost Articles: Ubuntu Hardy - Ruby on Rails

http://articles.slicehost.com/2008/4/30/ubuntu-hardy-r...

Arthur, you need to hit the tab button on your keyboard to select Ok and then it will let you make a selection.

Raymond Brigleb commented Sun Jun 22 16:13:47 UTC 2008 ago: The problem I keep having is this: user@host:~/sources$ sudo gem install rails --no-rdoc --no-ri Bulk updating Gem source index for: http://gems.rubyforge.org/ ERROR: could not find rails locally or in a repository I've worked around it by adding --source and the gems.rubyonrails.org URL, but then it complains about a lack of 'rake'...

Tadatoshi commented Sun Jun 22 16:51:03 UTC 2008 ago: RubyGems 1.2.0 is released yesterday. wget http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz

Ed Ruder commented Sun Jun 22 18:48:03 UTC 2008 ago: I'm having a problem on a 256M slice--after downloading and building Rubygems successfully, I run "sudo gem update" to update all gems installed to the latest. gem then runs its memory usage up to 265M or so, starts swapping like mad, and never completes (before I kill it a few hours later in frustration). The "gem update" goes so far as to output "Bulk updating Gem source index for: http://gems.rubyforge.org/", but nothing else. When I've run "gem update" on other boxes, it: a) starts displaying "." characters pretty quickly, as it downloads new gem entries, and b) never takes more than a few minutes to complete. I followed this tutorial, so I've got v1.1.0 and I did not do a "gem update --system". I'm going to try to re-install Rubygems (once I figure out how to uninstall it), but I don't have high expectations that that will solve my problem. Any thoughts? Thanks in advance! Ed

Ed Ruder commented Sun Jun 22 19:46:56 UTC 2008 ago: Thanks, Tadatoshi--I uninstalled Rubygems 1.1.0, installed 1.2.0, and had no problems!

Runar commented Sun Jun 22 20:15:00 UTC 2008 ago: @Ed I had the same problem on my 256 slice with the same installation versions. After deciding to upgrade to 512 (I think I'll need the extra juice anyway) the gem update process actually completes in a few minutes, but it still uses memory "like mad" (as you said) when it's running. I'm not sure if this is related, but I was unable to install passenger with RubyGems 1.1.0 as well.. Anyway, I just upgraded to RubyGems 1.2.0 following Tadatoshi's link above and everything seems to be working fine now (updating is done in a flash, "passenger" is being installed as we speak, even the rain outside has stopped ;-) I wouldn't be able to tell you precisely whether it was resizing my slice or upgrading RubyGems that did the trick, but I suggest you try upgrading RubyGems first as this is

6 of 9

08/15/2008 07:43 PM

Slicehost Articles: Ubuntu Hardy - Ruby on Rails

http://articles.slicehost.com/2008/4/30/ubuntu-hardy-r...

cheaper than resizing (although I'm not saying SliceHost is expensive!)

Raymond Brigleb commented Sun Jun 22 20:20:35 UTC 2008 ago: Indeed, going to Rubygems 1.2.0 did the trick for me as well. Thanks!

ryanb commented Fri Jul 04 17:49:13 UTC 2008 ago: Praise Rubygems 1.2. Worked like a charm. Thanks so much for writing and maintaining all of these articles!

Anita Kuno commented Fri Jul 04 18:25:01 UTC 2008 ago: I used these instructions on a new install of hardy on my laptop. My comments may or may not apply to servers. I had to add libyaml-ruby and libzlib-ruby prior to installing rubygems and add build essential before downloading gems in order to get things to work for me. Thanks for the great articles, Pickled Onion.

Chris W commented Thu Jul 10 17:47:02 UTC 2008 ago: This tutorial worked for me on my 256 MB slice, however, when I try and require 'sqlite3' from irb I get the following: no such file to load -- sqlite3. Any ideas on how to fix it? I know you state in the tutorials that I've done something wrong, but everything else matches up.

yudix commented Sat Jul 19 04:51:28 UTC 2008 ago: hi friend please help me.. I've download the latest version of rubygems and follow the instructions above but when I execute : sudo ruby setup.rb this error was appeared ./lib/rubygems/spec_fetcher.rb:1:in
require': no such file to load -- zlib (LoadError) from ./lib/rubygems/spec_fetcher.rb:1 from ./lib/rubygems /source_index.rb:10:in

require' from ./lib/rubygems/source_index.rb:10 from ./lib/rubygems.rb:767:in
require' from ./lib/rubygems.rb:767 from setup.rb:22:in

require' from setup.rb:22 please help me :(

Stuart commented Sat Jul 19 20:28:01 UTC 2008 ago: I found rake wasn't automatically installed with rails . So I needed to do an additional:

7 of 9

08/15/2008 07:43 PM

Slicehost Articles: Ubuntu Hardy - Ruby on Rails

http://articles.slicehost.com/2008/4/30/ubuntu-hardy-r...

Xiong commented Wed Jul 30 15:33:11 UTC 2008 ago: here is the solution to yudix's problem: http://lucaschan.com/weblog/2007/03 /22/installing-ruby-on-rails-on-centosredhat-4x/

Marc commented Tue Aug 05 01:54:40 UTC 2008 ago: Hello Group, How can I install an earlier version of rails?

Nick commented Thu Aug 07 21:13:33 UTC 2008 ago: Marc:
sudo gem install rails -v 1.2.6

replace 1.2.6 with the version you want

Want to comment?
Name:

Email Address: (not made public)

Website: (optional)

Comment: (use plain text or

syntax)

Post comment

8 of 9

08/15/2008 07:43 PM

Slicehost Articles: Ubuntu Hardy - Ruby on Rails

http://articles.slicehost.com/2008/4/30/ubuntu-hardy-r...

9 of 9

08/15/2008 07:43 PM

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->