`
gazeldx
  • 浏览: 105566 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

Ruby On Rails和locomotiveCMS安装经历

阅读更多

ssh -qTfnN -D 7070 gazeldx@216.194.70.6  zj85..

听robbin说locomotivecms很棒,就下载来试试。我的环境是windows xp.后来在bundle install的过程中,发现有个叫kgio的gem无法正常使用,查资料发现该gem只能在unix-like OS下使用。所以就

安装UBUNTU

安装方法见我写的http://zhangjian1982.iteye.com/blog/1107268

然后要装ruby和rubygems还有rails啦,见http://wiki.rubyonrails.org/getting-started/installation/linux

 

安装ruby

如果用sudo apt-get install ruby -full build-essential这种方式安装到ruby的版本由ubuntu决定,如果自己想指定版本,则通过ftp://ftp.ruby-lang.org/pub/ruby/1.8/下载。

测试用ruby -v和$ ruby -ropenssl -rzlib -rreadline -e "puts :Hello" Will show:Hello

我建议你安装最新版本ruby,见http://www.ruby-lang.org/en/downloads/  我建议你采用rvm的方式安装,详见我的另一篇博文。

sudo apt-get install ruby gems即可。但是这种方法安装会导致rails的命令不能作为命令行直接执行,所以我建议按照rubyonrails.org的官方写法:即http://rubyforge.org/frs/?group_id=126下载,然后解压缩,然后执行 sudo ruby setup.rb

sudo ln -s /usr/bin/gem1.8 /usr/bin/gem, rubygems被装到了/usr/lib/ruby/gems下面。

安装rails

如果用sudo apt-get install rails。测试用rails -h 这种方式会把rails安装到/usr/bin/rails ,安装的版本往往不是rails的最新版本,这是不推荐的。我推荐官方到安装方式:sudo gem install rails ,即通过rubygems安装,这能安装最新版本。

/var/lib/gems/1.8/gems/这是通过sudo apt-get rubygems的安装rails的目标文件夹。
/usr/lib/ruby/gems/1.8/gems/这是通过自己编译ruby setup.rb安装rubygems后安装rails的目标文件夹

 

然后我开始

rails new tweb

报错

bundle install后发现报sqlite3的错误:Installing sqlite3 (1.3.4) with native extensions /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
用sudo apt-get install libsqlite3-dev

和sudo gem install sqlite3-ruby解决

 

 

安装locomotive CMS

按照它官网的方法安装(因为有墙,所以我在文后加上相关内容),安装时如果执行bundle install报错,则执行sudo gem install bundler即可 (look:Bundler is a tool that manages gem dependencies for your ruby application. 后来报错:

 Could not find gherkin-2.5.2 in any of the sources,可能和我使用了rails3.1版本有关。目前locomotivecms是用3.0.10,因为这个问题,我没有安装成功,所以,我们现在必须把版本换到3.0.10,方法见:我之前写的一个文章,你可以搜索RVM http://zhangjian1982.iteye.com/blog/1222579

)。

这时要执行bundle install了。下面两个错误一般都会报,所以如果你打算节省时间,直接解决掉再执行。

*报错nokogiri 。。 native extension libxml2 is missing,用sudo apt-get install libxslt-dev libxml2-dev 解决

*报错Installing rmagick (2.12.2) with native extensions /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/bin/ruby1.8 extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.12.2. Can't find Magick-config in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Can't find Magick-config

解决办法:

sudo apt-get install libmagick9-dev

sudo apt-get install libmagickwand-dev

在Engine installation方法下,bundle exec rails g locomotive:install会报错 :解决办法见本文下面的介绍!

 

bundle exec unicorn_rails启动rails

最后访问http://127.0.0.1:8080/admin OK啦。

 

 

官方安装说明:

Installation guide

Locomotive runs on my different platforms, but it's optimized for the Bushido hosting platform. Bushido enables Locomotive to set subdomains and custom domains directly, launch with built-in email accounts, and provides highly reliable hosting, all with a single click.

We suggest you to start to read the requirements section. Then choose one of the installation methods.
If you want to test Locomotive and sneak into the code, we recommend you the from source installation.

Let us know if you have any suggestions or if you find bugs .

 

Requirements

Ruby

Of course :-)

We tested it with both Ruby 1.8.7 (2009-06-12 patchlevel 174) and Ruby 1.9.2.p0 which are two of Ruby versions Heroku supports.

Please note that performances are much better with Ruby 1.9.2 and the stability seems okay (no bugs found for now).

Mongodb

Locomotive CMS does not use a classic sql database such as mysql or postgresql but rather a nosql database named mongodb.

Mongodb is available on many OS. Check this link out for more information.

Note: We suggest you to take a version from 1.6.0.

ImageMagick

Uploaded images for asset collections are cropped, for example, and Locomotive uses ImageMagick for this purpose. Again, ImageMagick is available on a large set of OS.

Note: On Mac OS X, try Homebrew or MagickInstaller to install it. This will save you a couple of hours because its installation can be really painful sometimes.

Browsers (back-office)

We haven't had time to test the IE versions. So for now, we ask you to use the Locomotive back-office with the following browsers: Safari , Firefox and Chrome

 

From source installation

This way of installing Locomotive is recommended when you want to add new features, correct bugs or see how Locomotive works internally.

1. Get source code from github.

git clone git://github.com/locomotivecms/engine.git locomotive
cd locomotive

2. Install gems.

bundle install

3. Edit the Locomotive settings.

mate config/initializers/locomotive.rb

Note: If you run Locomotive in local and with the multi-sites mode on, do not forget to update your /etc/hosts file accordingly.

By default, Locomotive uses Amazon S3 in production. To change it, modify the carrierwave initialization file.

mate config/initializers/carrierwave.rb

4. You also may want to change your mongodb connection settings.

mate config/mongoid.yml

5. Run the application server.

bundle exec unicorn_rails

6. Open your browser.

open http://localhost:8080/admin

7. Follow the instructions in the browser to create your first account and site.

8. (ONLY IN PRODUCTION ) Push the assets used by the Locomotive back-office to Amazon S3 for better performances.(Jammit-S3 ).

export S3_KEY_ID=<your s3 key id>
export S3_SECRET_KEY=<your s3 secret key>
export S3_BUCKET=<your s3 bucket name>
jammit-s3 --force

If you do not want to push the assets in S3 and instead leave them in your application, remove the lines about S3 in the config/assets.yml file and run the following command:

jammit --force

 

Engine installation

This is probably the cleanest way to build your own comprehensive hosting CMS platform because the Locomotive core cannot be broken and all you need to do is add your own content.

1. First, create a Rails project.

rails new my_platform -O -T -J
cd my_platform
rm public/index.html

2. You have to tell your Rails app that you want to include the Locomotive gem available on Gemcutter. Edit your application Gemfile and add these lines if missing.

gem 'rails', '3.0.10'
gem 'locomotive_cms', :git => 'git://github.com/locomotivecms/engine.git', :require => 'locomotive/engine'
gem 'unicorn', :group => 'development'

3. Install gems

bundle install

4. Add the Locomotive config files and assets

bundle exec rails g locomotive:install

(注意:这句话执行很可能报错rest - client - 1.4 . 2 / lib / restclient . rb : 9 : in `rescue in <top (required)>':

