Rails簡單安裝步驟 on Ubuntu

最近想說來寫網站所以選擇了Ruby on Rails來寫,所以以下是我環境的步驟,因為怕自己忘了所以記錄下來。


OS  :   Ubuntu 10.04
gcc :   version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)

Ruby 1.9.3-p125


1.sudo apt-get install build-essential libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev libyaml-dev libzlib-ruby
2. wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
3. tar zxvf ruby-1.9.3-p125.tar.gz
4. cd ruby-1.9.3-p125
5. ./configure
6. make
7. make test
8. make install

P.S. make install will install ruby to ${DESTDIR}${prefix} directory



Rubygems 1.8.21

1. wget http://rubyforge.org/frs/download.php/75952/rubygems-1.8.21.tgz
2. tar zxvf rubygems-1.8.21.tgz
3. cd rubygems-1.8.21
4. ruby setup.rb
5. RubyGems installed the following executables: /usr/local/bin/gem


*****Problem***********************************************************************
* If you see this:
* /usr/local/lib/ruby/1.9.1/yaml.rb:56:in `':
* It seems your ruby installation is missing psych (for YAML utput).
* To eliminate this warning, please install libyaml and reinstall your ruby.
* Latest version currently installed. Aborting.
*
* First do this:
* sudo apt-get install libyaml-dev
* Then rebuild/reinstall your Ruby.
************************************************************************************

Rails 
1. gem update
2. gem install rails
Sqlite3
1. sudo apt-get install libsqlite3-dev
2. gem install sqlite3 -v '1.3.5'



*****Problem***********************************************************************

$> rake db:create
rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.


Solution :

1. gem install execjs
2. install node.js
wget http://nodejs.org/dist/v0.6.15/node-v0.6.15.tar.gz
tar zxfv  node-v0.6.15.tar.gz 
cd  node-v0.6.15
./configure
make
make install

************************************************************************************


留言

熱門文章