Chinaunix首页 | 论坛 | 博客
  • 博客访问: 233465
  • 博文数量: 59
  • 博客积分: 2661
  • 博客等级: 少校
  • 技术积分: 732
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-24 11:54
文章分类

全部博文(59)

文章存档

2013年(1)

2012年(8)

2011年(17)

2010年(33)

我的朋友

分类:

2010-07-29 14:24:36

 

In the Ubuntu Hardy setup articles ( and ) 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:

sudo aptitude install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby sqlite3 libsqlite3-ruby1.8

Symlink

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

sudo ln -s /usr/bin/ruby1.8 /usr/bin/ruby
sudo ln -s /usr/bin/ri1.8 /usr/bin/ri
sudo ln -s /usr/bin/rdoc1.8 /usr/bin/rdoc
sudo ln -s /usr/bin/irb1.8 /usr/bin/irb

Version

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

ruby -v
...
ruby 1.8.6 (2007-09-24 patchlevel 111) [x86_64-linux]

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:

mkdir ~/sources
cd ~/sources

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 .

Let's download v1.2.0:

wget 

Now unpack it and move into the newly created folder:

tar xzvf rubygems-1.2.0.tgz
cd  rubygems-1.2.0

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

sudo ruby setup.rb
...
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

Version

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

gem -v
...
1.2.0

Good.

Update

We need to do a quick update to rubygems:

sudo gem update

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

sudo gem update --system

Rails

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

sudo gem install rails

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

sudo gem list

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

*** LOCAL GEMS ***

actionmailer (2.1.0)
actionpack (2.1.0)
activerecord (2.1.0)
activeresource (2.1.0)
activesupport (2.1.0)
rails (2.1.0)
rake (0.8.1)

Done.

sqlite3 test

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

irb 
#irb(main):001:0>
require 'sqlite3'
=> true
#irb(main):002:0> exit

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

Postfix and subversion

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

sudo aptitude install postfix subversion -y

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.

阅读(518) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~