About Ruby on Rails

Ruby on Rails is an application stack that provides developers with a framework to quickly create a variety of web applications. Ruby on Rails does take a little while to install on a virtual server, but luckily there are a lot of helpful tools to make this process as easy as possible. You can run this tutorial on your droplet as a user with sudo privileges. You can check out how to set that up here: Ubuntu Server Setup

Step One— Install Ruby with RVM

Before we do anything else, we should run a quick update to make sure that all of the packages we download to our VPS are up to date:

sudo apt-get update

Once that's done, we can start installing RVM, Ruby Version Manager. This is a great program that lets you use several versions of Ruby on one server; however, in this case, we will just use it to install the latest version of Ruby on the droplet.

If you do not have curl on your system, you can start by installing it:

sudo apt-get install curl

To install RVM, open terminal and type in this command:

\curl -L https://get.rvm.io | bash -s stable

After it is done installing, load RVM. You may first need to exit out of your shell session and start up a new one.

source ~/.rvm/scripts/rvm

In order to work, RVM has some of its own dependancies that need to be installed. To automatically install them:

rvm requirements

You may need to enter your root password to allow the installation of these dependencies.

On occasion the zlib package may be reported as missing. The RVM page describes the issue and the solution in greater detail here.

Step Two—Install Ruby

Once you are using RVM, installing Ruby is easy.

rvm install ruby

The latest ruby is now installed. However, since we accessed it through a program that has a variety of Ruby versions, we need to tell the system to use the version we just installed by default.

rvm use ruby --default

Step Three—Install RubyGems

The next step makes sure that we have all the required components of Ruby on Rails. We can continue to use RVM to install gems; type this line into terminal.

 rvm rubygems current

Step Four—Install Rails

Once everything is set up, it is time to install Rails. To start, open terminal and type in:

gem install rails

This process may take a while, be patient with it. Once it finishes you will have Ruby on Rails installed on your droplet.

-------------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------------------

在ubuntu下安装rails时,我尝试了以下命令:

sudo apt-get install ruby

sudo gem install rails

结果在安装rails时得到了如下错误

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:13:in `<main>'

Gem files will remain installed in /var/lib/gems/1.9.1/gems/atomic-1.1.13 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/atomic-1.1.13/ext/gem_make.out

上网搜索了一番,找到原因说是没有安装 build-essential,

linux操作系统上面开发程序, 光有了gcc 是不行的
它还需要一个   build-essential软件包
作用是提供编译程序必须软件包的列表信息

也就是说 编译程序有了这个软件包
它才知道 头文件在哪 才知道库函数在哪
还会下载依赖的软件包   最后才组成一个开发环境
当然 build-essential包 安装时 需要的依赖包 有些你用不上

没有管用,安装rails依然出现上面错误

由于 mkmf.rb 并没有包含在 Debian 的 Ruby 包里面,需要安装相应的 dev 包,所以执行sudo apt-get install ruby-dev 然后安装rails,成功安装!

-- source to network.

最新文章

  1. ASCII字符集中的功能/控制字符
  2. linux-rpm
  3. 黑马程序员_ Objective-c 面向对象笔记详解
  4. [delphi]极域学生端解除键盘鼠标锁定退出全屏广播-强制窗口化-源代码
  5. TSQL order by 子句中排序列的多种写法
  6. Jenkins的maven工程打包的时候怎么指定不同环境的配置文件
  7. matlab文件操作及读txt文件(fopen,fseek,fread,fclose)
  8. mysql概要(七)表字段管理,字段的增删改
  9. html5实现饼图和线图-我们到底能走多远系列(34)
  10. 九度OJ 城际公路网 -- 图论
  11. 通过查看mysql 配置参数、状态来优化你的mysql
  12. (简单) POJ 1562 Oil Deposits,BFS。
  13. smarty模板基础1
  14. Mysql高性能笔记(一):Schema与数据类型优化
  15. 福大软工 &#183; 第十二次作业 - Beta答辩总结
  16. css 样式控制文本过长实现省略号
  17. Codeforces-gym-101020 problem C. Rectangles
  18. d3 .each()
  19. 如何设计一个异步Web服务——任务调度
  20. 【Alpha】第五次Scrum meeting

热门文章

  1. 【原创】Android开发使用华为手机调试logcat没有应用输出信息
  2. [转] HTML5终极备忘大全(图片版+文字版)---张鑫旭
  3. 【转】JavaScript闭包
  4. Rewrite Path in Asp.Net MVC Project
  5. uva 812 Trade on Verweggistan
  6. Wordpress 网站搭建及性能监控方法详解!
  7. POJ 2528 Mayor&#39;s posters(线段树)
  8. EasyUI datagrid数据表格的函数getData返回来的是什么
  9. poj1436 Horizontally Visible Segments
  10. 内存卡的class是什么意思 内存卡class的5个等级