no such file to load -- net/https. Try running apt-get install libopenssl-ruby (LoadError)

解决办法:

sudo apt-get install build - essential bison openssl libreadline5 libreadline5 - dev curl git zlib1g zlib1g - dev libssl - dev libsqlite3 - 0 libsqlite3 - dev sqlite3 libxml2 - dev

 

$ rvm remove 1.9 . 2
$ rvm pkg install openssl

$ rvm install 1.9 . 2 - C -- with - openssl - dir = $HOME /. rvm / usr

)

5. Edit the locomotive settings

mate config/initializers/locomotive.rb

By default, Locomotive uses Amazon S3 in production. To change it, modify the carrierwave initialization file.

mate config/initializers/carrierwave.rb

6. You also may want to change your mongodb connection settings

mate config/mongoid.yml

7. Run the application server

bundle exec unicorn_rails

8. Open your browser

open http://localhost:8080/admin

9. Follow the instructions in the browser to create your first account and site.

10. (ONLY IN PRODUCTION ) Push the assets used by the Locomotive back-office to Amazon S3 for better performances (Jammit-S3 ).

export S3_KEY_ID=<your s3 key id>
export S3_SECRET_KEY=<your s3 secret key>
export S3_BUCKET=<your s3 bucket name>
jammit-s3 --force

If you do not want to push the assets in S3 but leave them in your application instead, remove the lines about S3 in the config/assets.yml file and run the following command

jammit --force  

 

分享到:
评论

