2014年6月14日 星期六

Install RoR on Ubuntu 10.04 x86_64


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Install Ruby Using apt-get (Out of date)

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

1. Install Ruby interpreter

$sudo apt-get install ruby
$ruby -v (make sure the install sucess, ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux])
$sudo apt-get install ruby-dev
$sudo apt-get install libopenssl-ruby (Solution for "no such file to load -- net/https (LoadError)")
2. Install Ruby Package Management program
$sudo apt-get install rubygems
$gem -v (make sure the install sucess 1.3.5)

#speed up by setting no doc files download for each pakage install
$vim ~/.gemrc
insert the content "gem: --no-ri --no-rdoc"

3.Install Rails
$gem install rails

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Install Ruby Using RVM

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$\curl -sSL https://get.rvm.io | bash -s stable --ruby

$ source /home/stanley3/.rvm/scripts/rvm
(or add "source ~/.rvm/scripts/rvm" in the ~/.bashrc)
$ruby -v
(ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux])
$gem -v (2.2.2)

$rvm list known (查看可安裝的 Ruby 實作)

$rvm use ruby_version (can switch between the Ruby versions)

add the following line into .bashrc to load rvm

# This loads RVM into a shell session.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

Install Node.js

Since Rails 3.1, a JavaScript runtime has been needed for development on Ubuntu Linux. The JavaScript runtime is required to compile code for the Rails asset pipeline. For development on Ubuntu Linux it is best to install the Node.js server-side JavaScript environment.

Note: the following green key is from the output of $apt-get update
$sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B9316A7BC7917B12
$sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-get install nodejs
$ which node (expected output: /usr/bin/node)


Rails Installation


$gem install rails (the most recent stable release)
$rails -v

沒有留言:

張貼留言