zoukankan      html  css  js  c++  java
  • Install Ruby on Rails on Ubuntu 12.04 LTS

    1:Update package repository.

    1 sudo apt-get update

    2:Install git and Curl.

        Git:是一个简单,快速,高效的版本控制系统。(对于安装ruby on rails 环境没有关系,只是为了在以后的开发过程中进行版本控制的时候使用。)

        Curl:是一个根据web协议获取文件的简单命令行工具。   

    1 sudo apt-get install git
    2 sudo apt-get install curl

    3:Install RVM and Dependencies. 

    1 curl -L get.rvm.io | bash -s stable

         load the RVM: 

    1 source ~/.rvm/scripts/rvm

        Then install additional dependencies specified by the RVM

    1 sudo apt-get -y install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion

    4:Installing Javascript Runtime  参考:https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

    1 sudo apt-add-repository ppa:chris-lea/node.js
    2 sudo apt-get update
    3 sudo apt-get install nodejs

    5:Install Ruby

    1 rvm install 2.0.0

      Then select the Ruby version you want to use

    1 rvm use 2.0.0 --default

       在此处出现如下问题:

       

     steven@ubuntu:/usr$ rvm use 2.0.0 --default 
     RVM is not a function, selecting rubies with 'rvm use ...' will not work.  
     You need to change your terminal emulator preferences to allow login shell.
     Sometimes it is required to use `/bin/bash --login` as the command.
     Please visit https://rvm.io/integration/gnome-terminal/ for a example.

       然后执行如下命令: 

    1 /bin/bash --login

     解决此问题。

      You can check the version of ruby

    1 ruby -v 

      输出结果

     ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux]

    6:Install Rails

    1 gem install rails

    7:test 

     

    1 steven@ubuntu:/usr/RubyProject$ rails new demo
    2       create  
    3       create  README.rdoc
    4       create  Rakefile
    5       create  config.ru
    6       create  .gitignore
    ........

      

     1 steven@ubuntu:/usr/RubyProject/demo$ rails server
     2 => Booting WEBrick
     3 => Rails 4.0.0 application starting in development on http://0.0.0.0:3000
     4 => Run `rails server -h` for more startup options
     5 => Ctrl-C to shutdown server
     6 [2013-10-28 21:45:41] INFO  WEBrick 1.3.1
     7 [2013-10-28 21:45:41] INFO  ruby 2.0.0 (2013-06-27) [i686-linux]
     8 [2013-10-28 21:45:41] INFO  WEBrick::HTTPServer#start: pid=23094 port=3000
     9 
    10 
    11 Started GET "/" for 127.0.0.1 at 2013-10-28 21:46:26 -0700
    12 Processing by Rails::WelcomeController#index as HTML
    13   Rendered /home/steven/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/templates/rails/welcome/index.html.erb (2.7ms)
    14 Completed 200 OK in 41ms (Views: 20.2ms | Ac
    
    
  • 相关阅读:
    VS2010 自动跳过代码现象
    Reverse Linked List II 【纠结逆序!!!】
    Intersection of Two Linked Lists
    Linked List Cycle II
    Remove Nth Node From End of List 【另一个技巧,指针的指针】
    Swap Nodes in Pairs
    Merge Two Sorted Lists
    Remove Duplicates from Sorted List
    Linked List Cycle
    Dungeon Game
  • 原文地址:https://www.cnblogs.com/fantiantian/p/3392357.html
Copyright © 2011-2022 走看看