相关推荐

    Ruby on Rails Tutorial

    在这个全球互联的世界中,计算机编程和 Web 应用程序开发都在迅猛发展,我很期待能为中国的开发者提供 Ruby on Rails 培训。学习英语这门世界语言是很重要的,但先通过母语学习往往会更有效果。正因为这样,当看到 ...

    ruby on rails 101

    - **推动者**:Dave Thomas和他的Pragmatic Programmers团队对Ruby on Rails的发展起到了重要的推动作用。 #### 四、Rails简介 Ruby on Rails是一个开源Web框架,专注于提升程序员的工作效率和产品的可持续性。它的...

    Ruby on Rails安装包全集(Linux)

    在Linux环境下安装Ruby on Rails需要一系列的依赖包和步骤,本资源包提供了所需的所有组件,帮助用户在Linux系统上顺利构建RoR开发环境。 1. **readline-5.1.tar.gz**: 这是Readline库的源代码包,它提供了一种交互...

    ruby on rails最新版

    它提供了便捷的方式来获取和安装Rails框架,从而快速进入开发状态。不过,使用前应确保已安装好Ruby环境,并了解基本的Ruby语法和Rails框架概念。同时,保持对框架更新的关注,及时升级以确保应用的安全性和稳定性。

    ruby on rails社区网站开发源码

    1. **安装与环境设置**:首先,你需要安装Ruby和Rails。这通常涉及设置Ruby版本管理器如RVM或rbenv,然后安装特定版本的Ruby,接着通过Gemfile安装Rails。 2. **初始化项目**:使用`rails new`命令创建一个新的...

    ruby on rails 3 tutorial.pdf

    《Ruby on Rails 3 Tutorial》是一本专门为初学者设计的指南,旨在帮助读者快速掌握Ruby on Rails这一强大的Web开发框架。Ruby on Rails(简称Rails)是基于Ruby语言的一个开源框架,它采用MVC(Model-View-...

    使用 Ruby on Rails 和 Eclipse 开发 iPhone 应用程序教程(含图例)

    【使用 Ruby on Rails 和 Eclipse 开发 iPhone 应用程序教程】是一个面向中级开发者的系列教程,旨在教读者如何利用 Ruby on Rails 框架在服务器端为 Mobile Safari 设计和提供自定义内容,以适应 iPhone 和 iPod ...

    Ruby on Rails入门权威经典

    Ruby on Rails(简称Rails)是基于Ruby编程语言的开源框架,以其“DRY(Don't Repeat Yourself)”和“Convention Over Configuration”原则著称,极大地提高了开发效率和代码可读性。 本书首先会介绍Ruby语言的...

    Ruby on Rails安装指南(Ruby 1.8.6+Rails 2.0.2)

    Ruby on Rails 安装指南是指安装 Ruby 1.8.6 和 Rails 2.0.2 的详细步骤。首先,需要下载 Ruby One-Click Installer 版本,并安装 Ruby。然后,下载 Rails 2.0.2 版本,并安装。接下来,需要安装 Mongrel 服务器。...

    ruby on rails for dummies

    《Ruby on Rails for Dummies》这本书将引导读者从安装Ruby和Rails环境开始,逐步学习如何创建模型、视图和控制器(MVC架构),搭建数据库,使用路由系统,以及实现CRUD(Create, Read, Update, Delete)操作。...

    Ruby on Rails安装及MySQL数据库配置指南

    在安装和配置 Ruby on Rails 和 MySQL 数据库的过程中,可能会遇到一些问题。例如,在创建 POSTS 应用时可能会遇到问题,创建数据后数据库中有数据,但是到 Listing posts 界面无法查看,总是报错。解决方法是下载 ...

    Ruby on Rails Guides v2 - Ruby on Rails 4.2.5

    ### Ruby on Rails Guides v2 - Ruby on Rails 4.2.5 #### 一、重要概念及基础假设 - **重要概念**:本指南旨在帮助读者深入理解Ruby on Rails(以下简称Rails)4.2.5版本的核心功能与最佳实践。 - **基础假设**:...

    Ruby On Rails中文教材(PDF)

    PDF文档通常包含详细的教程、实例代码和可能的练习题,旨在帮助学习者全面了解和掌握Ruby on Rails的核心概念和技术。 在Rails框架中,关键知识点包括: 1. **Ruby基础知识**:首先,理解Ruby语言的基本语法和特性...

    Ruby on Rails入门经典代码

    通过学习和实践压缩包中的"Ruby on Rails入门经典代码",新手不仅可以了解Rails的基本概念,还能掌握实际项目中的应用技巧,逐步成长为一名熟练的Rails开发者。记得不断探索、实践和学习新的Rails知识,以适应不断...

    Ruby on Rails实践

    总的来说,Ruby on Rails实践涉及的知识点包括但不限于:Ruby语言基础、Rails框架结构、MVC模式、ActiveRecord、路由、测试驱动开发、插件和gem使用、以及部署策略。通过学习和实践,开发者能够快速构建功能丰富的...

    Ruby on Rails教程:学习使用Rails进行Web开发Ruby on Rails Tutorial: Learn Web Development with Rails

    本书教您如何使用Ruby on Rails开发和部署真正的,具有工业实力的Web应用程序,Ruby on Rails是为诸如Twitter,Hulu,GitHub和Yellow Pages等顶级网站提供支持的开源Web框架。

    ruby on rails 教程源码

    这个“ruby on rails 教程源码”很可能是为了辅助学习者深入理解Rails的工作原理和最佳实践,通过实际操作来提升技能。 在Rails中,`sample_app-master`可能是一个示例应用程序的主目录,它包含了完整的项目结构。...

    Ruby on Rails中文指南

    Ruby on Rails,简称Rails,是一款基于Ruby语言的开源Web应用框架,它遵循MVC(Model-View-Controller)架构模式,旨在提升开发效率和代码的可读性。Rails以其“约定优于配置”的设计理念,以及“DRY(Don't Repeat ...

Global site tag (gtag.js) - Google Analytics