`
hqman
  • 浏览: 361786 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论
阅读更多
This is a new guide for installing Rails on Ubuntu. You can find the old instructions under RailsOnUbuntuDebianTestingAndUnstable.

A French guide for Edgy can be found here (an Edgy guide in English is linked below) : Ubuntu Edgy Eft – Installer RubyOnRails & Eclipse – RadRails
The quickest way

(Not recommended, see the Community Ubuntu Documentation for more info. These instructions need to be updated.)

Simply copy and paste the following into a terminal:

$ sudo apt-get install ruby rubygems irb ri rdoc ruby1.8-dev build-essential
$ sudo gem install rails --include-dependencies
$ export PATH=$PATH:/var/lib/gems/1.8/bin


A brief word about Rubygems

Since Rubygems has the potential to disrupt package management it has only recently been packaged for Debian and, by extension, Ubuntu.

For more information please read Debian’s position on Rubygems
Versions and Availability

Rails has been packaged for Ubuntu since release 5.10 (Breezy Badger) – the following table lists the versions of Rails and Ruby available in each release of Ubuntu:
  5.04 (Hoary) 5.10(Breezy) 6.06 LTS (Dapper) 6.10 (Edgy) 7.04 (Fiesty)
rails 0.13.11 0.13.1 1.1.2 1.1.6 1.2.1
ruby 1.8.12 1.8.2 1.8.23 1.8.23 1.8.23
ruby1.8 1.8.12 1.8.2 1.8.4 1.8.4 1.8.5
rubygems n/a n/a n/a n/a 0.9.0

   1. Only available through backports
   2. 1.8.2 was available through backports
   3. This is version reported by http://packages.ubuntu.com but as the package depends on ruby1.8 you actually get the version below

Since Rails is available as a package, Rubygems is no longer required to install it. However as the current version of Rails in Feisty is a couple of versions behind, and Rubygems provides far more than just Rails, two ways of installing Rails are demonstrated.

For the time being all instructions are tested on Ubuntu 7.04 (Feisty Fawn), although they may work for previous releases.
Out of Scope

This guide currently only covers installing Rails on Ubuntu. Installation of database servers, web servers, gems (besides Rails and it’s dependencies) are not covered.
The ‘proper’ way

This method of installing Rails uses only the official packages. Simply run:

$ sudo apt-get install rails

This will install the stable (from the distributions point-of-view) versions (see table above for specifics) of Rails and Ruby. you can confirm the version with:

$ ruby -v

The only package not installed using this method is irb which simply provides a softlink to irb1.8 in /usr/bin. You could create this link yourself, or just install the irb package via apt-get.
The recommended way

(Not really recommended, see the Community Ubuntu Documentation for more info. These instructions need to be updated.)

This method installs Ruby and Rubygems via packages, and Rails via Rubygems. This is much more flexible arrangement than the ‘proper’ method above. It does however mean that you can confuse apt by installing a Ruby library through gem instead of apt.
Ruby

Install Ruby and RubyGems with the following:

$ sudo apt-get install ruby rubygems irb ri rdoc ruby1.8-dev build-essential

Note: ruby1.8-dev and build-essential are not required to install either Rubygems, Rails or it’s dependencies, but they do make life much easier if you’re going to be using other gems. So we’ll just get them out of the way now.
Rails

Now you can install Rails via Rubygems:

$ sudo gem install rails --include-dependencies

Now add /var/lib/gems/1.8/bin/ to your path, and you’re done!
Database server and driver

Now you just need a database server (or SQLite) as well as a Ruby-driver for it. For the vast majority MySQL should do:

$ sudo apt-get install libmysql-ruby mysql-server


(You can leave out the “mysql-server” if you’ve already got the MySQL server installed and only need the driver.)

If you’re not satisfied with MySQL, and you can’t figure out which apt packages to install for your preferred database, then see DatabaseDrivers for details on how to install the correct drivers for your environment via gem (not available if you installed Rails “The ‘proper’ way”).

TO-DO: Provide details on installing native database drivers other than MySQL via apt.
SSL Support

If you’re looking to use net/https then you’ll need to install the lib for openssl:

$ sudo apt-get install libopenssl-ruby

ImageMagick Support

If you need RMagick support for your web app, you are going to need to install ImageMagick and RMagick.

sudo apt-get install imagemagick
dpkg -l | grep magick

This will install the most current imagemagick and then list the ‘magick’ packages installed. Look for what version of libmagick got installed and make sure you specify THAT version number when you install libmagick-dev.

sudo apt-get install libmagick9-dev
sudo gem install rmagick

After a lengthy build process, you’re ready to edit images in ruby!
分享到:
评论

相关推荐

    RailsOnUbuntu:Ubuntu用户的Rails好东西!

    RailsOnUbuntu 对于使用Ubuntu的Ruby on Rails开发人员的一些有用的脚本/好东西! 1. Rails安装程序 为了在Ubuntu 12.04 LTS(精确的穿山甲)/ 12.10(定量Quetzal)上设置Rails,我还为初学者编写了逐步指南,请...

    TheRailsDeploy:像老板一样部署 Rails 应用

    TheRails部署......Applications > Ruby on Rails on Ubuntu 14.04 (Nginx + Unicorn)查看你的邮件 Your new droplet has been created!You can access it using the following credentials:IP Addres

    ubuntu下安装ruby on rails

    ### Ubuntu 下 Ruby on Rails 的安装与配置 #### 一、Ruby on Rails 的安装步骤 **1.1 系统环境准备** 确保您的 Ubuntu 系统已更新至最新状态。这一步很重要,因为新版本通常会修复旧版本中存在的问题,包括安全...

    chef-rails, 厨房设置一个可以与 Nginx 和 Rails 一起滚动的Ubuntu服务器.zip

    chef-rails, 厨房设置一个可以与 Nginx 和 Rails 一起滚动的Ubuntu服务器 主厨 rails安装一个准备为 Ruby on Rails 栈准备的Ubuntu服务器:NginxPostgreSQLRedisMemcached带RVM的rubyPhusion乘客独立要求Ubuntu ...

    Ruby on Rails安装包全集(Linux)

    9. **Install Ruby Rails Lighttpd MySQL on Ubuntu or FreeBSD - Huihoo Wiki - Open Source Wiki_files**: 这可能是上述文档的辅助文件,可能包含图片或其他资源,有助于理解安装过程。 安装Ruby on Rails的过程...

    免费Ubuntu系统ruby on rails安装【保姆级教程】

    在本篇【保姆级教程】中,我们将详细探讨如何在Ubuntu系统上安装Ruby on Rails环境。首先,确保你已经下载了Ubuntu桌面版,这可以从官方链接(https://cn.ubuntu.com/download)获取。Ruby on Rails是流行的开源Web...

    Ruby On Rails教程

    ### Ruby on Rails 教程知识点概述 #### 一、引言 - **敏捷开发与Rails:** 本书《Ruby on Rails教程》强调了Rails作为敏捷开发框架的优势。它旨在帮助开发者快速构建高质量的Web应用程序。 - **作者团队:** 本书...

    Ubuntu 11.04安装Ruby on rails 连接MySQL数据库.pdf

    ### Ubuntu 11.04下Ruby on Rails与MySQL数据库集成指南 #### 一、安装与配置MySQL数据库 在Ubuntu 11.04环境中,安装MySQL数据库是部署Ruby on Rails应用的重要步骤之一。首先,通过打开终端并执行以下命令进行...

    怎样在Ubuntu系统下配置Ruby On Rails开发环境.docx

    Ubuntu 下 Ruby On Rails 开发环境配置指南 在 Linux 操作系统中使用 Ruby On Rails 能够对 web 应用程序的维护和开发变得更加便利,让开发人员能更加专注于系统的逻辑结构。在使用前需先配置 Ruby On Rails 的开发...

    ruby on rails安装

    Ruby on Rails,简称Rails,是一款基于Ruby语言的开源Web应用框架,它遵循MVC(Model-View-Controller)架构模式,旨在使Web开发更简洁、高效。Rails强调“约定优于配置”,大大减少了开发者需要编写的配置代码。在...

    Rails3常用命令行命令

    Rails3 是 Ruby on Rails 框架的一个版本,它提供了一系列强大的命令行工具,使得开发者可以快速地构建和管理Web应用。在本文中,我们将深入探讨Rails3中的常用命令,帮助你更高效地进行开发工作。 首先,新建一个...

    ruby on rails操作流程.pdf

    在本文中,我们将深入探讨在Ubuntu环境下搭建Ruby on Rails开发环境的详细步骤。 首先,我们需要在VirtualBox上安装Ubuntu操作系统。在这个过程中可能会遇到一些常见问题,例如终端软件的使用。确保使用启动器打开...

    基于Ubuntu Nginx Mongrel Mysql部署rails monit-5.0

    5. **Rails**:Ruby on Rails(简称Rails)是一个开源Web应用框架,遵循MVC(模型-视图-控制器)架构模式。Rails简化了开发流程,提供了丰富的库和工具,使得快速开发高效Web应用成为可能。 6. **Monit**:Monit是...

    [Rails 5.x] 安装设定03. [跨平台] 于VirtualBox的Ubuntu安装Ruby on Rails 开发环境

    [Ubuntu][Linux][教學][Rails_5.x]__安裝設定#03.__[跨平台]_於VirtualBox的Ubun

    Ubuntu上配置Ruby on Rails框架及RubyMine IDE开发环境

    在Ubuntu上配置Ruby on Rails框架和RubyMine IDE开发环境是一个重要的步骤,对于想要在Linux环境下进行Web开发的程序员来说,这是必备的知识。Ruby on Rails是一个强大的全栈Web框架,它基于Ruby语言,大大简化了Web...

    quora, Quora.com 与 Ruby on Rails ( 不再维护) 类似.zip

    quora, Quora.com 与 Ruby on Rails ( 不再维护) 类似 Quora克隆在 Rails 上的ruby 中写入。要求首先安装软件Linux ( 推荐 Ubuntu 10.10 ) 。ruby 1.9.2 ( 不支持 1.9.1或者 1.8 )MongoDB 1.8Redis 2.

    在 Ubuntu 12.04 Server 上安装部署 Ruby on Rails 应用

    本教程适合新手初次部署 Rails 应用; 本文测试通过环境 Ubuntu 12.04 Server, 服务器安装测试于 Linode VPS (Ubuntu 12.04 LTS (GNU/Linux 3.4.2-x86_64-linode25 x86_64)。 配置 Ubuntu Server 系统 如果你是...

    Ruby on rails blog (博客)

    通过一个极简单的博客例子,展示一些基本的Ruby on Rails特性和开发方法。系统:UBUNTU 11.10 rails :3.0.8 上做的详细步骤以及代码。

    Ruby on rails blog (博客程序)

    在这个“Ruby on Rails博客程序”中,我们将深入探讨如何在Ubuntu 11.10操作系统上,使用Rails 3.0.8版本构建一个简单的博客平台。 首先,我们要了解Rails的基本概念。MVC架构将应用分为三个主要部分:模型(Model...

Global site tag (gtag.js) - Google Analytics