You are on page 1of 3

Ruby on Rails (Ubuntu 14.

04)

2015-09-13
zhangmengzhi2005@126.com

1.apt-get update 2.apt-get upgrade

$ sudo apt-get update


$ sudo apt-get upgrade

sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxsltdev autoconf libc6-dev

Ruby Ubuntu Ruby 1.9.3 Ruby


make taobao
$ sudo apt-get install ruby-full

ruby
$ git --version
$ ruby -v

rubygems.org Amazon S3
RubyGems taobao http://ruby.taobao.org/
$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l

ruby gem rails sqlite3 mysql mysql


$ sudo gem install sqlite3
$ sudo gem install rails

mysql mysql mysql mysql2


$ sudo apt-get install libmysqlclient-dev
$ sudo gem install mysql2

bundle gem
$ bundle config mirror.https://rubygems.org https://ruby.taobao.org

HelloWorld
$ mkdir sites
$ cd sites
$ rails new first_site
mysql
$ rails new first_site -d mysql

mysql
$ rails new first_site -d mysql

rails server
$ cd first_site
$ rails server
/usr/lib/ruby/gems/1.9.1/gems/execjs-2.6.0/lib/execjs/runtimes.rb:48:in `autodetect': Could not
find a JavaScript runtime. Seehttps://github.com/rails/execjs for a list of available runtimes.
(ExecJS::RuntimeUnavailable)
gem execjstherubyracer GemFile
gem

$ sudo gem install execjs


$ sudo gem install therubyracer

GemFile
gem 'execjs'
gem 'therubyracer'