• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Install Ruby on Rails on Ubuntu 12.04 LTS

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
CentOS7如何升级ruby版本发布时间:2022-07-14
下一篇:
ruby 知识点随笔发布时间:2022-07-14
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap